text:
////////////////////////////////////////////////////////////////////////////////
// paramlist.h
// Author     : Francesco Giordana
// Start Date : January 13, 2005
// Copyright  : (C) 2006 by Francesco Giordana
// Email      : fra.giordana@tiscali.it
////////////////////////////////////////////////////////////////////////////////
// Port to 3D Studio Max - Modified original version
// Author	  : Doug Perkowski - OC3 Entertainment, Inc.
// Start Date : December 10th, 2007
////////////////////////////////////////////////////////////////////////////////
// Port to FBX - Modified original version
// Author	  : Doug Perkowski - OC3 Entertainment, Inc.
// Start Date : January 8th, 2012
////////////////////////////////////////////////////////////////////////////////
/*********************************************************************************
*                                                                                *
*   This program is free software; you can redistribute it and/or modify         *
*   it under the terms of the GNU Lesser General Public License as published by  *
*   the Free Software Foundation; either version 2 of the License, or            *
*   (at your option) any later version.                                          *
*                                                                                *
**********************************************************************************/

#ifndef PARAMLIST_H
#define PARAMLIST_H

#define PRECISION 0.0001

//#include "maxExportLayer.h"
#include <iostream>
#include <fstream>
#include <math.h>
#include <vector>
#include <set>
#include <cassert>

#include "common.h"
// Length units multipliers from Maya internal unit (cm)

#define CM2MM 10.0
#define CM2CM 1.0
#define CM2M  0.01
#define CM2IN 0.393701
#define CM2FT 0.0328084
#define CM2YD 0.0109361

namespace FxOgreFBX
{
    std::string StripToTopParent(const std::string& filepath);
    std::string StripFilename(const std::string& filepath);

    class Submesh;

    typedef struct clipInfoTag
    {
        float start;							//start time of the clip
        float stop;								//end time of the clip
        float rate;								//sample rate of anim curves, -1 means auto
        std::string name;						//clip name
    } clipInfo;

    typedef enum
    {
        NPT_CURFRAME,
        NPT_BINDPOSE
    } NeutralPoseType;

    typedef enum
    {
        TS_TEXCOORD,
        TS_TANGENT
    } TangentSemantic;

    /***** Class ParamList *****/
    class ParamList
    {
    public:
        // class members
        bool exportMesh, exportMaterial, exportAnimCurves, exportCameras, exportAll, exportVBA,
            exportVertNorm, exportVertCol, exportTexCoord, exportCamerasAnim,
            exportSkeleton, exportSkelAnims, exportBSAnims, exportVertAnims, exportBlendShapes,
            exportWorldCoords, useSharedGeom, lightingOff, copyTextures, exportParticles,
            tangentsSplitMirrored, tangentsSplitRotated, tangentsUseParity,
            buildTangents, buildEdges, skelBB, bsBB, vertBB, yUpAxis, exportScene,
            prefixTextures, useanimframebind;

        float lum;	// Length Unit Multiplier

        float fps;  //frames per second (anim esporter).

        int bindframe; // the frame to use when figuring where things are at the bind.

        std::string meshFilename, skeletonFilename, materialFilename, animFilename, camerasFilename, matPrefix, texturePrefix,
            texOutputDir, particlesFilename, outputDir, sceneFilename, fbxFilename;

        std::ofstream outMaterial, outAnim, outCameras, outParticles;

        std::vector<std::string> writtenMaterials;

        std::vector<clipInfo> skelClipList;
        std::vector<clipInfo> BSClipList;
        std::vector<clipInfo> vertClipList;

        NeutralPoseType neutralPoseType;
        TangentSemantic tangentSemantic;

        std::vector<Submesh*> loadedSubmeshes;

        FbxScene* pScene;
        FbxManager* pSdkManager;

        // constructor
        ParamList()	{
            lum = 1.0f;
            fps = 10;
            bindframe = 0;
            exportMesh = true;
            exportMaterial = true;
            exportSkeleton = true;
            exportSkelAnims = true;
            exportBSAnims = true;
            exportVertAnims = false;
            exportBlendShapes = true;
            exportAnimCurves = false;
            exportCameras = false;
            exportParticles = false;
            exportAll = true;
            exportWorldCoords = true;
            exportVBA = true;
            exportVertNorm = true;
            exportVertCol = false;
            exportTexCoord = true;
            exportCamerasAnim = false;
            useSharedGeom = true;
            lightingOff = false;
            copyTextures = true;
            skelBB = false;
            bsBB = false;
            vertBB = false;

            meshFilename = "";
            skeletonFilename = "";
            materialFilename = "";
            animFilename = "";
            camerasFilename = "";
            particlesFilename = "";
            matPrefix = "";
            texOutputDir = "";
            fbxFilename = "";
            skelClipList.clear();
            BSClipList.clear();
            vertClipList.clear();
            neutralPoseType = NPT_CURFRAME;
            buildEdges = false;
            buildTangents = false;
            tangentsSplitMirrored = false;
            tangentsSplitRotated = false;
            tangentsUseParity = false;
            tangentSemantic = TS_TANGENT;
            loadedSubmeshes.clear();
            exportScene = true;
            prefixTextures = false; // add matPrefix (mesh base file name no extension) to texture names to ensure they are unique.
            useanimframebind = false;
            sceneFilename = "";

            pScene = NULL;
            pSdkManager = NULL;
        }

        ParamList& operator=(ParamList& source)
        {
            size_t i;
            lum = source.lum;
            fps = source.fps;
            bindframe = source.bindframe;
            exportMesh = source.exportMesh;
            exportMaterial = source.exportMaterial;
            exportSkeleton = source.exportSkeleton;
            exportSkelAnims = source.exportSkelAnims;
            exportBSAnims = source.exportBSAnims;
            exportVertAnims = source.exportVertAnims;
            exportBlendShapes = source.exportBlendShapes;
            exportAnimCurves = source.exportAnimCurves;
            exportCameras = source.exportCameras;
            exportAll = source.exportAll;
            exportWorldCoords = source.exportWorldCoords;
            exportVBA = source.exportVBA;
            exportVertNorm = source.exportVertNorm;
            exportVertCol = source.exportVertCol;
            exportTexCoord = source.exportTexCoord;
            exportCamerasAnim = source.exportCamerasAnim;
            exportParticles = source.exportParticles;
            useSharedGeom = source.useSharedGeom;
            lightingOff = source.lightingOff;
            copyTextures = source.copyTextures;
            skelBB = source.skelBB;
            bsBB = source.bsBB;
            vertBB = source.vertBB;
            meshFilename = source.meshFilename;
            skeletonFilename = source.skeletonFilename;
            materialFilename = source.materialFilename;
            animFilename = source.animFilename;
            camerasFilename = source.camerasFilename;
            particlesFilename = source.particlesFilename;
            fbxFilename = source.fbxFilename;
            matPrefix = source.matPrefix;
            texOutputDir = source.texOutputDir;
            buildEdges = source.buildEdges;
            buildTangents = source.buildTangents;
            tangentsSplitMirrored = source.tangentsSplitMirrored;
            tangentsSplitRotated = source.tangentsSplitRotated;
            tangentsUseParity = source.tangentsUseParity;
            tangentSemantic = source.tangentSemantic;
            skelClipList.resize(source.skelClipList.size());
            //normalizeScale = source.normalizeScale;
            yUpAxis = source.yUpAxis;
            exportScene = source.exportScene;
            sceneFilename = source.sceneFilename;
            prefixTextures = source.prefixTextures;
            useanimframebind = source.useanimframebind;

            pScene = source.pScene;
            pSdkManager = source.pSdkManager;
            for (i=0; i< skelClipList.size(); i++)
            {
                skelClipList[i].name = source.skelClipList[i].name;
                skelClipList[i].start = source.skelClipList[i].start;
                skelClipList[i].stop = source.skelClipList[i].stop;
                skelClipList[i].rate = source.skelClipList[i].rate;
            }
            BSClipList.resize(source.BSClipList.size());
            for (i=0; i< BSClipList.size(); i++)
            {
                BSClipList[i].name = source.BSClipList[i].name;
                BSClipList[i].start = source.BSClipList[i].start;
                BSClipList[i].stop = source.BSClipList[i].stop;
                BSClipList[i].rate = source.BSClipList[i].rate;
            }
            vertClipList.resize(source.vertClipList.size());
            for (i=0; i< vertClipList.size(); i++)
            {
                vertClipList[i].name = source.vertClipList[i].name;
                vertClipList[i].start = source.vertClipList[i].start;
                vertClipList[i].stop = source.vertClipList[i].stop;
                vertClipList[i].rate = source.vertClipList[i].rate;
            }
            neutralPoseType = source.neutralPoseType;
            for (i=0; i<source.loadedSubmeshes.size(); i++)
                loadedSubmeshes.push_back(source.loadedSubmeshes[i]);
            return *this;
        }

        // destructor
        ~ParamList() {
            if (outMaterial)
                outMaterial.close();
            if (outAnim)
                outAnim.close();
            if (outCameras)
                outCameras.close();
            if (outParticles)
                outParticles.close();
        }
        // Generates default output paths for ogre files given the mesh output file path.
        bool setOutputFilePaths(const std::string& meshOutputPath);
        // method to open files for writing
        bool openFiles();
        // method to close open output files
        bool closeFiles();
    };

};	//end namespace

#endif


text: source ./start.sh cn.aofeng.demo.io.MultiThreadEchoServer 9090

redpajama_set_name: RedPajamaGithub


text:
<!DOCTYPE html>

  <meta charset="utf-8">

  <meta name="viewport" content="width=device-width, initial-scale=1.0">

  <title>项目部署 — xingxing 1.0 documentation</title>

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

    <link rel="top" title="xingxing 1.0 documentation" href="index.html"/>
        <link rel="next" title="api文档" href="api.html"/>
        <link rel="prev" title="调试与工具" href="debug.html"/>

           xingxing

  <form id="rtd-search-form" class="wy-form" action="search.html" method="get">
    <input type="text" name="q" placeholder="Search docs" />
    <input type="hidden" name="check_keywords" value="yes" />
    <input type="hidden" name="area" value="default" />
  </form>

项目规范

前端

python

django

其它

相关技术和版本

前端

后台

数据库

缓存

其它

部署

目录结构

主要模块

手机页面

协议服务器

微信公众号

基本要求

协议服务器

手机页面

手机页面开发相关

图片的处理

移动设备上的事件

注意事项

功能需求分析

设备列表

权限

数据库设计

基本信息

集合结构

ebc_user(用户集合)

ebc_device(设备集合)

ebc_room(房间集合)

ebc_user_device(用户设备集合)

ebc_status(状态集合)

ebc_setup(配置集合)

ebc_device_token(device_token集合)

调试与工具

memcached可视化工具

项目部署

基本配置

uwsgi配置文件

nginx配置文件

协议服务器配置

更新到服务器

api文档

第三方帐号登录接口

输入参数

输出参数

上报mac地址接口

输入参数

输出参数

获取mac地址列表接口

输入参数

输出参数

更新Token时间接口

输入参数

输出参数

客服电话接口

输入参数

输出参数

关于接口

输入参数

输出参数

设备列表接口

输入参数

输出

分享页面下载接口

输入参数

输出

上报device_token接口

输入参数

输出参数

其他说明

TOKEN异常

更新日志

2015.06.11

2015.06.16

2015.06.24

2015.06.26

        xingxing

Docs »

项目部署

项目部署¶

基本配置¶

uwsgi端口号:8003

域名:qingke.device.53iq.com

虚拟环境名称:xingxingenv

uwsgi配置文件¶

[uwsgi]
#v41
chdir=/root/zhengdw/xingxing
module=xingxing.wsgi
env DJANGO_SETTINGS_MODULE=xingxing.settings
master=True
pidfile=/tmp/xingxing-master.pid
socket=0.0.0.0:8003
# 开启的进程数,推荐值=cpu核心数*2,因为有个叫超线程的东西
processes=8
vacuum=True
max-requests=5000
daemonize=/var/log/uwsgi-xingxing.log
# 开启的线程数,在每个进程中再开启的线程,一般2个即可
threads=2
# 让uwsgi使用virtualenv运行
virtualenv=/root/.virtualenvs/xingxingenv

nginx配置文件¶

server {
listen 80;
server_name qingke.device.53iq.com;
access_log /var/log/nginx/xingxing-access.log;
error_log /var/log/nginx/xingxing-error.log;
location / {
        uwsgi_pass 127.0.0.1:8003;
        include uwsgi_params;
      }
location ~ ^/static/ {
 #此处配置要注意,后面的static不能写了,不能写成root /home/tsengdavid/workspace/smartsys/static;
        root /root/zhengdw/xingxing/;
        #设置缓存过期时间为1天
        expires 24h;
        access_log   off;
     }
location ~ ^/tcp {
    proxy_pass http://127.0.0.1:9000;
    proxy_redirect off;
 }

}

协议服务器配置¶

端口号:1883
域名:qingke.device.53iq.com

更新到服务器¶

除了/conf/目录下的文件下的要慎重更新(里面的配置信息与服务器不一致),其它的都可以替换

        Next

         Previous

        © Copyright 2015, 53iq.


text:
import assert from 'power-assert'
import schedule from './schedule'
import {OP_TAKE, OP_SEND, THENABLE_MIXED_USE_MSG} from './constants'
import {SEND_TYPE_VALUE, SEND_TYPE_ERROR} from './constants'
import {arrayPool} from './pools'

const DEBUG = true
let nextId = 0|0

export class Thenable {

  constructor(chan, op) {
    if (DEBUG) {
      this._id = ++nextId
    }
    this._chan = chan
    this._state = op|0 // _op = op, non-sealed
  }

  then(onFulfilled, onRejected) {
    if (this._isSealed) {
      throw new Error(THENABLE_MIXED_USE_MSG)
    }
    return new Promise((resolve, reject) => {
      let result = this._result
      if (result) {
        if (result.isError) {
          if (onRejected) {
            resolve(onRejected(result.value))
          } else {
            reject(result.value)
          }
        } else {
          resolve(onFulfilled ? onFulfilled(result.value) : result.value)
        }
        return
      }
      this._addSub({
        onFulfilled: onFulfilled ? wrapHandler(onFulfilled, resolve, reject) : resolve,
        onRejected: onRejected ? wrapHandler(onRejected, resolve, reject) : reject
      })
    })
  }

  catch(onRejected) {
    return this.then(undefined, onRejected)
  }

  get _op() {
    return this._state & 0b11
  }

  set _op(op) {
    this._state = (this._state & ~0b11) | op
  }

  get _isSealed() {
    return this._state & 0b100
  }

  _seal() {
    this._state |= 0b100
  }

  _unseal() {
    this._state &= ~0b100
  }

  _addSub(newSub /* = { onFulfilled, onRejected } */) {
    let subs = this._subs
    if (!subs) {
      this._subs = newSub
    } else if (subs.constructor === Object) {
      this._subs = arrayPool.take()
      this._subs.push(subs)
      this._subs.push(newSub)
    } else {
      subs.push(newSub)
    }
  }

  _fulfill(value) {
    this._settle(value, false)
    return this
  }

  _reject(value) {
    this._settle(value, true)
    return this
  }

  _settle(value, isError) {
    if (this._result) {
      return
    }
    this._result = { value, isError }
    if (!this._subs) {
      return
    }
    if (this._isSealed) {
      this._notify()
    } else {
      schedule.microtask(() => this._notify())
    }
  }

  _notify() {
    assert(this._subs != undefined)
    let {value, isError} = this._result
    let subs = this._subs
    this._subs = undefined
    if (subs.constructor === Object) {
      return isError ? subs.onRejected(value) : subs.onFulfilled(value)
    }
    if (isError) {
      for (let i = 0, l = subs.length; i < l; ++i) {
        subs[i].onRejected(value)
      }
    } else {
      for (let i = 0, l = subs.length; i < l; ++i) {
        subs[i].onFulfilled(value)
      }
    }
    arrayPool.put(subs)
  }

  get _bound() {
    return this._bound_ || (this._bound_ = {
      fulfill: (val) => {
        this._bound_ = undefined
        this._fulfill(val)
      },
      reject: (err) => {
        this._bound_ = undefined
        this._reject(err)
      }
    })
  }

  toString() {
    return `Thenable(${ DEBUG ? this._id + ', ' : ''
      }chan = ${ this._chan || '<no>'
      }, op = ${ this._op == OP_TAKE ? 'take' :
         this._op == OP_SEND ? 'send ' + describeBox(this._sendData) : '<no>'
      }, result = ${ describeBox(this._result)
      }, seal = ${ this._isSealed ? 1 : 0
      })`
  }

  inspect() {
    return this.toString()
  }
}

function wrapHandler(handler, resolve, reject) {
  return function tryCatch(val) {
    try {
      resolve(handler(val))
    } catch (err) {
      reject(err)
    }
  }
}

function describeBox(pair) {
  return pair
    ? pair.isError || pair.type == SEND_TYPE_ERROR
      ? `Error(${pair.value})`
      : pair.type == SEND_TYPE_VALUE
        ? `Value(${pair.value})`
        : `SendIntent(fn.${ pair.value.name || 'anon' })`
    : `<no>`
}

Thenable.prototype._cancel = undefined
Thenable.prototype._subs = undefined
Thenable.prototype._result = undefined
Thenable.prototype._bound_ = undefined


text:
package argmatey;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public final class OptionArg {

	private final List<Object> objectValues;
	private final List<OptionArg> optionArgs;
	private final OptionArgSpec optionArgSpec;
	private final String string;

	OptionArg(
			final List<Object> objValues,
			final List<OptionArg> optArgs,
			final OptionArgSpec optArgSpec,
			final String optArg) {
		this.objectValues = new ArrayList<Object>(objValues);
		this.optionArgs = new ArrayList<OptionArg>(optArgs);
		this.optionArgSpec = optArgSpec;
		this.string = optArg;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj) {
			return true;
		}
		if (obj == null) {
			return false;
		}
		if (!(obj instanceof OptionArg)) {
			return false;
		}
		OptionArg other = (OptionArg) obj;
		if (this.objectValues == null) {
			if (other.objectValues != null) {
				return false;
			}
		} else if (!this.objectValues.equals(other.objectValues)) {
			return false;
		}
		if (this.optionArgSpec == null) {
			if (other.optionArgSpec != null) {
				return false;
			}
		} else if (!this.optionArgSpec.equals(other.optionArgSpec)) {
			return false;
		}
		if (this.optionArgs == null) {
			if (other.optionArgs != null) {
				return false;
			}
		} else if (!this.optionArgs.equals(other.optionArgs)) {
			return false;
		}
		if (this.string == null) {
			if (other.string != null) {
				return false;
			}
		} else if (!this.string.equals(other.string)) {
			return false;
		}
		return true;
	}

	public OptionArgSpec getOptionArgSpec() {
		return this.optionArgSpec;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((this.objectValues == null) ? 0 : this.objectValues.hashCode());
		result = prime * result + ((this.optionArgSpec == null) ? 0 : this.optionArgSpec.hashCode());
		result = prime * result + ((this.optionArgs == null) ? 0 : this.optionArgs.hashCode());
		result = prime * result + ((this.string == null) ? 0 : this.string.hashCode());
		return result;
	}

	public Object toObjectValue() {
		return this.objectValues.get(0);
	}

	public List<Object> toObjectValues() {
		return Collections.unmodifiableList(this.objectValues);
	}

	public List<OptionArg> toOptionArgs() {
		List<OptionArg> optArgs = new ArrayList<OptionArg>();
		if (this.optionArgs.size() == 0) {
			optArgs.add(this);
		} else {
			optArgs.addAll(this.optionArgs);
		}
		return Collections.unmodifiableList(optArgs);
	}

	@Override
	public String toString() {
		return this.string;
	}

	public <T> T toTypeValue(final Class<T> type) {
		return type.cast(this.toObjectValue());
	}

	public <T> List<T> toTypeValues(final Class<T> type) {
		List<T> typeValues = new ArrayList<T>();
		for (Object objectValue : this.toObjectValues()) {
			typeValues.add(type.cast(objectValue));
		}
		return Collections.unmodifiableList(typeValues);
	}

}


text:
package main

import (
	"sync"

	kingpin "gopkg.in/alecthomas/kingpin.v2"

	"github.com/Sirupsen/logrus"
	"github.com/rifflock/lfshook"
	"github.com/simongui/fastlane/logging"
	"github.com/simongui/fastlane/services"
)

var (
	mysqlHost     = "db1.us-east-1.com"
	mysqlPort     = uint16(33301)
	mysqlUsername = "repl_user"
	mysqlPassword = "password"
	service       *services.ServiceHost
	waitGroup     sync.WaitGroup
)

var (
	verbose            = kingpin.Flag("verbose", "Verbose mode.").Short('v').Bool()
	logpath            = kingpin.Flag("logpath", "Where to store the log files").String()
	httpListenAddress  = kingpin.Flag("http-address", "Address for the HTTP protocol server to listen on.").Default(":8000").String()
	redisListenAddress = kingpin.Flag("redis-address", "Address for the Redis protocol server to listen on.").Default(":6379").String()
	store              = kingpin.Flag("store", "Type of storage to use (map (in-memory), boltdb or lmdb)").Default("boltdb").String()
	dbpath             = kingpin.Flag("dbpath", "Where to store the database files").Default("fastlane.db").String()
)

func main() {

	// f, err := os.Create("profile.prof")
	// if err != nil {
	// 	log.Fatal(err)
	// }
	// pprof.StartCPUProfile(f)
	// defer pprof.StopCPUProfile()
	//
	// c := make(chan os.Signal, 1)
	// signal.Notify(c, os.Interrupt)
	// go func() {
	// 	for range c {
	// 		pprof.StopCPUProfile()
	// 	}
	// }()

	kingpin.Parse()

	if *verbose {
		logrus.AddHook(logging.ContextHook{})
	}

	// Write log entries to a file on disk if enabled.
	if *logpath != "" {
		logrus.StandardLogger().Hooks.Add(lfshook.NewHook(lfshook.PathMap{
			logrus.InfoLevel:  *logpath,
			logrus.WarnLevel:  *logpath,
			logrus.ErrorLevel: *logpath,
			logrus.DebugLevel: *logpath,
			logrus.FatalLevel: *logpath,
			logrus.PanicLevel: *logpath,
		}))
	}

	logrus.Info("process started")

	service = &services.ServiceHost{}
	go service.ListenAndServe(*dbpath, *store, *httpListenAddress, *redisListenAddress, mysqlHost, mysqlPort, mysqlUsername, mysqlPassword, 9999)

	waitGroup.Add(1)
	waitGroup.Wait()
}


text:
<?php $this->load->view('partials/header') ?>

        <?php
        $attr = array('class' => 'ui form');
        echo form_open('Auth/register',$attr);
        ?>

          Fullname
          <input type="text" name="fullname" placeholder="Fullname">

          Email
          <input type="email" name="email" placeholder="Email">

          Gender

            <select name="gender" class="ui fluid search dropdown">
              <option value="0">-- Choose --</option>
              <option value="male">Male</option>
              <option value="female">Female</option>
            </select>

            Username
            <input type="text" name="username" placeholder="Username">

            Password
            <input type="password" name="password" placeholder="Password">

          Choose Role
          <select name="role" class="ui fluid search dropdown">
            <option value="0">-- Choose --</option>
            <option value="writer">Writer</option>
            <option value="user">User</option>
          </select>

        <button class="ui button primary" type="submit">Submit</button>

<?php echo validation_errors(); ?>

        <?php echo form_close() ?>

<?php $this->load->view('partials/footer') ?>


text:
/* jshint expr:true */
import {expect} from 'chai';
import {describe, it} from 'mocha';
import {setupComponentTest} from 'ember-mocha';
import hbs from 'htmlbars-inline-precompile';

describe('Integration: Component: modals/upload-theme', function() {
    setupComponentTest('modals/upload-theme', {
        integration: true
    });

    it('renders', function() {
        // Set any properties with this.set('myProperty', 'value');
        // Handle any actions with this.on('myAction', function(val) { ... });
        // Template block usage:
        // this.render(hbs`
        //   {{#modals/upload-theme}}
        //     template content
        //   {{/modals/upload-theme}}
        // `);

        this.render(hbs`{{modals/upload-theme}}`);
        expect(this.$()).to.have.length(1);
    });
});


text:
import { Component, OnInit } from '@angular/core';

@Component({
  selector: '[username]',
  templateUrl: './username.component.html',
  styleUrls: ['./username.component.css']
})
export class UsernameComponent implements OnInit {

  allowUpdateUsername: boolean = false;
  usernamesList: Array<String> = [];
  username: string = "";

  constructor() {
  }

  ngOnInit() {
  }

  /**
   * Check if we can unlock the Submit Button
   *
   * @param event
   */
  checkData() {
    if (this.username.length == 0) {
      this.allowUpdateUsername = false;
    } else {
      this.allowUpdateUsername = true;
    }
  }

  /**
   * Add the username typed to the list
   */
  addUsername() {
    this.usernamesList.push(this.username);
    this.username = "";
    console.log(this.usernamesList);
  }

}


text:
require 'spec_helper'

RSpec.describe PayjpMock::RequestBuilder do
  specify do
    builder = described_class.new(:xxxxx, :create, {}, {}, nil, nil)
    expect { builder.build }.to raise_error PayjpMock::RequestBuilder::UnknownResource
  end

  specify do
    builder = described_class.new(:charges, :xxxxx, {}, {}, :card_error, nil)
    expect { builder.build }.to raise_error PayjpMock::RequestBuilder::UnknownOperation
  end
end


text:
namespace remoting {

class DesktopSessionProxy;
class ScreenResolution;

class IpcScreenControls : public ScreenControls {
 public:
  explicit IpcScreenControls(
      scoped_refptr<DesktopSessionProxy> desktop_session_proxy);

  IpcScreenControls(const IpcScreenControls&) = delete;
  IpcScreenControls& operator=(const IpcScreenControls&) = delete;

  ~IpcScreenControls() override;

  // SessionController interface.
  void SetScreenResolution(const ScreenResolution& resolution) override;

 private:
  // Wraps the IPC channel to the desktop session agent.
  scoped_refptr<DesktopSessionProxy> desktop_session_proxy_;
};

}  // namespace remoting

#endif  // REMOTING_HOST_IPC_SCREEN_CONTROLS_H_


text: This is a project for self trainning of Swift. Attemp to program several games and tools.


text:
Programs used to solve Project Euler problems

Programs written primarily in Python but occasionally also in C used to solve problems appearing on Project Euler.
Each program will take the name of the problem it is trying to solve.


text:
Event handler javascript library

# Usage

## Object.create

```javascript
require(['events'], function (events) {
	var object = Object.create(events(), {
			emitter: {
				value: function () {
					this.emit('aEvent', arg1, arg2, arg3);
				}
			}
	});

	object.on('aEvent', function (argPredefined, arg1, arg2, arg3) {
		console.log(argPredefined, arg1, arg2, arg3);
	}, argPredefined);

	object.emitter();
});
```

## Old prototype

```javascript
require(['events'], function (events) {
	function Foo() {}
	Foo.prototype = events();
	Foo.prototype.emitter = function () {
		this.emit('aEvent', arg1, arg2, arg3);
	};
	var object = new Foo();
	object.on('aEvent', function (argPredefined, arg1, arg2, arg3) {
		console.log(argPredefined, arg1, arg2, arg3);
	}, argPredefined);

	object.emitter();
});
```


text:
package common

import (
	"errors"
	"fmt"
	"io/ioutil"
	"os"
	"os/exec"
	"path/filepath"
	"strings"

	"github.com/mitchellh/multistep"
)

// Fusion5Driver is a driver that can run VMware Fusion 5.
type Fusion5Driver struct {
	// This is the path to the "VMware Fusion.app"
	AppPath string

	// SSHConfig are the SSH settings for the Fusion VM
	SSHConfig *SSHConfig
}

func (d *Fusion5Driver) Clone(dst, src string) error {
	return errors.New("Cloning is not supported with Fusion 5. Please use Fusion 6+.")
}

func (d *Fusion5Driver) CompactDisk(diskPath string) error {
	defragCmd := exec.Command(d.vdiskManagerPath(), "-d", diskPath)
	if _, _, err := runAndLog(defragCmd); err != nil {
		return err
	}

	shrinkCmd := exec.Command(d.vdiskManagerPath(), "-k", diskPath)
	if _, _, err := runAndLog(shrinkCmd); err != nil {
		return err
	}

	return nil
}

func (d *Fusion5Driver) CreateDisk(output string, size string, type_id string) error {
	cmd := exec.Command(d.vdiskManagerPath(), "-c", "-s", size, "-a", "lsilogic", "-t", type_id, output)
	if _, _, err := runAndLog(cmd); err != nil {
		return err
	}

	return nil
}

func (d *Fusion5Driver) IsRunning(vmxPath string) (bool, error) {
	vmxPath, err := filepath.Abs(vmxPath)
	if err != nil {
		return false, err
	}

	cmd := exec.Command(d.vmrunPath(), "-T", "fusion", "list")
	stdout, _, err := runAndLog(cmd)
	if err != nil {
		return false, err
	}

	for _, line := range strings.Split(stdout, "\n") {
		if line == vmxPath {
			return true, nil
		}
	}

	return false, nil
}

func (d *Fusion5Driver) SSHAddress(state multistep.StateBag) (string, error) {
	return SSHAddressFunc(d.SSHConfig)(state)
}

func (d *Fusion5Driver) Start(vmxPath string, headless bool) error {
	guiArgument := "gui"
	if headless == true {
		guiArgument = "nogui"
	}

	cmd := exec.Command(d.vmrunPath(), "-T", "fusion", "start", vmxPath, guiArgument)
	if _, _, err := runAndLog(cmd); err != nil {
		return err
	}

	return nil
}

func (d *Fusion5Driver) Stop(vmxPath string) error {
	cmd := exec.Command(d.vmrunPath(), "-T", "fusion", "stop", vmxPath, "hard")
	if _, _, err := runAndLog(cmd); err != nil {
		// Check if the VM is running. If its not, it was already stopped
		running, rerr := d.IsRunning(vmxPath)
		if rerr == nil && !running {
			return nil
		}

		return err
	}

	return nil
}

func (d *Fusion5Driver) SuppressMessages(vmxPath string) error {
	dir := filepath.Dir(vmxPath)
	base := filepath.Base(vmxPath)
	base = strings.Replace(base, ".vmx", "", -1)

	plistPath := filepath.Join(dir, base+".plist")
	return ioutil.WriteFile(plistPath, []byte(fusionSuppressPlist), 0644)
}

func (d *Fusion5Driver) Verify() error {
	if _, err := os.Stat(d.AppPath); err != nil {
		if os.IsNotExist(err) {
			return fmt.Errorf("Fusion application not found at path: %s", d.AppPath)
		}

		return err
	}

	if _, err := os.Stat(d.vmrunPath()); err != nil {
		if os.IsNotExist(err) {
			return fmt.Errorf(
				"Critical application 'vmrun' not found at path: %s", d.vmrunPath())
		}

		return err
	}

	if _, err := os.Stat(d.vdiskManagerPath()); err != nil {
		if os.IsNotExist(err) {
			return fmt.Errorf(
				"Critical application vdisk manager not found at path: %s",
				d.vdiskManagerPath())
		}

		return err
	}

	return nil
}

func (d *Fusion5Driver) vdiskManagerPath() string {
	return filepath.Join(d.AppPath, "Contents", "Library", "vmware-vdiskmanager")
}

func (d *Fusion5Driver) vmrunPath() string {
	return filepath.Join(d.AppPath, "Contents", "Library", "vmrun")
}

func (d *Fusion5Driver) ToolsIsoPath(k string) string {
	return filepath.Join(d.AppPath, "Contents", "Library", "isoimages", k+".iso")
}

func (d *Fusion5Driver) ToolsInstall() error {
	return nil
}

func (d *Fusion5Driver) DhcpLeasesPath(device string) string {
	return "/var/db/vmware/vmnet-dhcpd-" + device + ".leases"
}

const fusionSuppressPlist = `<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>disallowUpgrade</key>
	<true/>
</dict>
</plist>`


text:
function exit() {
  process.exit();
}

function stop(e) {
  if (e) {
    console.log(e);
  }
  sc.stop().then(exit).catch(exit);
}

function run(sc, spark) {
  return new Promise(function(resolve, reject) {
    var similarities = sc.parallelize([
      new spark.Tuple3(spark.forceFloat(0.0), spark.forceFloat(1.0), 0.9),
      new spark.Tuple3(spark.forceFloat(1.0), spark.forceFloat(2.0), 0.9),
      new spark.Tuple3(spark.forceFloat(2.0), spark.forceFloat(3.0), 0.9),
      new spark.Tuple3(spark.forceFloat(3.0), spark.forceFloat(4.0), 0.1),
      new spark.Tuple3(spark.forceFloat(4.0), spark.forceFloat(5.0), 0.9)
    ]);

    var pic = new spark.mllib.clustering.PowerIterationClustering()
      .setK(2)
      .setMaxIterations(10);

    var model = pic.run(similarities);

    model.assignments().collect().then(resolve).catch(stop);
  });
}

if (global.SC) {
  // we are being run as part of a test
  module.exports = run;
} else {
  var eclairjs = require('eclairjs');
  var spark = new eclairjs();
  var sc =  new spark.SparkContext("local[*]", "Power Iteration Clustering");
  run(sc, spark).then(function(results) {
    console.log(results);
    stop();
  }).catch(stop);
}


text:
<?php

use Symfony\Component\HttpKernel\Kernel;
use Symfony\Component\Config\Loader\LoaderInterface;

class InstallKernel extends Kernel
{
    public function registerBundles()
    {
        $bundles = array(
            new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
            new Symfony\Bundle\SecurityBundle\SecurityBundle(),
            new Symfony\Bundle\TwigBundle\TwigBundle(),
            new Symfony\Bundle\MonologBundle\MonologBundle(),
            new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(),
            new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
            new Install\Install(),
        );

        if (in_array($this->getEnvironment(), array('dev', 'test'), true)) {
            $bundles[] = new Symfony\Bundle\DebugBundle\DebugBundle();
            $bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();
            $bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle();
            $bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle();
        }

        return $bundles;
    }

    public function registerContainerConfiguration(LoaderInterface $loader)
    {
        $loader->load(__DIR__ .'/config/config_'.$this->getEnvironment().'.yml');
    }

    public function getCharset() {
        return 'UTF-8';
    }

    public function getName() {
        return 'install';
    }

    public function getLogDir() {
        return __DIR__ . '/logs/' . $this->getEnvironment() . '.log';
    }

    public function getCacheDir() {
        return __DIR__ . '/cache/' . $this->getEnvironment();
    }

    public function getRootDir()
    {
        return realpath(__DIR__);
    }
}


text:
<!DOCTYPE html>

<TITLE>Manpage of VERIFY_BLKPARSE</TITLE>
<meta charset="utf-8">
<link rel="stylesheet" href="/css/main.css" type="text/css">

linux manpages

{"type":"documentation"}

VERIFY_BLKPARSE

Section:  (1)
Updated: March  6, 2007
Index
Return to Main Contents

NAME

verify_blkparse - verifies an output file produced by blkparse

SYNOPSIS

verify_blkparse <filename>

DESCRIPTION

Verifies an output file from blkparse. All it does is check if the events in
the file are correctly time ordered. If an entry is found that isn't ordered,
it's dumped to stdout.

AUTHORS

blkparse was written by Jens Axboe, Alan D. Brunelle and Nathan Scott.  This
man page was created from the blktrace documentation by Bas Zoetekouw.

REPORTING BUGS

Report bugs to <linux-btrace@vger.kernel.org>

COPYRIGHT

Copyright © 2006 Jens Axboe, Alan D. Brunelle and Nathan Scott.

This is free software.  You may redistribute copies of it under the terms of
the GNU General Public License <http://www.gnu.org/licenses/gpl.html>.
There is NO WARRANTY, to the extent permitted by law.

This manual page was created for Debian by Bas Zoetekouw.  It was derived from
the documentation provided by the authors and it may be used, distributed and
modified under the terms of the GNU General Public License, version 2.

On Debian systems, the text of the GNU General Public License can be found in
/usr/share/common-licenses/GPL-2.

SEE ALSO

btrace (8), blktrace (8), blkparse (1), blkrawverify (1), btt (1)

Index

NAME

SYNOPSIS

DESCRIPTION

AUTHORS

REPORTING BUGS

COPYRIGHT

SEE ALSO

This document was created by
man2html,
using the manual pages.

Time: 05:29:12 GMT, December 24, 2015


text:
package org.apache.orc;

import java.util.List;

import org.apache.orc.CompressionKind;
import org.apache.orc.OrcProto;
import org.apache.orc.StripeInformation;

/**
 * Cached file metadata. Right now, it caches everything; we don't have to store all the
 * protobuf structs actually, we could just store what we need, but that would require that
 * ORC stop depending on them too. Luckily, they shouldn't be very big.
 */
public interface FileMetadata {
  boolean isOriginalFormat();

  List<StripeInformation> getStripes();

  CompressionKind getCompressionKind();

  int getCompressionBufferSize();

  int getRowIndexStride();

  int getColumnCount();

  int getFlattenedColumnCount();

  Object getFileKey();

  List<Integer> getVersionList();

  int getMetadataSize();

  int getWriterVersionNum();

  List<OrcProto.Type> getTypes();

  List<OrcProto.StripeStatistics> getStripeStats();

  long getContentLength();

  long getNumberOfRows();

  List<OrcProto.ColumnStatistics> getFileStats();
}


text:
namespace sensor_msgs
{
template <class ContainerAllocator>
struct PointField_
{
  typedef PointField_<ContainerAllocator> Type;

  PointField_()
    : name()
    , offset(0)
    , datatype(0)
    , count(0)  {
    }
  PointField_(const ContainerAllocator& _alloc)
    : name(_alloc)
    , offset(0)
    , datatype(0)
    , count(0)  {
  (void)_alloc;
    }

   typedef std::basic_string<char, std::char_traits<char>, typename ContainerAllocator::template rebind<char>::other >  _name_type;
  _name_type name;

   typedef uint32_t _offset_type;
  _offset_type offset;

   typedef uint8_t _datatype_type;
  _datatype_type datatype;

   typedef uint32_t _count_type;
  _count_type count;

    enum { INT8 = 1u };
     enum { UINT8 = 2u };
     enum { INT16 = 3u };
     enum { UINT16 = 4u };
     enum { INT32 = 5u };
     enum { UINT32 = 6u };
     enum { FLOAT32 = 7u };
     enum { FLOAT64 = 8u };

  typedef boost::shared_ptr< ::sensor_msgs::PointField_<ContainerAllocator> > Ptr;
  typedef boost::shared_ptr< ::sensor_msgs::PointField_<ContainerAllocator> const> ConstPtr;

}; // struct PointField_

typedef ::sensor_msgs::PointField_<std::allocator<void> > PointField;

typedef boost::shared_ptr< ::sensor_msgs::PointField > PointFieldPtr;
typedef boost::shared_ptr< ::sensor_msgs::PointField const> PointFieldConstPtr;

// constants requiring out of line definition

template<typename ContainerAllocator>
std::ostream& operator<<(std::ostream& s, const ::sensor_msgs::PointField_<ContainerAllocator> & v)
{
rs2rosinternal::message_operations::Printer< ::sensor_msgs::PointField_<ContainerAllocator> >::stream(s, "", v);
return s;
}

} // namespace sensor_msgs

namespace rs2rosinternal
{
namespace message_traits
{

// BOOLTRAITS {'IsFixedSize': False, 'IsMessage': True, 'HasHeader': False}
// {'std_msgs': ['/opt/ros/kinetic/share/std_msgs/cmake/../msg'], 'geometry_msgs': ['/opt/ros/kinetic/share/geometry_msgs/cmake/../msg'], 'sensor_msgs': ['/tmp/binarydeb/ros-kinetic-sensor-msgs-1.12.5/msg']}

// !!!!!!!!!!! ['__class__', '__delattr__', '__dict__', '__doc__', '__eq__', '__format__', '__getattribute__', '__hash__', '__init__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', '_parsed_fields', 'constants', 'fields', 'full_name', 'has_header', 'header_present', 'names', 'package', 'parsed_fields', 'short_name', 'text', 'types']

template <class ContainerAllocator>
struct IsFixedSize< ::sensor_msgs::PointField_<ContainerAllocator> >
  : FalseType
  { };

template <class ContainerAllocator>
struct IsFixedSize< ::sensor_msgs::PointField_<ContainerAllocator> const>
  : FalseType
  { };

template <class ContainerAllocator>
struct IsMessage< ::sensor_msgs::PointField_<ContainerAllocator> >
  : TrueType
  { };

template <class ContainerAllocator>
struct IsMessage< ::sensor_msgs::PointField_<ContainerAllocator> const>
  : TrueType
  { };

template <class ContainerAllocator>
struct HasHeader< ::sensor_msgs::PointField_<ContainerAllocator> >
  : FalseType
  { };

template <class ContainerAllocator>
struct HasHeader< ::sensor_msgs::PointField_<ContainerAllocator> const>
  : FalseType
  { };

template<class ContainerAllocator>
struct MD5Sum< ::sensor_msgs::PointField_<ContainerAllocator> >
{
  static const char* value()
  {
    return "268eacb2962780ceac86cbd17e328150";
  }

  static const char* value(const ::sensor_msgs::PointField_<ContainerAllocator>&) { return value(); }
  static const uint64_t static_value1 = 0x268eacb2962780ceULL;
  static const uint64_t static_value2 = 0xac86cbd17e328150ULL;
};

template<class ContainerAllocator>
struct DataType< ::sensor_msgs::PointField_<ContainerAllocator> >
{
  static const char* value()
  {
    return "sensor_msgs/PointField";
  }

  static const char* value(const ::sensor_msgs::PointField_<ContainerAllocator>&) { return value(); }
};

template<class ContainerAllocator>
struct Definition< ::sensor_msgs::PointField_<ContainerAllocator> >
{
  static const char* value()
  {
    return "# This message holds the description of one point entry in the\n\
# PointCloud2 message format.\n\
uint8 INT8    = 1\n\
uint8 UINT8   = 2\n\
uint8 INT16   = 3\n\
uint8 UINT16  = 4\n\
uint8 INT32   = 5\n\
uint8 UINT32  = 6\n\
uint8 FLOAT32 = 7\n\
uint8 FLOAT64 = 8\n\
\n\
string name      # Name of field\n\
uint32 offset    # Offset from start of point struct\n\
uint8  datatype  # Datatype enumeration, see above\n\
uint32 count     # How many elements in the field\n\
";
  }

  static const char* value(const ::sensor_msgs::PointField_<ContainerAllocator>&) { return value(); }
};

} // namespace message_traits
} // namespace rs2rosinternal

namespace rs2rosinternal
{
namespace serialization
{

  template<class ContainerAllocator> struct Serializer< ::sensor_msgs::PointField_<ContainerAllocator> >
  {
    template<typename Stream, typename T> inline static void allInOne(Stream& stream, T m)
    {
      stream.next(m.name);
      stream.next(m.offset);
      stream.next(m.datatype);
      stream.next(m.count);
    }

    ROS_DECLARE_ALLINONE_SERIALIZER
  }; // struct PointField_

} // namespace serialization
} // namespace rs2rosinternal

namespace rs2rosinternal
{
namespace message_operations
{

template<class ContainerAllocator>
struct Printer< ::sensor_msgs::PointField_<ContainerAllocator> >
{
  template<typename Stream> static void stream(Stream& s, const std::string& indent, const ::sensor_msgs::PointField_<ContainerAllocator>& v)
  {
    s << indent << "name: ";
    Printer<std::basic_string<char, std::char_traits<char>, typename ContainerAllocator::template rebind<char>::other > >::stream(s, indent + "  ", v.name);
    s << indent << "offset: ";
    Printer<uint32_t>::stream(s, indent + "  ", v.offset);
    s << indent << "datatype: ";
    Printer<uint8_t>::stream(s, indent + "  ", v.datatype);
    s << indent << "count: ";
    Printer<uint32_t>::stream(s, indent + "  ", v.count);
  }
};

} // namespace message_operations
} // namespace rs2rosinternal

#endif // SENSOR_MSGS_MESSAGE_POINTFIELD_H


text:
package tarpath

import (
	"archive/tar"
	"compress/gzip"
	"fmt"
	"io"
	"os"
	"strings"
)

type PrefixDetector struct{}

//go:generate go run github.com/maxbrunsfeld/counterfeiter/v6 . Detector

type Detector interface {
	Detect(tgz string, path string) (bool, error)
}

func NewPrefixDetector() *PrefixDetector {
	return &PrefixDetector{}
}

func (n *PrefixDetector) Detect(tgz string, path string) (bool, error) {
	f, err := os.Open(tgz)
	if err != nil {
		return false, err
	}
	defer f.Close()

	gr, err := gzip.NewReader(f)
	if err != nil {
		return false, err
	}
	defer gr.Close()

	tr := tar.NewReader(gr)

	for {
		header, err := tr.Next()
		if err == io.EOF {
			break
		}
		if err != nil {
			return false, err
		}

		if strings.HasPrefix(header.Name, "./"+path+"/") {
			return true, nil
		}

		if strings.HasPrefix(header.Name, path+"/") {
			return false, nil
		}
	}

	return false, fmt.Errorf("no file with prefix '%s' found", path)
}


text:
@import WebKit;

@class MWKArticle, MWLanguageInfo;

@interface WKWebView (WMFWebViewControllerJavascript)

- (void)wmf_setTextSize:(NSInteger)textSize;

- (void)wmf_scrollToFragment:(NSString *)fragment;

- (void)wmf_accessibilityCursorToFragment:(NSString *)fragment;

- (void)wmf_highlightLinkID:(NSString *)linkID;

- (void)wmf_unHighlightLinkID:(NSString *)linkID;

/**
 * Currently-selected text in the webview, if there is any.
 * @return The selection if it's longer than `kMinimumTextSelectionLength`, otherwise an empty string.
 */
- (void)wmf_getSelectedText:(void (^)(NSString *text))completion;

@end


text:
from django.test import TestCase
from django.core.management import call_command

from pricing.models import AWS
from pricing.models import GCP

import os
import tempfile
import shutil

# Tests for management 'scrape' and 'ingest' commands
class ScrapeTest(TestCase):

    tmpdir = None

    def setUp(self):
        self.tmpdir = tempfile.mkdtemp()

    def tearDown(self):
        shutil.rmtree(self.tmpdir)

    # Try Scraping from AWS
    def test_aws(self):
        # scrape AWS
        call_command('scrape', '--aws', self.tmpdir)

        # Ensure META file was created
        self.assertTrue(os.path.isfile('%s/META' % self.tmpdir))

        # ingest
        call_command('ingest', self.tmpdir)

        # Ensure something was created
        self.assertNotEqual(AWS.objects.count(), 0)

        # ensure we have some prices
        self.assertNotEqual(AWS.objects.filter(price_per_unit__gt=0).count(),
                            0)

    # Try Scraping from Google
    def test_gcp(self):

        # scrape from Google
        call_command('scrape', '--gcp', self.tmpdir)

        # ensure META file was created
        self.assertTrue(os.path.isfile('%s/META' % self.tmpdir))

        # Ingest it
        call_command('ingest', self.tmpdir)
        self.assertNotEqual(GCP.objects.count(), 0)

        # make sure we have some non-zero prices.
        self.assertNotEqual(GCP.objects.filter(us__gt=0).count(), 0)
        self.assertNotEqual(GCP.objects.filter(asia__gt=0).count(), 0)
        self.assertNotEqual(GCP.objects.filter(europe__gt=0).count(), 0)