text:
WebTestTtsPlatform* WebTestTtsPlatform::GetInstance() {
  return base::Singleton<WebTestTtsPlatform>::get();
}

bool WebTestTtsPlatform::PlatformImplSupported() {
  return true;
}

bool WebTestTtsPlatform::PlatformImplInitialized() {
  return true;
}

void WebTestTtsPlatform::LoadBuiltInTtsEngine(
    content::BrowserContext* browser_context) {}

void WebTestTtsPlatform::Speak(
    int utterance_id,
    const std::string& utterance,
    const std::string& lang,
    const content::VoiceData& voice,
    const content::UtteranceContinuousParameters& params,
    base::OnceCallback<void(bool)> on_speak_finished) {
  std::move(on_speak_finished).Run(true);
  content::TtsController* controller = content::TtsController::GetInstance();
  int len = static_cast<int>(utterance.size());
  controller->OnTtsEvent(utterance_id, content::TTS_EVENT_START, 0, len,
                         std::string());
  controller->OnTtsEvent(utterance_id, content::TTS_EVENT_END, len, 0,
                         std::string());
}

bool WebTestTtsPlatform::StopSpeaking() {
  return true;
}

bool WebTestTtsPlatform::IsSpeaking() {
  return false;
}

void WebTestTtsPlatform::GetVoices(
    std::vector<content::VoiceData>* out_voices) {}

void WebTestTtsPlatform::Pause() {}

void WebTestTtsPlatform::Resume() {}

void WebTestTtsPlatform::WillSpeakUtteranceWithVoice(
    content::TtsUtterance* utterance,
    const content::VoiceData& voice_data) {}

std::string WebTestTtsPlatform::GetError() {
  return {};
}

void WebTestTtsPlatform::ClearError() {}

void WebTestTtsPlatform::SetError(const std::string& error) {}

void WebTestTtsPlatform::Shutdown() {}

void WebTestTtsPlatform::FinalizeVoiceOrdering(
    std::vector<content::VoiceData>& voices) {}

void WebTestTtsPlatform::GetVoicesForBrowserContext(
    content::BrowserContext* browser_context,
    const GURL& source_url,
    std::vector<content::VoiceData>* out_voices) {}

void WebTestTtsPlatform::RefreshVoices() {}

WebTestTtsPlatform::WebTestTtsPlatform() = default;

WebTestTtsPlatform::~WebTestTtsPlatform() = default;


text:
        Home

            search

            <input class="mdl-textfield__input" type="text" id="search">
            Enter your query...

        <button class="mdl-button mdl-js-button mdl-js-ripple-effect mdl-button--icon" id="hdrbtn">
          more_vert
        </button>

About

Contact

Legal information

        <img src="<?= base_url().'mdl/' ?>images/user.jpg" class="demo-avatar">

          <?= $this->session->userdata('username'); ?>

        <a class="mdl-navigation__link" href="<?= base_url('admin/halaman-utama') ?>">
          home
          Dahsboard

        <a class="mdl-navigation__link" href="<?= base_url('admin/barang') ?>">
          list
          Barang

        <a class="mdl-navigation__link" href="<?= base_url('admin/kategori') ?>">
          label
          Kategori

          featured_play_list
          Konten

          forum
          Testimoni

        <a class="mdl-navigation__link" href="<?= base_url('admin/user') ?>">
          group
          Admin

        <a class="mdl-navigation__link" href="<?= base_url('Administrator/logout') ?>">
          exit_to_app
          Keluar

Updates

              Non dolore elit adipisicing ea reprehenderit consectetur culpa.

              Read More

Updates

              Non dolore elit adipisicing ea reprehenderit consectetur culpa.

              Read More

Updates

              Non dolore elit adipisicing ea reprehenderit consectetur culpa.

              Read More

redpajama_set_name: RedPajamaGithub


text:
<?php
class PhpFile {

    public $path        = null;
    public $contents    = null;

    public function __construct( $path ) {
        $this->path = $path;
    }

    public function getPath() {
        return $this->path;
    }

    public function load() {
        if ( $this->exists() ) {
            $this->contents = file_get_contents( $this->getPath() );
        }
    }

    public function getContents() {
        if ( !$this->contents ) $this->load();
        return $this->contents;
    }

    public function exists() {
        return file_exists( $this->getPath() );
    }

    /**
     * Gets a constant's value
     *
     * @param string  - The constant's name
     * @return mixed; the value, or false if not found.
     */
    public function getConstant( $name ) {
        preg_match( "!define\('" . $name . "',[^']*'(.+?)'\);!", $this->getContents(), $matches );
        return ( isset( $matches[1] ) ) ? $matches[1] : false;
    }

    /**
     * Gets variable's value
     *
     * @param string  - The variables's name (without the dollar sign)
     * @return mixed; the value, or false if not found.
     */
    public function getVariable( $name ) {
        preg_match( "!\\\$" . $name . "[^=]*=[^']*'(.+?)';!", $this->getContents(), $matches );
        return ( isset( $matches[1] ) ) ? $matches[1] : false;
    }

    public static function readFromRelativePath( $relative_path ) {
        $search_paths = explode( PATH_SEPARATOR, get_include_path() );
        $parts        = explode( DIRECTORY_SEPARATOR, dirname( __FILE__ ) );
        while ( count( $parts ) > 0 ) {
            $search_paths[] = implode( DIRECTORY_SEPARATOR, $parts );
            array_pop( $parts );
        }
        $search_paths = array_filter( $search_paths, 'strlen' );

        $file = null;
        foreach ( $search_paths as $path ) {
            $full_path = $path . DIRECTORY_SEPARATOR .  $relative_path;
            if ( file_exists( $full_path ) ) {
                $file = realpath( $full_path );
                break;
            }
        }
        return $file ? new PhpFile( $file ) : false;
    }
}


text: <link rel="stylesheet" href="../../js/resources/js-test-style.css">


text:
#include "apue.h"

static void	sig_quit(int);

int
main(void)
{
	sigset_t	newmask, oldmask, pendmask;

	if (signal(SIGQUIT, sig_quit) == SIG_ERR)
		err_sys("can't catch SIGQUIT");

	/*
	 * Block SIGQUIT and save current signal mask.
	 */
	sigemptyset(&newmask);
	sigaddset(&newmask, SIGQUIT);
	if (sigprocmask(SIG_BLOCK, &newmask, &oldmask) < 0)
		err_sys("SIG_BLOCK error");

	sleep(5);	/* SIGQUIT here will remain pending */

	if (sigpending(&pendmask) < 0)
		err_sys("sigpending error");
	if (sigismember(&pendmask, SIGQUIT))
		printf("\nSIGQUIT pending\n");

	/*
	 * Restore signal mask which unblocks SIGQUIT.
	 */
	if (sigprocmask(SIG_SETMASK, &oldmask, NULL) < 0)
		err_sys("SIG_SETMASK error");
	printf("SIGQUIT unblocked\n");

	sleep(5);	/* SIGQUIT here will terminate with core file */
	exit(0);
}

static void
sig_quit(int signo)
{
	printf("caught SIGQUIT\n");
	if (signal(SIGQUIT, SIG_DFL) == SIG_ERR)
		err_sys("can't reset SIGQUIT");
}


text:
var wacom = document.getElementById('wtPlugin');	//the wacom tablet web plugin

var tool = new propertiesdata();
function propertiesdata() {
	this.state = "";
	this.size = 10;
	this.opacity = 100;
	this.hardness = 100;
	this.levels = 1;

	this.dither = {x:0,y:0};

	this.pressure = 1;
	this.tilt = {x:0,y:0,amount:0};
	this.pen = {s:"none",o:"none",h:"none",l:"none"};

	this.brushing = false;	//if true, we're actively drawing with the brush tool (need to know so we can clear the brushcanvas on mouseup)
	this.zoom = 2;
	this.offset = {x:0,y:0};
	this.secondary_zoom = 2;
	this.secondary_offset = {x:0,y:0};
	this.spacebar = false;
	this.preventdraw = false;
	this.zoomstop = false;

	this.brushstart = {x:0,y:0};
	this.brushend = {x:0,y:0};
	this.brushendup = {x:0,y:0};

	this.edge = [];	//list of points representing the edge of the tool cursor thing

	this.lockcolordex = false;
	this.bg = (typeof(Storage) !== "undefined" && typeof(localStorage.bg) !== "undefined" ? localStorage.bg : '#111111' );
	this.view = (typeof(Storage) !== "undefined" && typeof(localStorage.view) !== "undefined" ? localStorage.view : 0 );
	this.sheet = {x:1, y:1, current:0, ox:0, oy:0, list:[] };
	this.secondary_view = (typeof(Storage) !== "undefined" && typeof(localStorage.secondary_view) !== "undefined" ? localStorage.secondary_view : 0 );
	this.secondary_sheet = {x:1, y:1, current:0, ox:0, oy:0, list:[] };

	this.current_preset = 1;
	this.preset = (typeof(Storage) !== "undefined" && checkJSON('brushpreset')!=null ? JSON.parse(localStorage.brushpreset) : [
	{size:10,opacity:255,hardness:20,levels:10,pen:{s:'none',o:'none',h:'none',l:'none'}},
	{size:0.5,opacity:255,hardness:20,levels:1,pen:{s:'none',o:'none',h:'none',l:'none'}},
	{size:5,opacity:255,hardness:20,levels:10,pen:{s:'none',o:'none',h:'none',l:'none'}},
	{size:10,opacity:255,hardness:20,levels:10,pen:{s:'none',o:'none',h:'none',l:'none'}},
	{size:10,opacity:255,hardness:1,levels:4,pen:{s:'none',o:'none',h:'none',l:'none'}},
	{size:10,opacity:255,hardness:1,levels:6,pen:{s:'none',o:'none',h:'none',l:'none'}},
	{size:10,opacity:255,hardness:10,levels:10,pen:{s:'none',o:'none',h:'none',l:'none'}},
	{size:10,opacity:255,hardness:20,levels:10,pen:{s:'none',o:'none',h:'none',l:'none'}},
	{size:10,opacity:255,hardness:20,levels:10,pen:{s:'none',o:'none',h:'none',l:'none'}},
	{size:10,opacity:255,hardness:20,levels:10,pen:{s:'none',o:'none',h:'none',l:'none'}}
	]);	//array of brush presets

	this.colorscan;
}

function updatePen(){
	if(typeof wacom == 'undefined'){}
	else{
		if(wacom.penAPI){
			var refresh = false;
			if(wacom.penAPI.pressure > 0 && wacom.penAPI.pressure != tool.pressure && wacom.penAPI.pointerType==1){
				tool.pressure = wacom.penAPI.pressure;
				refresh = true;
			}

			if(wacom.penAPI.tiltX != tool.tilt.x && wacom.penAPI.tiltY != tool.tilt.y && wacom.penAPI.pointerType==1){
				tool.tilt.x = wacom.penAPI.tiltX;
				tool.tilt.y = wacom.penAPI.tiltY;
				tool.tilt.amount = Math.sqrt( (tool.tilt.x * tool.tilt.x) + (tool.tilt.y * tool.tilt.y) );
				refresh = true;
				//console.log(tool.tilt.x+","+tool.tilt.y+","+tool.tilt.amount);
			}

			if(refresh) refreshTool(tool);
		}
	}
}

function resetPen(){
	var refresh = false;

	if(tool.pressure < 1){
		tool.pressure = 1;
		refresh = true;
	}
	if(tool.tilt.amount > 0 ){
		tool.tilt.amount = 0;
		refresh = true;
	}

	if(refresh) refreshTool(tool);
}

function refreshTool(t){
	//toolcontext.clearRect(0, 0, toolcanvas.width, toolcanvas.height);

	var save = {s:t.size,o:t.opacity,h:t.hardness,l:t.levels};
	t.size = (Math.round((t.size*( t.pen.s=="pressure"?t.pressure:1))* 2) / 2).toFixed(1);//(t.pen.s=="tilt"?t.tilt.amount:1) ) ) * 2) / 2).toFixed(1);	//make sure it rounds to nearest 0.5;
	t.opacity = (t.opacity*( t.pen.o=="pressure"?t.pressure:1));//(t.pen.o=="tilt"?t.tilt.amount:1) ) );
	t.hardness = (t.hardness*( t.pen.h=="pressure"?t.pressure:1));//(t.pen.h=="tilt"?t.tilt.amount:1) ) );
	t.levels = (t.levels*( t.pen.l=="pressure"?t.pressure:1));//(t.pen.l=="tilt"?t.tilt.amount:1) ) );
	//console.log(saveSize+","+t.pressure+","+t.size);
	if(t.size==0)t.size=0.5;

	if(typeof toolcontext === 'undefined'){
	}else{
		var odd = ( (t.size*2) % 2 == 1 ? 1 : 0 );
		toolcanvas.width = (t.size*2)+4+odd;	//if odd number, add 1 to the width/height so that the brushline function deals with stuff accurately
		toolcanvas.height = (t.size*2)+4+odd;
		toolcontext = reload_canvas(toolcanvas, toolcontext);

		$("#toolcanvas").css({
			'margin-left':-t.size,
			'margin-top':-t.size
		});

		var centerX = (toolcanvas.width / 2)+0.5-(t.size==0.5?0.5:0);
		var centerY = (toolcanvas.height / 2)+0.5-(t.size==0.5?0.5:0);

		var color = 'rgba(0,0,0,'+(t.opacity/255)+')';
		var hardness = t.size*(t.hardness/20);
		/*var grd=toolcontext.createRadialGradient(centerX,centerY,hardness,centerX,centerY,t.size);
		grd.addColorStop(0,color );
		grd.addColorStop(1,'rgba(0,0,0,0)');

		toolcontext.beginPath();
		toolcontext.arc(centerX+(t.size==0.5 ? 0.5 : 0), centerY+(t.size==0.5 ? 0.5 : 0), t.size, 0, 2 * Math.PI, false);
		toolcontext.fillStyle = (hardness<t.size ? grd : color );
		toolcontext.fill();
		toolcontext.closePath();
		*/
		var radius = t.size * t.size;
		var hardradius = hardness * hardness;
		var imgData=toolcontext.getImageData(0, 0, toolcanvas.width, toolcanvas.height);
		for(var y=0; y<toolcanvas.height; y++){
			for(var x=0; x<toolcanvas.width; x++){
				var dx = x - centerX;
				var dy = y - centerY;
				var distance = dx * dx + dy * dy;

				var alpha = (distance-hardradius)/(radius-hardradius);
				if (distance <= radius && distance > hardradius){
					imgData.data[(((y*toolcanvas.width)+x)*4)+3] = t.opacity-((Math.round(alpha*t.levels) / t.levels ) *t.opacity);
				}
				if(distance<=hardradius){
					imgData.data[(((y*toolcanvas.width)+x)*4)+3] = t.opacity;
				}
				//if(x==centerX && y==centerY){
				//	imgData.data[(((y*toolcanvas.width)+x)*4)+3] = t.opacity;
				//}
			}
		}
		//for (var i=0;i<imgData.data.length;i+=4)
		//{
			/*imgData.data[i]= rgb[0] | imgData.data[i];
			imgData.data[i+1]= rgb[1] | imgData.data[i+1];
			imgData.data[i+2]= rgb[2] | imgData.data[i+2];*/
			//imgData.data[i+3]= ((Math.round( (imgData.data[i+3]/t.opacity) * t.levels ) / t.levels)*t.opacity);// | imgData.data[i+3];
		//}
		toolcontext.clearRect(0, 0, toolcanvas.width, toolcanvas.height);
		toolcontext.putImageData(imgData,0,0);

		//trace the edge of the tool and get the points so we can draw an outline representing where out tool is located on the canvas
		traceToolEdge(imgData);
	}

	t.size = save.s;
	t.opacity = save.o;
	t.hardness = save.h;
	t.levels = save.l;

}

function traceToolEdge(imgData){
	tool.edge = [];
	var sx,sy;
	//find starting point
	for(var y=0; y<toolcanvas.height; y++){
		for(var x=0; x<toolcanvas.width; x++){
			if(imgData.data[((((y+1)*toolcanvas.width)+x+1)*4)+3] > 0){
				sx=x , sy=y;
				x=toolcanvas.width, y=toolcanvas.height;	//breaks both loops
			}
		}
	}
	if(sx!=null && sy!=null){
		while($.grep(tool.edge, function (e) { return e.x == sx+1 && e.y == sy+1;}).length==0){
			tool.edge.push({x:sx+1,y:sy+1} );
			//check which way to go
			if( imgData.data[((((sy)*toolcanvas.width)+sx)*4)+3] == 0 &&
				imgData.data[((((sy)*toolcanvas.width)+sx+1)*4)+3] == 0 &&
				imgData.data[((((sy+1)*toolcanvas.width)+sx)*4)+3] == 0 &&
				imgData.data[((((sy+1)*toolcanvas.width)+sx+1)*4)+3] == 0 ) sx+=1;
			else if(imgData.data[((((sy)*toolcanvas.width)+sx)*4)+3] == 0 &&
					imgData.data[((((sy)*toolcanvas.width)+sx+1)*4)+3] > 0 &&
					imgData.data[((((sy+1)*toolcanvas.width)+sx)*4)+3] == 0 &&
					imgData.data[((((sy+1)*toolcanvas.width)+sx+1)*4)+3] == 0 ) sx+=1;
			else if(imgData.data[((((sy)*toolcanvas.width)+sx)*4)+3] == 0 &&
					imgData.data[((((sy)*toolcanvas.width)+sx+1)*4)+3] > 0 &&
					imgData.data[((((sy+1)*toolcanvas.width)+sx)*4)+3] == 0 &&
					imgData.data[((((sy+1)*toolcanvas.width)+sx+1)*4)+3] > 0 ) sy+=1;
			else if(imgData.data[((((sy)*toolcanvas.width)+sx)*4)+3] == 0 &&
					imgData.data[((((sy)*toolcanvas.width)+sx+1)*4)+3] == 0 &&
					imgData.data[((((sy+1)*toolcanvas.width)+sx)*4)+3] == 0 &&
					imgData.data[((((sy+1)*toolcanvas.width)+sx+1)*4)+3] > 0 ) sy+=1;
			else if(imgData.data[((((sy)*toolcanvas.width)+sx)*4)+3] > 0 &&
					imgData.data[((((sy)*toolcanvas.width)+sx+1)*4)+3] > 0 &&
					imgData.data[((((sy+1)*toolcanvas.width)+sx)*4)+3] == 0 &&
					imgData.data[((((sy+1)*toolcanvas.width)+sx+1)*4)+3] == 0 ) sx+=1;
			else if(imgData.data[((((sy)*toolcanvas.width)+sx)*4)+3] > 0 &&
					imgData.data[((((sy)*toolcanvas.width)+sx+1)*4)+3] == 0 &&
					imgData.data[((((sy+1)*toolcanvas.width)+sx)*4)+3] == 0 &&
					imgData.data[((((sy+1)*toolcanvas.width)+sx+1)*4)+3] == 0 ) sy-=1;
			else if(imgData.data[((((sy)*toolcanvas.width)+sx)*4)+3] > 0 &&
					imgData.data[((((sy)*toolcanvas.width)+sx+1)*4)+3] == 0 &&
					imgData.data[((((sy+1)*toolcanvas.width)+sx)*4)+3] > 0 &&
					imgData.data[((((sy+1)*toolcanvas.width)+sx+1)*4)+3] == 0 ) sy-=1;
			else if(imgData.data[((((sy)*toolcanvas.width)+sx)*4)+3] == 0 &&
					imgData.data[((((sy)*toolcanvas.width)+sx+1)*4)+3] == 0 &&
					imgData.data[((((sy+1)*toolcanvas.width)+sx)*4)+3] > 0 &&
					imgData.data[((((sy+1)*toolcanvas.width)+sx+1)*4)+3] == 0 ) sx-=1;
			else if(imgData.data[((((sy)*toolcanvas.width)+sx)*4)+3] == 0 &&
					imgData.data[((((sy)*toolcanvas.width)+sx+1)*4)+3] == 0 &&
					imgData.data[((((sy+1)*toolcanvas.width)+sx)*4)+3] > 0 &&
					imgData.data[((((sy+1)*toolcanvas.width)+sx+1)*4)+3] > 0 ) sx-=1;
			else if(imgData.data[((((sy)*toolcanvas.width)+sx)*4)+3] > 0 &&
					imgData.data[((((sy)*toolcanvas.width)+sx+1)*4)+3] == 0 &&
					imgData.data[((((sy+1)*toolcanvas.width)+sx)*4)+3] > 0 &&
					imgData.data[((((sy+1)*toolcanvas.width)+sx+1)*4)+3] > 0 ) sy-=1;
			else if(imgData.data[((((sy)*toolcanvas.width)+sx)*4)+3] == 0 &&
					imgData.data[((((sy)*toolcanvas.width)+sx+1)*4)+3] > 0 &&
					imgData.data[((((sy+1)*toolcanvas.width)+sx)*4)+3] > 0 &&
					imgData.data[((((sy+1)*toolcanvas.width)+sx+1)*4)+3] > 0 ) sx-=1;
			else if(imgData.data[((((sy)*toolcanvas.width)+sx)*4)+3] > 0 &&
					imgData.data[((((sy)*toolcanvas.width)+sx+1)*4)+3] > 0 &&
					imgData.data[((((sy+1)*toolcanvas.width)+sx)*4)+3] == 0 &&
					imgData.data[((((sy+1)*toolcanvas.width)+sx+1)*4)+3] > 0 ) sy+=1;
			else if(imgData.data[((((sy)*toolcanvas.width)+sx)*4)+3] > 0 &&
					imgData.data[((((sy)*toolcanvas.width)+sx+1)*4)+3] > 0 &&
					imgData.data[((((sy+1)*toolcanvas.width)+sx)*4)+3] > 0 &&
					imgData.data[((((sy+1)*toolcanvas.width)+sx+1)*4)+3] == 0 ) sx+=1;
			else if(imgData.data[((((sy)*toolcanvas.width)+sx)*4)+3] > 0 &&
					imgData.data[((((sy)*toolcanvas.width)+sx+1)*4)+3] == 0 &&
					imgData.data[((((sy+1)*toolcanvas.width)+sx)*4)+3] == 0 &&
					imgData.data[((((sy+1)*toolcanvas.width)+sx+1)*4)+3] > 0 ) sy-=1;
			else if(imgData.data[((((sy)*toolcanvas.width)+sx)*4)+3] == 0 &&
					imgData.data[((((sy)*toolcanvas.width)+sx+1)*4)+3] > 0 &&
					imgData.data[((((sy+1)*toolcanvas.width)+sx)*4)+3] > 0 &&
					imgData.data[((((sy+1)*toolcanvas.width)+sx+1)*4)+3] == 0 ) sx-=1;
			else if(imgData.data[((((sy)*toolcanvas.width)+sx)*4)+3] > 0 &&
					imgData.data[((((sy)*toolcanvas.width)+sx+1)*4)+3] > 0 &&
					imgData.data[((((sy+1)*toolcanvas.width)+sx)*4)+3] > 0 &&
					imgData.data[((((sy+1)*toolcanvas.width)+sx+1)*4)+3] > 0 ) return;
		}
	}
}

//this is a working floodfill
function floodFill(ctx, point, COLOR, contiguous, peerid)	//vals is imgdata, point is start point, seedcolor is color we're grouping, color is new color?
{

	var peerhistory;
	if(peerid!="palette")peerhistory = $.grep(historylist, function(e){ return e.id == peerid; });

	var selection = false;
	var maskData;
	if(peerhistory[0].selectionclip.x!=peerhistory[0].selectionclip.x2 && peerhistory[0].selectionclip.y!=peerhistory[0].selectionclip.y2){
		//console.log(peerhistory[0].selectionclip.x+","+peerhistory[0].selectionclip.x2+","+peerhistory[0].selectionclip.y+","+peerhistory[0].selectionclip.y2);
		selection = true;
		if(peerhistory[0].selectionclipped==false)maskData=peerhistory[0].selectionmaskcontext.getImageData(0, 0, peerhistory[0].selectionmaskcanvas.width, peerhistory[0].selectionmaskcanvas.height);
		else maskData=peerhistory[0].selectionclipcontext.getImageData(0, 0, peerhistory[0].selectionclipcanvas.width, peerhistory[0].selectionclipcanvas.height);

	}

	var imgData=ctx.getImageData(0, 0, project.width, project.height);
	var imgData2=ctx.createImageData(project.width, project.height);

    /*for (var i=0;i<imgData.data.length;i+=4)
    {
        imgData.data[i]= rgb[0] | imgData.data[i];
        imgData.data[i+1]= rgb[1] | imgData.data[i+1];
        imgData.data[i+2]= rgb[2] | imgData.data[i+2];
    }
    ctx.putImageData(imgData,0,0);*/

    var h = project.height;
    var w = project.width;

    if (point.y < 0 || point.y > h - 1 || point.x < 0 || point.x > w - 1)
    	return;

	var SEED_COLOR = ctx.getImageData(point.x, point.y, 1, 1);

	if(COLOR.r == SEED_COLOR.data[0] &&
		COLOR.g == SEED_COLOR.data[1] &&
		COLOR.b == SEED_COLOR.data[2] &&
		SEED_COLOR.data[3]==255 ) return;

	peerhistory[0].context.fillStyle="rgb("+COLOR.r+","+COLOR.g+","+COLOR.b+")";
	peerhistory[0].selectionclipcontext.fillStyle="rgb("+COLOR.r+","+COLOR.g+","+COLOR.b+")";

	if(contiguous==false ){
		for(var y=0; y<h; y++){
			for(var x=0; x<w; x++){
				if( imgData.data[(((y*w)+x)*4)] == SEED_COLOR.data[0] &&
					imgData.data[(((y*w)+x)*4)+1] == SEED_COLOR.data[1] &&
					imgData.data[(((y*w)+x)*4)+2] == SEED_COLOR.data[2] &&
					imgData.data[(((y*w)+x)*4)+3] == SEED_COLOR.data[3] ){

					if(selection==true){
						if( y < peerhistory[0].selectionclip.y || x < peerhistory[0].selectionclip.x ||
							y >= peerhistory[0].selectionclip.y2 || x >= peerhistory[0].selectionclip.x2)
							continue;
					}

					if(selection==true){
						if(peerhistory[0].selectionclipped==false && maskData.data[((((y-peerhistory[0].selectionoffset.y)*peerhistory[0].selectionmaskcanvas.width)+(x-peerhistory[0].selectionoffset.x))*4)+3]==0){
							//console.log(maskData.data[(((y*w)+x)*4)+3]);
							continue;
						}else if(peerhistory[0].selectionclipped==true && maskData.data[((((y-peerhistory[0].selectionoffset.y)*peerhistory[0].selectionclipcanvas.width)+(x-peerhistory[0].selectionoffset.x))*4)+3]==0){
							//console.log(maskData.data[(((y*w)+x)*4)+3]);
							continue;
						}
					}

					imgData.data[(((y*w)+x)*4)] = COLOR.r;
					imgData.data[(((y*w)+x)*4)+1] = COLOR.g;
					imgData.data[(((y*w)+x)*4)+2] = COLOR.b;
					imgData.data[(((y*w)+x)*4)+3] = 255;

					imgData2.data[(((y*w)+x)*4)] = COLOR.r;
					imgData2.data[(((y*w)+x)*4)+1] = COLOR.g;
					imgData2.data[(((y*w)+x)*4)+2] = COLOR.b;
					imgData2.data[(((y*w)+x)*4)+3] = 255;

					//if(peerhistory[0].selectionclipped==false){
						//peerhistory[0].context.fillStyle="rgb("+COLOR.r+","+COLOR.g+","+COLOR.b+")";
						//peerhistory[0].context.fillRect(x,y,1,1);
					//}else if(selection==true && peerhistory[0].selectionclipped==true){
						//peerhistory[0].selectionclipcontext.fillStyle="rgb("+COLOR.r+","+COLOR.g+","+COLOR.b+")";
						//peerhistory[0].selectionclipcontext.fillRect(x-peerhistory[0].selectionoffset.x,y-peerhistory[0].selectionoffset.y,1,1);
					//}

					if(peerid!="palette"){
						if(x < peerhistory[0].clip.x)peerhistory[0].clip.x = x;
						if(y < peerhistory[0].clip.y)peerhistory[0].clip.y = y;
						if(x > peerhistory[0].clip.x2)peerhistory[0].clip.x2 = x;
						if(y > peerhistory[0].clip.y2)peerhistory[0].clip.y2 = y;
					}
				}
			}
		}
	}else{

		var stack = new Array();
		stack.push(point);
		//var p;
		while (stack.length > 0)
		{
			var p = stack.pop();
			var x = p.x;
			var y = p.y;
			if (y < 0 || y > h - 1 || x < 0 || x > w - 1)
				continue;

			if(selection==true){
				if( y < peerhistory[0].selectionclip.y || x < peerhistory[0].selectionclip.x ||
					y >= peerhistory[0].selectionclip.y2 || x >= peerhistory[0].selectionclip.x2)
					continue;
			}

			var val = [ imgData.data[((y*w)+x)*4],imgData.data[(((y*w)+x)*4)+1],imgData.data[(((y*w)+x)*4)+2],imgData.data[(((y*w)+x)*4)+3] ];	//rgba of x,y

			if(peerid!="palette"){
				if(x < peerhistory[0].clip.x)peerhistory[0].clip.x = x;
				if(y < peerhistory[0].clip.y)peerhistory[0].clip.y = y;
				if(x > peerhistory[0].clip.x2)peerhistory[0].clip.x2 = x;
				if(y > peerhistory[0].clip.y2)peerhistory[0].clip.y2 = y;
			}

			if (val[0] == SEED_COLOR.data[0] &&
			val[1] == SEED_COLOR.data[1] &&
			val[2] == SEED_COLOR.data[2] &&
			val[3] == SEED_COLOR.data[3] )
			{

				if(selection==true){
					if(peerhistory[0].selectionclipped==false && maskData.data[((((y-peerhistory[0].selectionoffset.y)*peerhistory[0].selectionmaskcanvas.width)+(x-peerhistory[0].selectionoffset.x))*4)+3]==0){
						//console.log(maskData.data[(((y*w)+x)*4)+3]);
						continue;
					}else if(peerhistory[0].selectionclipped==true && maskData.data[((((y-peerhistory[0].selectionoffset.y)*peerhistory[0].selectionclipcanvas.width)+(x-peerhistory[0].selectionoffset.x))*4)+3]==0){
						//console.log(maskData.data[(((y*w)+x)*4)+3]);
						continue;
					}
				}

				imgData.data[(((y*w)+x)*4)] = COLOR.r;
				imgData.data[(((y*w)+x)*4)+1] = COLOR.g;
				imgData.data[(((y*w)+x)*4)+2] = COLOR.b;
				imgData.data[(((y*w)+x)*4)+3] = 255;

				imgData2.data[(((y*w)+x)*4)] = COLOR.r;
				imgData2.data[(((y*w)+x)*4)+1] = COLOR.g;
				imgData2.data[(((y*w)+x)*4)+2] = COLOR.b;
				imgData2.data[(((y*w)+x)*4)+3] = 255;

				//if(peerhistory[0].selectionclipped==false){
					//peerhistory[0].context.fillRect(x,y,1,1);
				//}else if(selection==true && peerhistory[0].selectionclipped==true){
					//peerhistory[0].selectionclipcontext.fillStyle="rgb("+COLOR.r+","+COLOR.g+","+COLOR.b+")";
					//peerhistory[0].selectionclipcontext.fillRect(x-peerhistory[0].selectionoffset.x,y-peerhistory[0].selectionoffset.y,1,1);
				//}

				if(	x<w-1 &&
					imgData.data[(((y*w)+x+1)*4)] == SEED_COLOR.data[0] &&
					imgData.data[(((y*w)+x+1)*4)+1] == SEED_COLOR.data[1] &&
					imgData.data[(((y*w)+x+1)*4)+2] == SEED_COLOR.data[2] &&
					imgData.data[(((y*w)+x+1)*4)+3] == SEED_COLOR.data[3] ){

					stack.push( {x:(x + 1), y:y} );
				}
				if( x>0 &&
					imgData.data[(((y*w)+x-1)*4)] == SEED_COLOR.data[0] &&
					imgData.data[(((y*w)+x-1)*4)+1] == SEED_COLOR.data[1] &&
					imgData.data[(((y*w)+x-1)*4)+2] == SEED_COLOR.data[2] &&
					imgData.data[(((y*w)+x-1)*4)+3] == SEED_COLOR.data[3] ){

					stack.push( {x:(x - 1), y:y} );
				}
				if( y<h-1 &&
					imgData.data[((((y+1)*w)+x)*4)] == SEED_COLOR.data[0] &&
					imgData.data[((((y+1)*w)+x)*4)+1] == SEED_COLOR.data[1] &&
					imgData.data[((((y+1)*w)+x)*4)+2] == SEED_COLOR.data[2] &&
					imgData.data[((((y+1)*w)+x)*4)+3] == SEED_COLOR.data[3] ){

					stack.push( {x:x, y:(y + 1)} );
				}
				if( y>0 &&
					imgData.data[((((y-1)*w)+x)*4)] == SEED_COLOR.data[0] &&
					imgData.data[((((y-1)*w)+x)*4)+1] == SEED_COLOR.data[1] &&
					imgData.data[((((y-1)*w)+x)*4)+2] == SEED_COLOR.data[2] &&
					imgData.data[((((y-1)*w)+x)*4)+3] == SEED_COLOR.data[3] ){

					stack.push( {x:x, y:(y - 1)} );
				}
			}
		}
	}
	if(peerhistory[0].selectionclipped==false){
		peerhistory[0].context.putImageData(imgData2,0,0);
	}

    if(peerid!="palette"){}//peerhistory[0].context.putImageData(imgData,0,0);
	else palettecontext.putImageData(imgData2,0,0);
	//ctx.drawImage(c,0,0);

	//claim over peer historylist states
	if(peerid!="palette")claimHistory(peerhistory[0].id,peerhistory[0].canvas);

}

function magicWand(ctx, point, type, contiguous, peerid)	//vals is imgdata, point is start point, seedcolor is color we're grouping, color is new color?
{

	var peerhistory;
	if(peerid!="palette")peerhistory = $.grep(historylist, function(e){ return e.id == peerid; });

	var selection = false;
	var maskData;
	if(peerid!="palette" && peerhistory[0].selectionclip.x!=peerhistory[0].selectionclip.x2 && peerhistory[0].selectionclip.y!=peerhistory[0].selectionclip.y2){
		//console.log(peerhistory[0].selectionclip.x+","+peerhistory[0].selectionclip.x2+","+peerhistory[0].selectionclip.y+","+peerhistory[0].selectionclip.y2);
		selection = true;
		if(peerhistory[0].selectionclipped==false)maskData=peerhistory[0].selectionmaskcontext.getImageData(0, 0, peerhistory[0].selectionmaskcanvas.width, peerhistory[0].selectionmaskcanvas.height);
		else maskData=peerhistory[0].selectionclipcontext.getImageData(0, 0, peerhistory[0].selectionclipcanvas.width, peerhistory[0].selectionclipcanvas.height);

	}

	var imgData=ctx.getImageData(0, 0, project.width, project.height);
	var imgData2=ctx.createImageData(project.width, project.height);

    /*for (var i=0;i<imgData.data.length;i+=4)
    {
        imgData.data[i]= rgb[0] | imgData.data[i];
        imgData.data[i+1]= rgb[1] | imgData.data[i+1];
        imgData.data[i+2]= rgb[2] | imgData.data[i+2];
    }
    ctx.putImageData(imgData,0,0);*/

    var h = project.height;
    var w = project.width;

    if (point.y < 0 || point.y > h - 1 || point.x < 0 || point.x > w - 1)
    	return;

	var SEED_COLOR = ctx.getImageData(point.x, point.y, 1, 1);

	if(contiguous==false ){
		for(var y=0; y<h; y++){
			for(var x=0; x<w; x++){
				if( imgData.data[(((y*w)+x)*4)] == SEED_COLOR.data[0] &&
					imgData.data[(((y*w)+x)*4)+1] == SEED_COLOR.data[1] &&
					imgData.data[(((y*w)+x)*4)+2] == SEED_COLOR.data[2] &&
					imgData.data[(((y*w)+x)*4)+3] == SEED_COLOR.data[3] ){

					imgData2.data[(((y*w)+x)*4)] = 255;
					imgData2.data[(((y*w)+x)*4)+1] = 0;
					imgData2.data[(((y*w)+x)*4)+2] = 0;
					imgData2.data[(((y*w)+x)*4)+3] = 255;
					//peerhistory[0].context.fillStyle="rgb(255,0,0)";
					//peerhistory[0].context.fillRect(x,y,1,1);

					if(peerid!="palette"){
						if(x < peerhistory[0].selectionclip.x)peerhistory[0].selectionclip.x = x;
						if(y < peerhistory[0].selectionclip.y)peerhistory[0].selectionclip.y = y;
						if(x > peerhistory[0].selectionclip.x2)peerhistory[0].selectionclip.x2 = x;
						if(y > peerhistory[0].selectionclip.y2)peerhistory[0].selectionclip.y2 = y;
					}
				}
			}
		}
	}else{

		var stack = new Array();
		stack.push(point);
		while (stack.length > 0)
		{
			var p = stack.pop();
			var x = p.x;
			var y = p.y;
			if (y < 0 || y > h - 1 || x < 0 || x > w - 1)
				continue;
			/*
			if(selection==true){
				if( y < peerhistory[0].selectionclip.y || x < peerhistory[0].selectionclip.x ||
					y >= peerhistory[0].selectionclip.y2 || x >= peerhistory[0].selectionclip.x2)
					continue;
			}
			*/
			var val = [ imgData.data[((y*w)+x)*4],imgData.data[(((y*w)+x)*4)+1],imgData.data[(((y*w)+x)*4)+2],imgData.data[(((y*w)+x)*4)+3] ];	//rgba of x,y

			if(val[3] == 254)continue;

			if(peerid!="palette"){
				if(x < peerhistory[0].selectionclip.x)peerhistory[0].selectionclip.x = x;
				if(y < peerhistory[0].selectionclip.y)peerhistory[0].selectionclip.y = y;
				if(x > peerhistory[0].selectionclip.x2)peerhistory[0].selectionclip.x2 = x;
				if(y > peerhistory[0].selectionclip.y2)peerhistory[0].selectionclip.y2 = y;
			}

			if (val[0] == SEED_COLOR.data[0] &&
			val[1] == SEED_COLOR.data[1] &&
			val[2] == SEED_COLOR.data[2] &&
			val[3] == SEED_COLOR.data[3] )
			{
				/*
				if(selection==true){
					if(peerhistory[0].selectionclipped==false && maskData.data[((((y-peerhistory[0].selectionoffset.y)*peerhistory[0].selectionmaskcanvas.width)+(x-peerhistory[0].selectionoffset.x))*4)+3]==0){
						//console.log(maskData.data[(((y*w)+x)*4)+3]);
						continue;
					}else if(peerhistory[0].selectionclipped==true && maskData.data[((((y-peerhistory[0].selectionoffset.y)*peerhistory[0].selectionclipcanvas.width)+(x-peerhistory[0].selectionoffset.x))*4)+3]==0){
						//console.log(maskData.data[(((y*w)+x)*4)+3]);
						continue;
					}
				}
				*/
				//imgData.data[(((y*w)+x)*4)] = COLOR.r;
				//imgData.data[(((y*w)+x)*4)+1] = COLOR.g;
				//imgData.data[(((y*w)+x)*4)+2] = COLOR.b;
				imgData.data[(((y*w)+x)*4)+3] = 254;
				//if(peerhistory[0].selectionclipped==false){

					imgData2.data[(((y*w)+x)*4)] = 255;
					imgData2.data[(((y*w)+x)*4)+1] = 0;
					imgData2.data[(((y*w)+x)*4)+2] = 0;
					imgData2.data[(((y*w)+x)*4)+3] = 255;
					//peerhistory[0].context.fillStyle="rgb(255,0,0)";
					//peerhistory[0].context.fillRect(x,y,1,1);

				/*}else if(selection==true && peerhistory[0].selectionclipped==true){
					peerhistory[0].selectionclipcontext.fillStyle="rgb("+COLOR.r+","+COLOR.g+","+COLOR.b+")";
					peerhistory[0].selectionclipcontext.fillRect(x-peerhistory[0].selectionoffset.x,y-peerhistory[0].selectionoffset.y,1,1);
				}*/
				if(	x<w-1 &&
					imgData.data[(((y*w)+x+1)*4)] == SEED_COLOR.data[0] &&
					imgData.data[(((y*w)+x+1)*4)+1] == SEED_COLOR.data[1] &&
					imgData.data[(((y*w)+x+1)*4)+2] == SEED_COLOR.data[2] &&
					imgData.data[(((y*w)+x+1)*4)+3] == SEED_COLOR.data[3] ){

					stack.push( {x:(x + 1), y:y} );
				}
				if( x>0 &&
					imgData.data[(((y*w)+x-1)*4)] == SEED_COLOR.data[0] &&
					imgData.data[(((y*w)+x-1)*4)+1] == SEED_COLOR.data[1] &&
					imgData.data[(((y*w)+x-1)*4)+2] == SEED_COLOR.data[2] &&
					imgData.data[(((y*w)+x-1)*4)+3] == SEED_COLOR.data[3] ){

					stack.push( {x:(x - 1), y:y} );
				}
				if( y<h-1 &&
					imgData.data[((((y+1)*w)+x)*4)] == SEED_COLOR.data[0] &&
					imgData.data[((((y+1)*w)+x)*4)+1] == SEED_COLOR.data[1] &&
					imgData.data[((((y+1)*w)+x)*4)+2] == SEED_COLOR.data[2] &&
					imgData.data[((((y+1)*w)+x)*4)+3] == SEED_COLOR.data[3] ){

					stack.push( {x:x, y:(y + 1)} );
				}
				if( y>0 &&
					imgData.data[((((y-1)*w)+x)*4)] == SEED_COLOR.data[0] &&
					imgData.data[((((y-1)*w)+x)*4)+1] == SEED_COLOR.data[1] &&
					imgData.data[((((y-1)*w)+x)*4)+2] == SEED_COLOR.data[2] &&
					imgData.data[((((y-1)*w)+x)*4)+3] == SEED_COLOR.data[3] ){

					stack.push( {x:x, y:(y - 1)} );
				}
			}
		}
	}
	peerhistory[0].context.putImageData(imgData2,0,0);

    if(peerid!="palette"){}//peerhistory[0].context.putImageData(imgData,0,0);
	//else palettecontext.putImageData(imgData,0,0);
	//ctx.drawImage(c,0,0);

	//claim over peer historylist states
	//if(peerid!="palette")claimHistory(peerhistory[0].id,peerhistory[0].canvas);

	if(peerid!="palette"){
		var selectionwidth = (peerhistory[0].selectionclip.x2 - peerhistory[0].selectionclip.x)+4;
		var selectionheight = (peerhistory[0].selectionclip.y2 - peerhistory[0].selectionclip.y)+4;

		var selectionmask = document.createElement("canvas");
		selectionmask.width = selectionwidth;
		selectionmask.height = selectionheight;
		var selectionmaskcontext = selectionmask.getContext('2d');

		selectionmaskcontext.drawImage(peerhistory[0].canvas, -peerhistory[0].selectionclip.x,-peerhistory[0].selectionclip.y,peerhistory[0].canvas.width, peerhistory[0].canvas.height);

		if(type!="new"){
			var offsetx = peerhistory[0].selectionoffset.x-peerhistory[0].selectionclip.x;
			var offsety = peerhistory[0].selectionoffset.y-peerhistory[0].selectionclip.y;
			if(type=="subtract")selectionmaskcontext.globalCompositeOperation = 'source-out';
			else if(type=="intersect")selectionmaskcontext.globalCompositeOperation = 'source-in';
			selectionmaskcontext.drawImage(peerhistory[0].selectionmaskcanvas,offsetx,offsety, peerhistory[0].selectionmaskcanvas.width, peerhistory[0].selectionmaskcanvas.height);
			if(type=="subtract")selectionmaskcontext.globalCompositeOperation = 'source-over';

			peerhistory[0].selectionclipcontext.globalCompositeOperation = 'destination-in';
			peerhistory[0].selectionclipcontext.drawImage(selectionmask,-offsetx,-offsety, selectionwidth, selectionheight);
			peerhistory[0].selectionclipcontext.globalCompositeOperation = 'source-over';

			//if there is a clipped part, make sure it realigns
			imgData = peerhistory[0].selectionclipcontext.getImageData(0,0,peerhistory[0].selectionclipcanvas.width,peerhistory[0].selectionclipcanvas.height);
			peerhistory[0].selectionclipcanvas.width = selectionwidth;
			peerhistory[0].selectionclipcanvas.height = selectionheight;
			peerhistory[0].selectionclipcontext.clearRect(0,0,selectionwidth,selectionheight);
			peerhistory[0].selectionclipcontext.putImageData(imgData,-(peerhistory[0].selectionclip.x-peerhistory[0].selectionoffset.x),-(peerhistory[0].selectionclip.y-peerhistory[0].selectionoffset.y));
		}

		peerhistory[0].selectionoffset.x = peerhistory[0].selectionclip.x;
		peerhistory[0].selectionoffset.y = peerhistory[0].selectionclip.y;
		peerhistory[0].selectionmaskcanvas.width = selectionwidth-3;
		peerhistory[0].selectionmaskcanvas.height = selectionheight-3;
		if(type=="new")peerhistory[0].selectionmaskcontext.clearRect(0, 0, peerhistory[0].selectionmaskcanvas.width, peerhistory[0].selectionmaskcanvas.height);
		//if(type=="subtract")peerhistory[0].selectionmaskcontext.globalCompositeOperation = 'destination-out';
		peerhistory[0].selectionmaskcontext.drawImage(selectionmask,0,0, selectionwidth, selectionheight);
		//if(type=="subtract")peerhistory[0].selectionmaskcontext.globalCompositeOperation = 'source-over';
		peerhistory[0].selectioncanvas.width = selectionwidth;
		peerhistory[0].selectioncanvas.height = selectionheight;
		peerhistory[0].selectioncontext.clearRect(0, 0, peerhistory[0].selectioncanvas.width, peerhistory[0].selectioncanvas.height);
		peerhistory[0].selectioncontext.drawImage(peerhistory[0].selectionmaskcanvas, 0,1, peerhistory[0].selectionmaskcanvas.width, peerhistory[0].selectionmaskcanvas.height);
		peerhistory[0].selectioncontext.drawImage(peerhistory[0].selectionmaskcanvas, 2,1, peerhistory[0].selectionmaskcanvas.width, peerhistory[0].selectionmaskcanvas.height);
		peerhistory[0].selectioncontext.drawImage(peerhistory[0].selectionmaskcanvas, 1,0, peerhistory[0].selectionmaskcanvas.width, peerhistory[0].selectionmaskcanvas.height);
		peerhistory[0].selectioncontext.drawImage(peerhistory[0].selectionmaskcanvas, 1,2, peerhistory[0].selectionmaskcanvas.width, peerhistory[0].selectionmaskcanvas.height);
		peerhistory[0].selectioncontext.globalCompositeOperation = 'destination-out';
		peerhistory[0].selectioncontext.drawImage(peerhistory[0].selectionmaskcanvas, 1,1);
		peerhistory[0].selectioncontext.globalCompositeOperation = 'source-over';

		if(type=="subtract" || type=="intersect"){
			var found=false;
			imgData=peerhistory[0].selectionmaskcontext.getImageData(0, 0, selectionwidth, selectionheight);
			for (var i=0;i<imgData.data.length;i+=4)
			{
				if(imgData.data[i+3]==255)found=true;
			}
			if(found==false){
				myHistory[0].selectionclip.x = 0, myHistory[0].selectionclip.y = 0;
				myHistory[0].selectionclip.x2 = 0, myHistory[0].selectionclip.y2 = 0;
			}
		}

		traceSelection(peerid);
	}

}

function zoomIn(){
	var posx = canvas.width*0.5;
	var posy = canvas.height*0.5;
	var percentx = Math.floor((posx - tool.offset.x)/tool.zoom) / project.width;
	var percenty = Math.floor((posy - tool.offset.y)/tool.zoom) / project.height;
	tool.zoom++;
	var finalx = -(percentx*(project.width*tool.zoom)) + posx;
	var finaly = -(percenty*(project.height*tool.zoom)) + posy;
	//console.log(posx);
	//console.log(percentx);
	//console.log(finalx);
	tool.offset.x = Math.round(finalx) ;
	tool.offset.y = Math.round(finaly) ;
		tool.offset.x -= tool.offset.x%tool.zoom ;
		tool.offset.y -= tool.offset.y%tool.zoom ;
	//tool.offset.x -= Math.round(((canvas.width*0.50)/tool.zoom)-(tool.offset.x/tool.zoom));
	//tool.offset.y -= Math.round(((canvas.height*0.50)/tool.zoom)-(tool.offset.y/tool.zoom));
	$("#zoom_text").text((tool.zoom*100)+"%");
}
function zoomOut(){
	if(tool.zoom>1){
		var posx = canvas.width*0.5;
		var posy = canvas.height*0.5;
		var percentx = Math.floor((posx - tool.offset.x)/tool.zoom) / project.width;
		var percenty = Math.floor((posy - tool.offset.y)/tool.zoom) / project.height;
		tool.zoom--;
		var finalx = -(percentx*(project.width*tool.zoom)) + posx;
		var finaly = -(percenty*(project.height*tool.zoom)) + posy;
		tool.offset.x = Math.round(finalx) ;
		tool.offset.y = Math.round(finaly) ;
		tool.offset.x -= tool.offset.x%tool.zoom ;
		tool.offset.y -= tool.offset.y%tool.zoom ;

		$("#zoom_text").text((tool.zoom*100)+"%");
	}
}
function zoomSet(amount){
	var posx = canvas.width*0.5;
	var posy = canvas.height*0.5;
	var percentx = Math.floor((posx - tool.offset.x)/tool.zoom) / project.width;
	var percenty = Math.floor((posy - tool.offset.y)/tool.zoom) / project.height;
	tool.zoom = amount;
	var finalx = -(percentx*(project.width*tool.zoom)) + posx;
	var finaly = -(percenty*(project.height*tool.zoom)) + posy;
	//console.log(posx);
	//console.log(percentx);
	//console.log(finalx);
	tool.offset.x = Math.round(finalx) ;
	tool.offset.y = Math.round(finaly) ;
		tool.offset.x -= tool.offset.x%tool.zoom ;
		tool.offset.y -= tool.offset.y%tool.zoom ;
	//tool.offset.x -= Math.round(((canvas.width*0.50)/tool.zoom)-(tool.offset.x/tool.zoom));
	//tool.offset.y -= Math.round(((canvas.height*0.50)/tool.zoom)-(tool.offset.y/tool.zoom));
	$("#zoom_text").text((tool.zoom*100)+"%");
}
function zoomInSecondary(){
	var posx = minicanvas.width*0.5;
	var posy = minicanvas.height*0.5;
	var percentx = Math.floor((posx - tool.secondary_offset.x)/tool.secondary_zoom) / project.width;
	var percenty = Math.floor((posy - tool.secondary_offset.y)/tool.secondary_zoom) / project.height;
	tool.secondary_zoom++;
	var finalx = -(percentx*(project.width*tool.secondary_zoom)) + posx;
	var finaly = -(percenty*(project.height*tool.secondary_zoom)) + posy;
	tool.secondary_offset.x = Math.round(finalx) ;
	tool.secondary_offset.y = Math.round(finaly) ;
	tool.secondary_offset.x -= tool.secondary_offset.x%tool.secondary_zoom ;
	tool.secondary_offset.y -= tool.secondary_offset.y%tool.secondary_zoom ;
	$("#secondary_zoom_text").text((tool.secondary_zoom*100)+"%");
}
function zoomOutSecondary(){
	if(tool.secondary_zoom>1){
		var posx = minicanvas.width*0.5;
		var posy = minicanvas.height*0.5;
		var percentx = Math.floor((posx - tool.secondary_offset.x)/tool.secondary_zoom) / project.width;
		var percenty = Math.floor((posy - tool.secondary_offset.y)/tool.secondary_zoom) / project.height;
		tool.secondary_zoom--;
		var finalx = -(percentx*(project.width*tool.secondary_zoom)) + posx;
		var finaly = -(percenty*(project.height*tool.secondary_zoom)) + posy;
		tool.secondary_offset.x = Math.round(finalx) ;
		tool.secondary_offset.y = Math.round(finaly) ;
		tool.secondary_offset.x -= tool.secondary_offset.x%tool.secondary_zoom ;
		tool.secondary_offset.y -= tool.secondary_offset.y%tool.secondary_zoom ;

		$("#secondary_zoom_text").text((tool.secondary_zoom*100)+"%");
	}
}
function zoomSetSecondary(amount){
	var posx = minicanvas.width*0.5;
	var posy = minicanvas.height*0.5;
	var percentx = Math.floor((posx - tool.secondary_offset.x)/tool.secondary_zoom) / project.width;
	var percenty = Math.floor((posy - tool.secondary_offset.y)/tool.secondary_zoom) / project.height;
	tool.secondary_zoom = amount;
	var finalx = -(percentx*(project.width*tool.secondary_zoom)) + posx;
	var finaly = -(percenty*(project.height*tool.secondary_zoom)) + posy;
	//console.log(posx);
	//console.log(percentx);
	//console.log(finalx);
	tool.secondary_offset.x = Math.round(finalx) ;
	tool.secondary_offset.y = Math.round(finaly) ;
		tool.secondary_offset.x -= tool.secondary_offset.x%tool.secondary_zoom ;
		tool.secondary_offset.y -= tool.secondary_offset.y%tool.secondary_zoom ;
	//tool.offset.x -= Math.round(((canvas.width*0.50)/tool.zoom)-(tool.offset.x/tool.zoom));
	//tool.offset.y -= Math.round(((canvas.height*0.50)/tool.zoom)-(tool.offset.y/tool.zoom));
	$("#secondary_zoom_text").text((tool.secondary_zoom*100)+"%");
}

function resizeImage(width,height){
	var c = document.createElement('canvas');
	c.width=project.width;
	c.height=project.height;
	var ctx = c.getContext('2d');

	commitHistory(myHistory[0].id);
	clearHistory(myHistory[0].id);

	project.canvaslayer.forEach(function(entry){
		var imgData = resizeImageData(entry,project.contextlayer[project.canvaslayer.indexOf(entry)],width,height);

		entry.width = width;
		entry.height = height;
		project.contextlayer[project.canvaslayer.indexOf(entry)] = entry.getContext('2d');
		project.contextlayer[project.canvaslayer.indexOf(entry)] = reload_canvas(entry, project.contextlayer[project.canvaslayer.indexOf(entry)]);
		project.contextlayer[project.canvaslayer.indexOf(entry)].putImageData(imgData,0,0);
	});

	resetCanvases(width,height);

	myHistory[0].frame = project.currentframe;
	myHistory[0].layers.push(new historylayerdata("New",myHistory[0].canvas,myHistory[0]) );
}

function resetCanvases(width,height){

	project.width = width;
	project.height = height;

	updatecanvas.width=width;
	updatecanvas.height=height;
	updatecontext = updatecanvas.getContext('2d');

	temp2canvas = document.createElement("canvas");
	temp2canvas.width = project.width;
	temp2canvas.height = project.height;
	temp2context = temp2canvas.getContext('2d');
	temp2context = reload_canvas(temp2canvas, temp2context);

	historylist = [];
	historylist.push(new historydata(0,0));
	myHistory= $.grep(historylist, function(e){ return e.id == 0; });

	brushlayers = [];
	brushlayers.push(new brushlayerdata(0,0));
	myBrush= $.grep(brushlayers, function(e){ return e.id == 0; });

	tool.offset = {x:(((canvas.width/tool.zoom)-width)*0.5)*tool.zoom,y:(((canvas.height/tool.zoom)-height)*0.5)*tool.zoom};

	//add the canvases for connected peers if we've resized image during a connected session
	addPeerCanvases();

}

var resizeLayers = new resizeLayersData();
var resizeLayersPause = false;
function resizeLayersData(){
	this.layer = new Array();
	this.visible = new Array();
	this.opacity = new Array();
	this.delay = new Array();
	this.link = new Array();
	this.order = new Array();

	this.getOrder = function(){
		this.order = $( "#frame_list" ).sortable('toArray', {attribute: 'value'});
		this.order.shift();
		this.order = this.order.map(function (x) {
			return parseInt(x, 10);
		});

		this.visible = project.visible.slice(0);
		this.opacity = project.opacity.slice(0);

		for(var i=0; i<project.frames; i++){
			this.delay.push( $('#frame_null').siblings('[value="'+i+'"]').attr('data-interval') );
			this.link.push( $('#frame_null').siblings('[value="'+i+'"]').find('.frame_linker').attr('style').indexOf('-linked')!==-1 ? 'linked':'unlinked' );
		}

	};

}

function addResizeUndo(){
	$("#historyresize_null").siblings().remove();
	//add new element to the historylist list
	var hl = $('#historyresize_list');
	hl.find('li:first').clone(true).appendTo(hl);
	hl.find('li:last').show()
	.text('Undo Resize')
	.css({'font-size':'10px'})
	.siblings().removeClass('ui-state-active');
	//hl.find('li:last').toggleClass('ui-state-active');
}
function revertResize(){
	if(resizeLayers.layer.length>0){

		commitHistory(myHistory[0].id);
		clearHistory(myHistory[0].id);

		if(project.playback.state==true){
			project.playback.stop();	//wait until all layers are loaded below before continuing.
			resizeLayersPause = true;
		}
		var count = 0;

		while(resizeLayers.layer.length>project.canvaslayer.length){	//if the previous state had more frames
			addFrame(0);
		}
		resizeLayers.layer.forEach(function(entry){
			var l = resizeLayers.layer.length-1;
			var img = new Image()
			img.onload = function(){
				var i = resizeLayers.layer.indexOf(entry);
				if(i!=-1){
					project.canvaslayer[i].width = this.width;
					project.canvaslayer[i].height = this.height;
					project.contextlayer[i] = project.canvaslayer[i].getContext('2d');
					project.contextlayer[i] = reload_canvas(project.canvaslayer[i], project.contextlayer[i]);
					project.contextlayer[i].clearRect(0,0, this.width, this.height);
					project.contextlayer[i].drawImage(this,0,0);

					if(i==l){
						resetCanvases(this.width,this.height);

						myHistory[0].frame = project.currentframe;
						myHistory[0].layers.push(new historylayerdata("New",myHistory[0].canvas,myHistory[0]) );

						$("#historyresize_null").siblings().remove();

						if(project.canvaslayer.length-1 > i){
							for(var j=project.canvaslayer.length-1; j>i ; j--){
								removeFrame(j);
								/*project.canvaslayer[i].width = this.width;
								project.canvaslayer[i].height = this.height;
								project.contextlayer[i] = project.canvaslayer[i].getContext('2d');
								project.contextlayer[i] = reload_canvas(project.canvaslayer[i], project.contextlayer[i]);*/
							}
						}
					}
					count++;
					if(count-1 == resizeLayers.layer.length-1){
						resizeLayers.order.forEach(function(o){
							$("#frame_list").append( $('#frame_'+o) );
						});
						for(var f=0; f<project.frames; f++){
							var theframe = $('#frame_null').siblings('[value="'+f+'"]');
							theframe.find('.frame_visible').attr('src',(resizeLayers.visible[f]!=true?'img/eye-shut.png':'img/eye-open.png'));
							theframe.attr('data-interval',resizeLayers.delay[f]);
							theframe.find('.frame_interval').html(resizeLayers.delay[f]*0.001);
							theframe.find('.frame_linker').css('background-image','url(img/icon-'+resizeLayers.link[f]+'.png)');
							project.visible[f] = resizeLayers.visible[f];
							project.opacity[f] = resizeLayers.opacity[f];
						}
						if(resizeLayersPause == true){
							resizeLayersPause=false;
							project.playback.start();
						}
					}
				}
			};
			img.src = entry;
		});

	}

}

function resizeCanvas(width,height,direction){
	var c = document.createElement('canvas');
	c.width=project.width;
	c.height=project.height;
	var ctx = c.getContext('2d');

	commitHistory(myHistory[0].id);
	clearHistory(myHistory[0].id);

	var x = (direction.x==1 ? 0: width-project.width);
	var y = (direction.y==1 ? 0: height-project.height);
	if(direction.x==0)x = Math.floor(x*0.5);
	if(direction.y==0)y = Math.floor(y*0.5);

	project.canvaslayer.forEach(function(entry){
		ctx.clearRect(0,0,project.width,project.height);
		ctx.drawImage(entry,0,0);

		entry.width = width;
		entry.height = height;
		project.contextlayer[project.canvaslayer.indexOf(entry)] = entry.getContext('2d');
		project.contextlayer[project.canvaslayer.indexOf(entry)] = reload_canvas(entry, project.contextlayer[project.canvaslayer.indexOf(entry)]);
		project.contextlayer[project.canvaslayer.indexOf(entry)].drawImage(c,x,y);
	});

	resetCanvases(width,height);

	myHistory[0].frame = project.currentframe;
	myHistory[0].layers.push(new historylayerdata("New",myHistory[0].canvas,myHistory[0]) );

	/*
	myHistory[0].frame = project.currentframe;
	myHistory[0].layers.push(new historylayerdata("Resize Old",myHistory[0].canvas,myHistory[0]) );
	myHistory[0].layers[myHistory[0].layers.length-1].resizelayers = resizelayers.slice(0);
	myHistory[0].layers[myHistory[0].layers.length-1].clip.x = direction.x;
	myHistory[0].layers[myHistory[0].layers.length-1].clip.y = direction.y;
	myHistory[0].layers[myHistory[0].layers.length-1].clip.w = width;
	myHistory[0].layers[myHistory[0].layers.length-1].clip.h = height;

	myHistory[0].frame = project.currentframe;
	myHistory[0].layers.push(new historylayerdata("Resize New",myHistory[0].canvas,myHistory[0]) );
	myHistory[0].layers[myHistory[0].layers.length-1].clip.x = direction.x;
	myHistory[0].layers[myHistory[0].layers.length-1].clip.y = direction.y;
	myHistory[0].layers[myHistory[0].layers.length-1].clip.w = width;
	myHistory[0].layers[myHistory[0].layers.length-1].clip.h = height;*/
}

function resizeMap(width,height,direction){
	var tempmap = new tiledata();
	tempmap.setupMap(width,height);

	var x = (direction.x==1 ? 0: width-tile.dim.w);
	var y = (direction.y==1 ? 0: height-tile.dim.h);
	if(direction.x==0)x = Math.floor(x*0.5);
	if(direction.y==0)y = Math.floor(y*0.5);

	for(var row=0; row<tile.dim.h; row++){
		for(var col=0; col<tile.dim.w; col++){
			var newx = col+x, newy = row+y;
			if(newx >=0 && newx < width && newy >=0 && newy < height){
				for(var l=0; l<tempmap.layers.length; l++){
					tempmap.map[l][newx][newy].x = tile.map[l][col][row].x;
					tempmap.map[l][newx][newy].y = tile.map[l][col][row].y;
					tempmap.layers[l].visible = tile.layers[l].visible;
				}
			}
		}
	}
	tile = tempmap;
}

function calcAngle(x,y,x2,y2){
	//var v1 = {x: x, y: y}, v2 = {x: x2, y: y2},
   // angleRad = Math.acos( (v1.x * v2.x + v1.y * v2.y) / ( Math.sqrt(v1.x*v1.x + v1.y*v1.y) * Math.sqrt(v2.x*v2.x + v2.y*v2.y) ) ),
   // angleDeg = angleRad * 180 / Math.PI;

	var p1 = {
	x: x,
	y: y
	};

	var p2 = {
	x: x2,
	y: y2
	};

	// angle in radians
	var angleRadians = Math.atan2(p2.y - p1.y, p2.x - p1.x);

	// angle in degrees
	var angleDeg = Math.atan2(p2.y - p1.y, p2.x - p1.x) * 180 / Math.PI;
	return [angleDeg,angleRadians];
}

function toRadians (angle) {
  return angle * (Math.PI / 180);
}

function calcDistance(x,y,x2,y2){
	return Math.sqrt(Math.pow(x-x2,2)+Math.pow(y-y2,2));
}

function normalize(x,y){
	var len_v = Math.sqrt(x*x + y*y);
	x /= len_v;
	y /= len_v;
	return [x,y];
}
function dotProduct(x,y,x2,y2){
	return (x*x2)+(y*y2);
}

function calcProjection(dp,x,y,unit){
	//takes the vector that gave the dot product and projects onto vector of x,y (one of the two vectors from the dotproduct)
	var px,py;
	if(unit){
		px = dp * x;
		py = dp * y;
	}else{
		px = ( dp / (x*x + y*y) ) * x;
		py = ( dp / (x*x + y*y) ) * y;
	}
	return [px,py];	//this is the new vector
}
function calcNormals(x,y){
	//90 degrees to the right and left of a vector = the normal
	rx = -y;
	ry = x;
	lx = y;
	ly = -x;
	return [rx,ry,lx,ly];
}

function flipImageData(ctx,flipv,fliph){
	var imgData = ctx.getImageData(0,0,ctx.canvas.width,ctx.canvas.height);
	var imgData2 = ctx.createImageData(ctx.canvas.width, ctx.canvas.height);

	var w = imgData.width, h = imgData.height;
	for(var y=0; y<h; y++){
		for(var x=0; x<w; x++){
			var x2=x,y2=y;
			if(flipv==-1)x2 = (w - x)-1;
			if(fliph==-1)y2 = (h - y)-1;

			imgData2.data[(((y2*imgData2.width)+x2)*4)] = imgData.data[(((y*w)+x)*4)];
			imgData2.data[(((y2*imgData2.width)+x2)*4)+1] = imgData.data[(((y*w)+x)*4)+1];
			imgData2.data[(((y2*imgData2.width)+x2)*4)+2] = imgData.data[(((y*w)+x)*4)+2];
			imgData2.data[(((y2*imgData2.width)+x2)*4)+3] = imgData.data[(((y*w)+x)*4)+3];

		}
	}
	return imgData2;
}

function eyedropColor(c){
	if($( "#rgb_hsl_radio label[class*='ui-state-active']" ).attr('for')=='radio1'){
		//var colorvalues = rgbToHsl(mouse.rgb.r,mouse.rgb.g,mouse.rgb.b);
		var colorPickerMode = 'rgb';
		convertSwatch(colorPickerMode,[c.r,c.g,c.b]);
		if(mouse.currentColor==0)mouse.color = 'rgba('+c.r+','+c.g+','+c.b+',1)';
		else mouse.color2 = 'rgba('+c.r+','+c.g+','+c.b+',1)';
	}else{
		var colorvalues = rgbToHsl(c.r,c.g,c.b);
		var colorPickerMode = 'hsl';
		convertSwatch(colorPickerMode,colorvalues);
		if(mouse.currentColor==0)mouse.color = 'rgba('+c.r+','+c.g+','+c.b+',1)';
		else mouse.color2 = 'rgba('+c.r+','+c.g+','+c.b+',1)';
	}

	//if we're using brush at moment, change colorgroup
	if(mouse.tool=="brush" || mouse.tool=="magiceraser"){
		if(currentColorGroup==0){
			colorGroup.forEach(function(entry){
				if(entry.rgb.r==c.r &&
				entry.rgb.g==c.g &&
				entry.rgb.b==c.b){
					getColorGroup(palettecontext,palettecanvas,{x:entry.pos.x,y:entry.pos.y});
					return;
				}
			});
		}else{
			colorGroup2.forEach(function(entry){
				if(entry.rgb.r==c.r &&
				entry.rgb.g==c.g &&
				entry.rgb.b==c.b){
					getColorGroup(palettecontext,palettecanvas,{x:entry.pos.x,y:entry.pos.y});
					return;
				}
			});
		}
	}
}


text:
var url = require("url");
var Assets = require("./lib/assets");

var connectAssets = module.exports = function (options) {
  options = parseOptions(options || {});

  var assets = new Assets(options);
  var compilationComplete = false;
  var compilationError;
  var waiting = [];

  // TODO: environment.registerHelper asset_path?
  options.helperContext.css = assets.helper(tagWriters.css, "css");
  options.helperContext.js = assets.helper(tagWriters.js, "js");
  options.helperContext.assetPath = assets.helper(tagWriters.noop);

  assets.compile(function (err) {
    if (err) { compilationError = err; }
    compilationComplete = true;

    for (var i = 0; i < waiting.length; i++) {
      waiting[i]();
    };
  });

  return function (req, res, next) {
    var path = url.parse(req.url).pathname.replace(/^\//, "");

    if (path.toLowerCase().indexOf(options.servePath.toLowerCase()) === 0) {
      var serve = function (req, res, next) {
        if (compilationError) { next(compilationError); }
        else { assets.serveAsset(req, res, next); }
      };

      if (compilationComplete) { serve(req, res, next); }
      else { waiting.push(serve.bind(this, req, res, next)); }
    }
    else {
      next();
    }
  };
};

var parseOptions = module.exports._parseOptions = function (options) {
  var isProduction = process.env.NODE_ENV === "production";
  var isDevelopment = !isProduction;

  options.paths = arrayify(options.paths || options.src || [ "assets/js", "assets/css" ]);
  options.helperContext = options.helperContext || global;
  options.servePath = (options.servePath || "assets").replace(/^\//, "").replace(/\/$/, "");
  options.precompile = arrayify(options.precompile || ["*.*"]);
  options.build = options.build != null ? options.build : isProduction;
  options.buildDir = options.buildDir != null ? options.buildDir : isDevelopment ? false : "builtAssets";
  options.compile = options.compile != null ? options.compile : true;
  options.compress = options.compress != null ? options.compress : isProduction;

  if (options.buildDir.replace)
    options.buildDir = options.buildDir.replace(/^\//, "").replace(/\/$/, "");

  return options;
};

var arrayify = module.exports._arrayify = function (target) {
  return (target instanceof Array) ? target : [ target ];
};

var tagWriters = {
  css: function (url) { return '<link rel="stylesheet" href="' + url + '" />'; },
  js: function (url) { return '<script src="' + url + '"></script>'; },
  noop: function (url) { return url; }
};


text:
from django.conf import settings as d_settings
from cms.utils.compat import DJANGO_1_6
from cms.utils.compat.dj import is_installed

from .settingmodels import *  # nopyflakes
from .pagemodel import *  # nopyflakes
from .permissionmodels import *  # nopyflakes
from .placeholdermodel import *  # nopyflakes
from .pluginmodel import *  # nopyflakes
from .titlemodels import *  # nopyflakes
from .placeholderpluginmodel import *  # nopyflakes
from .static_placeholder import *  # nopyflakes
from .aliaspluginmodel import *  # nopyflakes
# must be last
from cms import signals as s_import  # nopyflakes

def validate_settings():
    if "django.core.context_processors.request" not in d_settings.TEMPLATE_CONTEXT_PROCESSORS:
        raise ImproperlyConfigured('django-cms needs django.core.context_processors.request in settings.TEMPLATE_CONTEXT_PROCESSORS to work correctly.')
    if not is_installed('mptt'):
        raise ImproperlyConfigured('django-cms needs django-mptt installed.')
    if 'cms.middleware.multilingual.MultilingualURLMiddleware' in d_settings.MIDDLEWARE_CLASSES and 'django.middleware.locale.LocaleMiddleware' in d_settings.MIDDLEWARE_CLASSES:
        raise ImproperlyConfigured('django-cms MultilingualURLMiddleware replaces django.middleware.locale.LocaleMiddleware! Please remove django.middleware.locale.LocaleMiddleware from your MIDDLEWARE_CLASSES settings.')

def validate_dependencies():
    # check for right version of reversions
    if is_installed('reversion'):
        from reversion.admin import VersionAdmin
        if not hasattr(VersionAdmin, 'get_urls'):
            raise ImproperlyConfigured('django-cms requires never version of reversion (VersionAdmin must contain get_urls method)')

if DJANGO_1_6:
    validate_dependencies()
    validate_settings()


text:
<!DOCTYPE html>

  <title>CSS 2.1 Test Suite: :first-letter</title>
  <link rel="author" title="Boris Zbarsky" href="mailto:bzbarsky@mit.edu" />
  <link rel="author" title="Mozilla Corporation" href="http://mozilla.com/" />
  <link rel="help" href="http://www.w3.org/TR/CSS21/selector.html#first-letter"/>
  <meta name="flags" content="" />

This is text


text:
package org.cagrid.caobr.service.globus;

import org.cagrid.caobr.service.CaObrImpl;

import java.rmi.RemoteException;

/**
 * DO NOT EDIT:  This class is autogenerated!
 *
 * This class implements each method in the portType of the service.  Each method call represented
 * in the port type will be then mapped into the unwrapped implementation which the user provides
 * in the CaObrImpl class.  This class handles the boxing and unboxing of each method call
 * so that it can be correclty mapped in the unboxed interface that the developer has designed and
 * has implemented.  Authorization callbacks are automatically made for each method based
 * on each methods authorization requirements.
 *
 * @created by Introduce Toolkit version 1.3
 *
 */
public class CaObrProviderImpl{

	CaObrImpl impl;

	public CaObrProviderImpl() throws RemoteException {
		impl = new CaObrImpl();
	}

    public org.cagrid.caobr.stubs.GetAllAnnotationsResponse getAllAnnotations(org.cagrid.caobr.stubs.GetAllAnnotationsRequest params) throws RemoteException {
    org.cagrid.caobr.stubs.GetAllAnnotationsResponse boxedResult = new org.cagrid.caobr.stubs.GetAllAnnotationsResponse();
    boxedResult.setAnnotation(impl.getAllAnnotations(params.getToken()));
    return boxedResult;
  }

    public org.cagrid.caobr.stubs.GetAllConceptsResponse getAllConcepts(org.cagrid.caobr.stubs.GetAllConceptsRequest params) throws RemoteException {
    org.cagrid.caobr.stubs.GetAllConceptsResponse boxedResult = new org.cagrid.caobr.stubs.GetAllConceptsResponse();
    boxedResult.setConcept(impl.getAllConcepts(params.getConceptName()));
    return boxedResult;
  }

    public org.cagrid.caobr.stubs.GetAllOntologiesResponse getAllOntologies(org.cagrid.caobr.stubs.GetAllOntologiesRequest params) throws RemoteException {
    org.cagrid.caobr.stubs.GetAllOntologiesResponse boxedResult = new org.cagrid.caobr.stubs.GetAllOntologiesResponse();
    boxedResult.setOntology(impl.getAllOntologies());
    return boxedResult;
  }

    public org.cagrid.caobr.stubs.GetAllResourcesResponse getAllResources(org.cagrid.caobr.stubs.GetAllResourcesRequest params) throws RemoteException {
    org.cagrid.caobr.stubs.GetAllResourcesResponse boxedResult = new org.cagrid.caobr.stubs.GetAllResourcesResponse();
    boxedResult.setResource(impl.getAllResources());
    return boxedResult;
  }

    public org.cagrid.caobr.stubs.GetAnnotationsResponse getAnnotations(org.cagrid.caobr.stubs.GetAnnotationsRequest params) throws RemoteException {
    org.cagrid.caobr.stubs.GetAnnotationsResponse boxedResult = new org.cagrid.caobr.stubs.GetAnnotationsResponse();
    boxedResult.setAnnotation(impl.getAnnotations(params.getFromOntologies().getOntology(),params.getFromResources().getResource(),params.getToken()));
    return boxedResult;
  }

    public org.cagrid.caobr.stubs.GetConceptsResponse getConcepts(org.cagrid.caobr.stubs.GetConceptsRequest params) throws RemoteException {
    org.cagrid.caobr.stubs.GetConceptsResponse boxedResult = new org.cagrid.caobr.stubs.GetConceptsResponse();
    boxedResult.setConcept(impl.getConcepts(params.getFromOntologies().getOntology(),params.getConceptName()));
    return boxedResult;
  }

    public org.cagrid.caobr.stubs.IsConceptResponse isConcept(org.cagrid.caobr.stubs.IsConceptRequest params) throws RemoteException {
    org.cagrid.caobr.stubs.IsConceptResponse boxedResult = new org.cagrid.caobr.stubs.IsConceptResponse();
    boxedResult.setResponse(impl.isConcept(params.getFromOntologies().getOntology(),params.getSearchTerm()));
    return boxedResult;
  }

    public org.cagrid.caobr.stubs.IsConceptInAnyOntologyResponse isConceptInAnyOntology(org.cagrid.caobr.stubs.IsConceptInAnyOntologyRequest params) throws RemoteException {
    org.cagrid.caobr.stubs.IsConceptInAnyOntologyResponse boxedResult = new org.cagrid.caobr.stubs.IsConceptInAnyOntologyResponse();
    boxedResult.setResponse(impl.isConceptInAnyOntology(params.getSearchTerm()));
    return boxedResult;
  }

    public org.cagrid.caobr.stubs.IsConceptsResponse isConcepts(org.cagrid.caobr.stubs.IsConceptsRequest params) throws RemoteException {
    org.cagrid.caobr.stubs.IsConceptsResponse boxedResult = new org.cagrid.caobr.stubs.IsConceptsResponse();
    boxedResult.setResponse(impl.isConcepts(params.getTokens(),params.getOntologies().getOntology()));
    return boxedResult;
  }

    public org.cagrid.caobr.stubs.IsConceptsInAnyOntologyResponse isConceptsInAnyOntology(org.cagrid.caobr.stubs.IsConceptsInAnyOntologyRequest params) throws RemoteException {
    org.cagrid.caobr.stubs.IsConceptsInAnyOntologyResponse boxedResult = new org.cagrid.caobr.stubs.IsConceptsInAnyOntologyResponse();
    boxedResult.setResponse(impl.isConceptsInAnyOntology(params.getTokens()));
    return boxedResult;
  }

}


text:
package com.dup.test.etcd.jetcd;

import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Map;

import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.common.base.Charsets;
import com.google.common.base.Preconditions;
import com.google.common.base.Strings;
import com.google.common.collect.ImmutableMap;
import com.google.common.io.CharStreams;

import retrofit.ErrorHandler;
import retrofit.RestAdapter;
import retrofit.RetrofitError;
import retrofit.converter.JacksonConverter;

final class EtcdClientImpl implements EtcdClient {
  private static final ObjectMapper objectMapper = new ObjectMapper()
    .configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
  private final EtcdApi etcd;

  EtcdClientImpl(final String server) {
    RestAdapter restAdapter = new RestAdapter.Builder()
      .setConverter(new JacksonConverter(objectMapper))
      .setEndpoint(server)
      .setErrorHandler(new EtcdErrorHandler())
      .build();
    etcd = restAdapter.create(EtcdApi.class);
  }

  @Override
  public String version() throws EtcdException {
    try (InputStreamReader reader = new InputStreamReader(
        etcd.version().getBody().in(), Charsets.UTF_8)) {
      return CharStreams.toString(reader);
    } catch (IOException e) {
      return "ERROR: " + e.getMessage();
    }
  }

  @Override
  public String get(final String key) throws EtcdException {
    Preconditions.checkArgument(!Strings.isNullOrEmpty(key));
    return etcd.get(key).getNode().getValue();
  }

  @Override
  public void set(final String key, final String value) throws EtcdException {
    Preconditions.checkArgument(!Strings.isNullOrEmpty(key));
    Preconditions.checkArgument(!Strings.isNullOrEmpty(value));
    etcd.set(key, value, null, null, null);
  }

  @Override
  public void set(final String key, final String value, final int ttl)
      throws EtcdException {
    Preconditions.checkArgument(!Strings.isNullOrEmpty(key));
    Preconditions.checkArgument(!Strings.isNullOrEmpty(value));
    Preconditions.checkArgument(ttl > 0);
    etcd.set(key, value, ttl, null, null);
  }

  @Override
  public void delete(final String key) throws EtcdException {
    Preconditions.checkArgument(!Strings.isNullOrEmpty(key));
    etcd.delete(key);
  }

  @Override
  public Map<String, String> list(final String path) throws EtcdException {
    Preconditions.checkArgument(!Strings.isNullOrEmpty(path));
    ImmutableMap.Builder<String, String> builder = ImmutableMap.builder();
    for (EtcdResponse.Node node : etcd.get(path).getNode().getNodes()) {
      builder.put(node.getKey(), node.getValue());
    }
    return builder.build();
  }

  @Override
  public void compareAndSwap(final String key, final String oldValue,
                             final String newValue) throws EtcdException {
    Preconditions.checkArgument(!Strings.isNullOrEmpty(key));
    Preconditions.checkArgument(!Strings.isNullOrEmpty(oldValue));
    Preconditions.checkArgument(!Strings.isNullOrEmpty(newValue));
    Preconditions.checkArgument(!oldValue.equals(newValue));

    EtcdResponse response = etcd.set(key, newValue, null, null, oldValue);
    response.getNode().getValue();
  }

  private static final class EtcdErrorHandler implements ErrorHandler {
    @Override
    public Throwable handleError(final RetrofitError cause) {
        if (cause.getResponse() == null) {
            return cause;
        }
        return (EtcdException) cause.getBodyAs(EtcdException.class);
    }
  }
}


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>CompilationException (Play! API)</title>
<meta name="date" content="2015-12-14">
<link rel="stylesheet" type="text/css" href="../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Skip navigation links

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

play.exceptions

Class CompilationException

java.lang.Object

java.lang.Throwable

java.lang.Exception

java.lang.RuntimeException

play.exceptions.PlayException

play.exceptions.CompilationException

All Implemented Interfaces:

java.io.Serializable, SourceAttachment

public class CompilationException
extends PlayException
implements SourceAttachment

A java compilation error

See Also:

Serialized Form

Constructor Summary

Constructors

Constructor and Description

CompilationException(java.lang.String problem)

CompilationException(VirtualFile source,
                    java.lang.String problem,
                    int line,
                    int start,
                    int end)

Method Summary

All Methods Instance Methods Concrete Methods

Modifier and Type
Method and Description

java.lang.String
getErrorDescription()

java.lang.String
getErrorTitle()

java.lang.Integer
getLineNumber()

java.lang.String
getMessage()

java.util.List<java.lang.String>
getSource()

java.lang.Integer
getSourceEnd()

java.lang.String
getSourceFile()

java.lang.Integer
getSourceStart()

boolean
isSourceAvailable()

Methods inherited from class play.exceptions.PlayException

getId, getInterestingStrackTraceElement, getMoreHTML

Methods inherited from class java.lang.Throwable

addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString

Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

Constructor Detail

CompilationException

public CompilationException(java.lang.String problem)

CompilationException

public CompilationException(VirtualFile source,
                            java.lang.String problem,
                            int line,
                            int start,
                            int end)

Method Detail

getErrorTitle

public java.lang.String getErrorTitle()

Specified by:

getErrorTitle in class PlayException

getErrorDescription

public java.lang.String getErrorDescription()

Specified by:

getErrorDescription in class PlayException

getMessage

public java.lang.String getMessage()

Overrides:

getMessage in class java.lang.Throwable

getSource

public java.util.List<java.lang.String> getSource()

Specified by:

getSource in interface SourceAttachment

getLineNumber

public java.lang.Integer getLineNumber()

Specified by:

getLineNumber in interface SourceAttachment

Overrides:

getLineNumber in class PlayException

getSourceFile

public java.lang.String getSourceFile()

Specified by:

getSourceFile in interface SourceAttachment

Overrides:

getSourceFile in class PlayException

getSourceStart

public java.lang.Integer getSourceStart()

getSourceEnd

public java.lang.Integer getSourceEnd()

isSourceAvailable

public boolean isSourceAvailable()

Overrides:

isSourceAvailable in class PlayException

Skip navigation links

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

Guillaume Bort & zenexity - Distributed under Apache 2 licence, without any warrantly


text:
import denormalizeFlagName from './denormalize-flag-name';

describe('with camel case', () => {
  it('should camel case to uppercased flag names', () => {
    expect(denormalizeFlagName('aFlag')).toEqual('a-flag');
  });
});


text:
#include <linux/poll.h>
#include <linux/sched.h>
#include <linux/slab.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/fs.h>
#include <linux/miscdevice.h>
#include <linux/input/mt.h>
#include <linux/platform_device.h>
#include <linux/regulator/consumer.h>
#include <uapi/linux/hbtp_input.h>
#include "../input-compat.h"

#if defined(CONFIG_FB)
#include <linux/notifier.h>
#include <linux/fb.h>
#endif

#define HBTP_INPUT_NAME			"hbtp_input"

struct hbtp_data {
	struct platform_device *pdev;
	struct input_dev *input_dev;
	s32 count;
	struct mutex mutex;
	bool touch_status[HBTP_MAX_FINGER];
#if defined(CONFIG_FB)
	struct notifier_block fb_notif;
#endif
	struct regulator *vcc_ana;
	int afe_load_ua;
	int afe_vtg_min_uv;
	int afe_vtg_max_uv;
	bool manage_afe_power;
};

static struct hbtp_data *hbtp;

#if defined(CONFIG_FB)
static int fb_notifier_callback(struct notifier_block *self,
				 unsigned long event, void *data)
{
	int blank;
	struct fb_event *evdata = data;
	struct hbtp_data *hbtp_data =
		container_of(self, struct hbtp_data, fb_notif);

	if (evdata && evdata->data && event == FB_EVENT_BLANK &&
		hbtp_data && hbtp_data->input_dev) {
		blank = *(int *)(evdata->data);
		if (blank == FB_BLANK_UNBLANK)
			kobject_uevent(&hbtp_data->input_dev->dev.kobj,
					KOBJ_ONLINE);
		else if (blank == FB_BLANK_POWERDOWN)
			kobject_uevent(&hbtp_data->input_dev->dev.kobj,
					KOBJ_OFFLINE);
	}

	return 0;
}
#endif

static int hbtp_input_open(struct inode *inode, struct file *file)
{
	mutex_lock(&hbtp->mutex);
	if (hbtp->count) {
		pr_err("%s is busy\n", HBTP_INPUT_NAME);
		mutex_unlock(&hbtp->mutex);
		return -EBUSY;
	}
	hbtp->count++;
	mutex_unlock(&hbtp->mutex);

	return 0;
}

static int hbtp_input_release(struct inode *inode, struct file *file)
{
	mutex_lock(&hbtp->mutex);
	if (!hbtp->count) {
		pr_err("%s wasn't opened\n", HBTP_INPUT_NAME);
		mutex_unlock(&hbtp->mutex);
		return -ENOTTY;
	}
	hbtp->count--;
	mutex_unlock(&hbtp->mutex);

	return 0;
}

static int hbtp_input_create_input_dev(struct hbtp_input_absinfo *absinfo)
{
	struct input_dev *input_dev;
	struct hbtp_input_absinfo *abs;
	int error;
	int i;

	input_dev = input_allocate_device();
	if (!input_dev) {
		pr_err("%s: input_allocate_device failed\n", __func__);
		return -ENOMEM;
	}

	kfree(input_dev->name);
	input_dev->name = kstrndup(HBTP_INPUT_NAME, sizeof(HBTP_INPUT_NAME),
					GFP_KERNEL);
	__set_bit(EV_ABS, input_dev->evbit);
	__set_bit(EV_KEY, input_dev->evbit);
	__set_bit(BTN_TOUCH, input_dev->keybit);
	__set_bit(INPUT_PROP_DIRECT, input_dev->propbit);

	for (i = KEY_ESC; i <= KEY_MICMUTE; i++)
		__set_bit(i, input_dev->keybit);

	/* For multi touch */
	input_mt_init_slots(input_dev, HBTP_MAX_FINGER, 0);
	for (i = 0; i <= ABS_MT_LAST - ABS_MT_FIRST; i++) {
		abs = absinfo + i;
		if (abs->active)
			input_set_abs_params(input_dev, abs->code,
					abs->minimum, abs->maximum, 0, 0);
	}

	error = input_register_device(input_dev);
	if (error) {
		pr_err("%s: input_register_device failed\n", __func__);
		goto err_input_reg_dev;
	}

	hbtp->input_dev = input_dev;
	return 0;

err_input_reg_dev:
	input_free_device(input_dev);

	return error;
}

static int hbtp_input_report_events(struct hbtp_data *hbtp_data,
				struct hbtp_input_mt *mt_data)
{
	int i;
	struct hbtp_input_touch *tch;

	for (i = 0; i < HBTP_MAX_FINGER; i++) {
		tch = &(mt_data->touches[i]);
		if (tch->active || hbtp_data->touch_status[i]) {
			input_mt_slot(hbtp_data->input_dev, i);
			input_mt_report_slot_state(hbtp_data->input_dev,
					MT_TOOL_FINGER, tch->active);

			if (tch->active) {
				input_report_abs(hbtp_data->input_dev,
						ABS_MT_TOOL_TYPE,
						tch->tool);
				input_report_abs(hbtp_data->input_dev,
						ABS_MT_TOUCH_MAJOR,
						tch->major);
				input_report_abs(hbtp_data->input_dev,
						ABS_MT_TOUCH_MINOR,
						tch->minor);
				input_report_abs(hbtp_data->input_dev,
						ABS_MT_ORIENTATION,
						tch->orientation);
				input_report_abs(hbtp_data->input_dev,
						ABS_MT_PRESSURE,
						tch->pressure);
				input_report_abs(hbtp_data->input_dev,
						ABS_MT_POSITION_X,
						tch->x);
				input_report_abs(hbtp_data->input_dev,
						ABS_MT_POSITION_Y,
						tch->y);
			}
			hbtp_data->touch_status[i] = tch->active;
		}
	}

	input_report_key(hbtp->input_dev, BTN_TOUCH, mt_data->num_touches > 0);
	input_sync(hbtp->input_dev);

	return 0;
}

static int reg_set_optimum_mode_check(struct regulator *reg, int load_uA)
{
	return (regulator_count_voltages(reg) > 0) ?
		regulator_set_optimum_mode(reg, load_uA) : 0;
}

static int hbtp_pdev_power_on(struct hbtp_data *hbtp, bool on)
{
	int ret, error;

	if (!hbtp->vcc_ana) {
		pr_err("%s: regulator is not available\n", __func__);
		return -EINVAL;
	}

	if (!on)
		goto reg_off;

	ret = reg_set_optimum_mode_check(hbtp->vcc_ana, hbtp->afe_load_ua);
	if (ret < 0) {
		pr_err("%s: Regulator vcc_ana set_opt failed rc=%d\n",
			__func__, ret);
		return -EINVAL;
	}

	ret = regulator_enable(hbtp->vcc_ana);
	if (ret) {
		pr_err("%s: Regulator vcc_ana enable failed rc=%d\n",
			__func__, ret);
		error = -EINVAL;
		goto error_reg_en_vcc_ana;
	}

	return 0;

error_reg_en_vcc_ana:
	reg_set_optimum_mode_check(hbtp->vcc_ana, 0);
	return error;

reg_off:
	reg_set_optimum_mode_check(hbtp->vcc_ana, 0);
	regulator_disable(hbtp->vcc_ana);
	return 0;
}

static long hbtp_input_ioctl_handler(struct file *file, unsigned int cmd,
				 unsigned long arg, void __user *p)
{
	int error;
	struct hbtp_input_mt mt_data;
	struct hbtp_input_absinfo absinfo[ABS_MT_LAST - ABS_MT_FIRST + 1];
	struct hbtp_input_key key_data;
	enum hbtp_afe_power_cmd power_cmd;

	switch (cmd) {
	case HBTP_SET_ABSPARAM:
		if (hbtp && hbtp->input_dev) {
			pr_err("%s: The input device is already created\n",
				__func__);
			return 0;
		}

		if (copy_from_user(absinfo, (void *)arg,
					sizeof(struct hbtp_input_absinfo) *
					(ABS_MT_LAST - ABS_MT_FIRST + 1))) {
			pr_err("%s: Error copying data for ABS param\n",
				__func__);
			return -EFAULT;
		}

		error = hbtp_input_create_input_dev(absinfo);
		if (error)
			pr_err("%s, hbtp_input_create_input_dev failed (%d)\n",
				__func__, error);
		break;

	case HBTP_SET_TOUCHDATA:
		if (!hbtp || !hbtp->input_dev) {
			pr_err("%s: The input device hasn't been created\n",
				__func__);
			return -EFAULT;
		}

		if (copy_from_user(&mt_data, (void *)arg,
					sizeof(struct hbtp_input_mt))) {
			pr_err("%s: Error copying data\n", __func__);
			return -EFAULT;
		}

		hbtp_input_report_events(hbtp, &mt_data);
		error = 0;
		break;

	case HBTP_SET_POWERSTATE:
		if (!hbtp || !hbtp->input_dev) {
			pr_err("%s: The input device hasn't been created\n",
				__func__);
			return -EFAULT;
		}

		if (copy_from_user(&power_cmd, (void *)arg,
					sizeof(enum hbtp_afe_power_cmd))) {
			pr_err("%s: Error copying data\n", __func__);
			return -EFAULT;
		}

		switch (power_cmd) {
		case HBTP_AFE_POWER_ON:
			error = hbtp_pdev_power_on(hbtp, true);
			if (error)
				pr_err("%s: failed to power on\n", __func__);
			break;
		case HBTP_AFE_POWER_OFF:
			error = hbtp_pdev_power_on(hbtp, false);
			if (error)
				pr_err("%s: failed to power off\n", __func__);
			break;
		default:
			pr_err("%s: Unsupported command for power state, %d\n",
				__func__, power_cmd);
			return -EINVAL;
		}
		break;

	case HBTP_SET_KEYDATA:
		if (!hbtp || !hbtp->input_dev) {
			pr_err("%s: The input device hasn't been created\n",
				__func__);
			return -EFAULT;
		}

		if (copy_from_user(&key_data, (void *)arg,
					sizeof(struct hbtp_input_key))) {
			pr_err("%s: Error copying data for key info\n",
				__func__);
			return -EFAULT;
		}

		input_report_key(hbtp->input_dev, key_data.code,
				key_data.value);
		input_sync(hbtp->input_dev);
		break;

	default:
		pr_err("%s: Unsupported ioctl command %u\n", __func__, cmd);
		error = -EINVAL;
		break;
	}

	return error;
}

static long hbtp_input_ioctl(struct file *file, unsigned int cmd,
				unsigned long arg)
{
	return hbtp_input_ioctl_handler(file, cmd, arg, (void __user *)arg);
}

#ifdef CONFIG_COMPAT
static long hbtp_input_compat_ioctl(struct file *file, unsigned int cmd,
					unsigned long arg)
{
	return hbtp_input_ioctl_handler(file, cmd, arg, compat_ptr(arg));
}
#endif

static const struct file_operations hbtp_input_fops = {
	.owner		= THIS_MODULE,
	.open		= hbtp_input_open,
	.release	= hbtp_input_release,
	.unlocked_ioctl	= hbtp_input_ioctl,
#ifdef CONFIG_COMPAT
	.compat_ioctl	= hbtp_input_compat_ioctl,
#endif
};

static struct miscdevice hbtp_input_misc = {
	.fops		= &hbtp_input_fops,
	.minor		= MISC_DYNAMIC_MINOR,
	.name		= HBTP_INPUT_NAME,
};
MODULE_ALIAS_MISCDEV(MISC_DYNAMIC_MINOR);
MODULE_ALIAS("devname:" HBTP_INPUT_NAME);

#ifdef CONFIG_OF
static int hbtp_parse_dt(struct device *dev)
{
	int rc;
	struct device_node *np = dev->of_node;
	u32 temp_val;

	if (of_find_property(np, "vcc_ana-supply", NULL)) {
		hbtp->manage_afe_power = true;

		rc = of_property_read_u32(np, "qcom,afe-load", &temp_val);
		if (!rc) {
			hbtp->afe_load_ua = (int) temp_val;
		} else {
			dev_err(dev, "Unable to read AFE load\n");
			return rc;
		}

		rc = of_property_read_u32(np, "qcom,afe-vtg-min", &temp_val);
		if (!rc) {
			hbtp->afe_vtg_min_uv = (int) temp_val;
		} else {
			dev_err(dev, "Unable to read AFE min voltage\n");
			return rc;
		}

		rc = of_property_read_u32(np, "qcom,afe-vtg-max", &temp_val);
		if (!rc) {
			hbtp->afe_vtg_max_uv = (int) temp_val;
		} else {
			dev_err(dev, "Unable to read AFE max voltage\n");
			return rc;
		}
	}

	return 0;
}
#else
static int hbtp_parse_dt(struct device *dev)
{
	return -ENODEV;
}
#endif

static int hbtp_pdev_probe(struct platform_device *pdev)
{
	int error, ret;
	struct regulator *vcc_ana;

	if (pdev->dev.of_node) {
		error = hbtp_parse_dt(&pdev->dev);
		if (error) {
			pr_err("%s: parse dt failed, rc=%d\n", __func__, error);
			return error;
		}
	}

	if (hbtp->manage_afe_power) {
		vcc_ana = regulator_get(&pdev->dev, "vcc_ana");
		if (IS_ERR(vcc_ana)) {
			ret = PTR_ERR(vcc_ana);
			pr_err("%s: regulator get failed vcc_ana rc=%d\n",
				__func__, ret);
			return -EINVAL;
		}

		if (regulator_count_voltages(vcc_ana) > 0) {
			ret = regulator_set_voltage(vcc_ana,
				hbtp->afe_vtg_min_uv, hbtp->afe_vtg_max_uv);
			if (ret) {
				pr_err("%s: regulator set vtg failed rc=%d\n",
					__func__, ret);
				error = -EINVAL;
				goto error_set_vtg_vcc_ana;
			}
		}
		hbtp->vcc_ana = vcc_ana;
	}

	hbtp->pdev = pdev;

	return 0;

error_set_vtg_vcc_ana:
	regulator_put(vcc_ana);

	return error;
};

static int hbtp_pdev_remove(struct platform_device *pdev)
{
	if (hbtp->vcc_ana) {
		hbtp_pdev_power_on(hbtp, false);
		regulator_put(hbtp->vcc_ana);
	}

	return 0;
}

#ifdef CONFIG_OF
static struct of_device_id hbtp_match_table[] = {
	{ .compatible = "qcom,hbtp-input",},
	{ },
};
#else
#define hbtp_match_table NULL
#endif

static struct platform_driver hbtp_pdev_driver = {
	.probe		= hbtp_pdev_probe,
	.remove		= hbtp_pdev_remove,
	.driver		= {
		.name		= "hbtp",
		.owner		= THIS_MODULE,
		.of_match_table = hbtp_match_table,
	},
};

static int __init hbtp_init(void)
{
	int error;

	hbtp = kzalloc(sizeof(struct hbtp_data), GFP_KERNEL);
	if (!hbtp)
		return -ENOMEM;

	mutex_init(&hbtp->mutex);

	error = misc_register(&hbtp_input_misc);
	if (error) {
		pr_err("%s: misc_register failed\n", HBTP_INPUT_NAME);
		goto err_misc_reg;
	}

#if defined(CONFIG_FB)
	hbtp->fb_notif.notifier_call = fb_notifier_callback;
	error = fb_register_client(&hbtp->fb_notif);
	if (error) {
		pr_err("%s: Unable to register fb_notifier: %d\n",
			HBTP_INPUT_NAME, error);
		goto err_fb_reg;
	}
#endif

	error = platform_driver_register(&hbtp_pdev_driver);
	if (error) {
		pr_err("Failed to register platform driver: %d\n", error);
		goto err_platform_drv_reg;
	}

	return 0;

err_platform_drv_reg:
#if defined(CONFIG_FB)
	fb_unregister_client(&hbtp->fb_notif);
err_fb_reg:
#endif
	misc_deregister(&hbtp_input_misc);
err_misc_reg:
	kfree(hbtp);

	return error;
}

static void __exit hbtp_exit(void)
{
	misc_deregister(&hbtp_input_misc);
	if (hbtp->input_dev)
		input_unregister_device(hbtp->input_dev);

#if defined(CONFIG_FB)
	fb_unregister_client(&hbtp->fb_notif);
#endif

	platform_driver_unregister(&hbtp_pdev_driver);

	kfree(hbtp);
}

MODULE_DESCRIPTION("Kernel driver to support host based touch processing");
MODULE_LICENSE("GPLv2");

module_init(hbtp_init);
module_exit(hbtp_exit);


text:
<!DOCTYPE html>

    <title>ArcGIS Basemap</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">

    <link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7.2/leaflet.css" />

    <link rel="stylesheet" href="demo.css" />


text:
(function() {
  'use strict';

  angular
    .module('kueJobs')
    .provider('JobsManager', JobsManager);

  // JobsManager.$inject = ['$resource', '$q', 'Job'];

  function JobsManager() {
    var autoRefreshInterval = 60000;

    this.setAutoRefreshInterval = function(value) {
      autoRefreshInterval = value;
    };
    this.$get = function($resource, $q, $interval, Job) {
      var resources = $resource('api/kue/job/:jobId', {
        jobId: '@_id',
      }, {
        searchJobs: {
          url: 'api/kue/job/search?q=:searchText',
          method: 'GET',
          isArray: true
        },
        getJobs: {
          url: 'api/kue/jobs/:type/:state/:from..:to/:order?',
          method: 'GET',
          isArray: true,
          params: {
            from: 0,
            to: 9,
            order: 'desc'
          }
        },
        getAllJobsByJobType: {
          url: 'api/jobs/kue/:type/:from..:to',
          method: 'GET',
          isArray: true,
          params: {
            from: 0,
            to: 9
          }
        },
        getStats: {
          url: 'api/kue/stats',
          method: 'GET'
        },
        getStatsByJobType: {
          url: 'api/jobs/kue/:type/stats',
          method: 'GET'
        },
        getTypes: {
          url: 'api/kue/job/types',
          method: 'GET',
          isArray: true
        },
        start: {
          url: 'api/jobs/start',
          method: 'GET'
        },
        shutDown: {
          url: 'api/jobs/shutdown',
          method: 'GET'
        },
        getProcessStatus: {
          url: 'api/jobs/status',
          method: 'GET'
        }
      });
      var jobsManager = {
        _pool: {},
        _retrieveInstance: function(jobId, jobData) {
          var instance = this._pool[jobId];

          if (instance) {
            instance.setData(jobData);
          } else {
            instance = new Job(jobData);
            this._pool[jobId] = instance;
          }

          return instance;
        },
        _removeInstance: function(jobId) {
          var instance = this._pool[jobId];

          if (instance) {
            delete this._pool[jobId];
          }

          return instance;
        },
        _search: function(jobId) {
          return this._pool[jobId];
        },
        _load: function(jobId, deferred) {
          var self = this;
          resources.get({ jobId: jobId }, function(result) {
            if (result && result.id) {
              var job = self._retrieveInstance(jobId, result);
              deferred.resolve(job);
            } else {
              var errorMessage = result.error || 'Job "' + jobId + '" doesn\'t exist';
              deferred.reject(errorMessage); // TODO: Handle error response
            }
          });
        },
        /* Public Methods */
        /* Use this function in order to get a job instance by it's id */
        getJob: function(jobId) {
          var deferred = $q.defer();
          var job = this._search(jobId);
          if (job) {
            deferred.resolve(job);
          } else {
            this._load(jobId, deferred);
          }
          return deferred.promise;
        },
        refreshJob: function(jobId) {
          var deferred = $q.defer();
          this._load(jobId, deferred);
          return deferred.promise;
        },
        createJob: function(jobData) {
          var deferred = $q.defer();
          var self = this;
          resources.save(null, jobData, function(result) {
            if (result && result.id) {
              var jobId = result.id;
              self.getJob(jobId).then(function(job) {
                deferred.resolve(job);
              });
            } else {
              deferred.reject({}); // TODO: Handle error response
            }
          });
          return deferred.promise;
        },
        deleteJob: function(jobId) {
          var deferred = $q.defer();
          var self = this;
          resources.delete({ jobId: jobId }, function(result) {
            if (result && result.message) {
              self._removeInstance(jobId);
              deferred.resolve(result.message);
            } else {
              var errorMessage = result.error || 'Failed to delete job';
              deferred.reject(errorMessage); // TODO: Handle error response
            }
          });
          return deferred.promise;
        },
        /* Use this function in order to get instances of all the jobs */
        loadJobs: function(params) {
          var deferred = $q.defer();
          var self = this;
          if (params.type && !params.state) {
            resources.getAllJobsByJobType(params, function(result) {
              if (result && !result.error) {
                var jobs = [];
                result.forEach(function(jobData) {
                  var jobId = jobData.id;
                  var job = self._retrieveInstance(jobId, jobData);
                  jobs.push(job);
                });
                deferred.resolve(jobs);
              } else {
                var errorMessage = result.error || 'Failed to fetch jobs';
                deferred.reject(errorMessage); // TODO: Handle error response
              }
            });
          } else {
            resources.getJobs(params, function(result) {
              if (result && !result.error) {
                var jobs = [];
                result.forEach(function(jobData) {
                  var jobId = jobData.id;
                  var job = self._retrieveInstance(jobId, jobData);
                  jobs.push(job);
                });
                deferred.resolve(jobs);
              } else {
                var errorMessage = result.error || 'Failed to fetch jobs';
                deferred.reject(errorMessage); // TODO: Handle error response
              }
            });
          }
          return deferred.promise;
        },
        searchJobs: function(searchText) {
          var deferred = $q.defer();
          var self = this;
          var params = {
            searchText: searchText
          };
          resources.searchJobs(params, function(result) {
            if (result && !result.error) {
              var promises = [];
              result.forEach(function(jobId) {
                promises.push(self.getJob(jobId));
              });
              $q.all(promises).then(function(res) {
                deferred.resolve(res);
              });
            } else {
              var errorMessage = result.error || 'Failed to fetch jobs';
              deferred.reject(errorMessage); // TODO: Handle error response
            }
          });
          return deferred.promise;
        },
        getTypes: function() {
          var deferred = $q.defer();
          resources.getTypes({}, function(result) {
            if (result && !result.error) {
              deferred.resolve(result);
            } else {
              var errorMessage = result.error || 'Failed to delete job';
              deferred.reject(errorMessage); // TODO: Handle error response
            }
          });
          return deferred.promise;
        },
        getStats: function(jobType) {
          var deferred = $q.defer();
          if (jobType) {
            resources.getStatsByJobType({
              type: jobType
            }, function(result) {
              if (result && !result.error) {
                var stats = {};
                for (var stat in result) {
                  if (Job.states.indexOf(stat) > -1) {
                    stats[stat] = result[stat];
                  }
                }
                deferred.resolve(stats);
              } else {
                var errorMessage = result.error || 'Failed to delete job';
                deferred.reject(errorMessage); // TODO: Handle error response
              }
            });
          } else {
            resources.getStats({}, function(result) {
              if (result && !result.error) {
                var stats = {};
                for (var key in result) {
                  if (result.hasOwnProperty(key) && key.indexOf('Count') > -1) {
                    var label = key.substring(0, key.indexOf('Count'));
                    var count = result[key];
                    stats[label] = count;
                  }
                }
                deferred.resolve(stats);
              } else {
                var errorMessage = result.error || 'Failed to delete job';
                deferred.reject(errorMessage); // TODO: Handle error response
              }
            });
          }
          return deferred.promise;
        },
        startAllJobs: function() {
          var deferred = $q.defer();
          resources.start({}, function(result) {
            if (result && !result.error) {
              deferred.resolve(result.message);
            } else {
              var errorMessage = result.error || 'Failed to delete job';
              deferred.reject(errorMessage); // TODO: Handle error response
            }
          });
          return deferred.promise;
        },
        stopAllJobs: function() {
          var deferred = $q.defer();
          resources.shutDown({}, function(result) {
            if (result && !result.error) {
              deferred.resolve(result.message);
            } else {
              var errorMessage = result.error || 'Failed to delete job';
              deferred.reject(errorMessage); // TODO: Handle error response
            }
          });
          return deferred.promise;
        },
        isJobProcessRunning: function() {
          var deferred = $q.defer();
          resources.getProcessStatus({}, function(result) {
            deferred.resolve(result.status === 'running');
          });
          return deferred.promise;
        }
      };
      return jobsManager;
    };
  }
})();


text:
module ExercismWeb
  module Routes
    class Inbox < Core
      get '/inbox' do
        please_login

        session[:inbox] ||= ACL.select('DISTINCT language').where(user_id: current_user.id).order(:language).map(&:language).first
        redirect ['', 'tracks', session[:inbox], 'exercises', session[:inbox_slug]].compact.join('/')
      end
    end
  end
end


text:
package com.qlfg.miningcircle.lock;

import com.example.miningcircle.R;
import com.qlfg.miningcircle.activity.BaseActivity;
import com.qlfg.miningcircle.application.MiningCircleApplication;
import com.qlfg.miningcircle.lock.LocusPassWordView.OnCompleteListener;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.view.View.OnClickListener;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;

public class ModifiFuturePswActivity extends BaseActivity {

	private Toast toast;
	private LocusPassWordView lpwv;
	private String password;
	private boolean needverify = false;
	private boolean agin ;
	private ImageView leftImage;
	private ImageView titleImage;
	private ImageView rightImage;
	private TextView titleName;
	private void showToast(CharSequence message) {
		if (null == toast) {
			toast = Toast.makeText(this, message, Toast.LENGTH_SHORT);
		} else {
			toast.setText(message);
		}
		toast.show();
	}
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		requestWindowFeature(Window.FEATURE_NO_TITLE);
		setContentView(R.layout.setpassword_activity);
		lpwv = (LocusPassWordView) this.findViewById(R.id.mLocusPassWordView);
		View title = findViewById(R.id.home_title);
		leftImage = (ImageView) title.findViewById(R.id.left_image);
		titleImage = (ImageView) title.findViewById(R.id.title_image);
		rightImage = (ImageView) title.findViewById(R.id.right_image);
		titleName = (TextView) title.findViewById(R.id.title_name);
		leftImage.setBackgroundResource(R.drawable.back);

		leftImage.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View arg0) {
				// TODO Auto-generated method stub
				finish();
			}
		});
		titleImage.setVisibility(View.GONE);
		rightImage.setVisibility(View.GONE);
		titleName.setText("修改手势密码");
		titleName .setVisibility(View.VISIBLE);
		lpwv.setOnCompleteListener(new OnCompleteListener() {
			@Override
			public void onComplete(String mPassword) {

				if (needverify) {
					if (lpwv.verifyPassword(mPassword)) {
						showToast("密码输入正确,请输入新密码!");
						lpwv.clearPassword();
						needverify = false;
					} else {
						showToast("错误的密码,请重新输入!");
						lpwv.clearPassword();
						password = "";
					}
				}else{
					if(StringUtil.isNotEmpty(mPassword)){
						if(agin){
							if(password.equals(mPassword) ){
								lpwv.resetPassWord(password);
								lpwv.clearPassword();
								showToast("密码修改成功,请牢记");
								MiningCircleApplication.getInstance().setIsFuture(true);
								agin = false;
								finish();
							}else{
								lpwv.clearPassword();
								showToast("两次密码不一致");
							}
						}else{
							password= mPassword;
							agin = true;
							lpwv.clearPassword();
							showToast("请在输入一次。");
						}
					}
				}

			}
		});
		if (!lpwv.isPasswordEmpty()) {
			this.needverify = true;
			this.agin = false;
			showToast("请输入旧密码");
		}
	}

}


text:
<!doctype html>

<meta charset="utf-8">

<title>Pooping Out CSS</title>

<meta name="description" content="Just about everyone is using a CSS preprocessor these days. Some like them just for the variables, and others use all the crazy inline functions and whitespace significance features. They're often treated as black boxes. My code goes in, and CSS comes out. This talk will be a deep dive into the digestive tract of your CSS preprocessor. Learn how your original code is parsed and stored, and then how that information is used to generate valid CSS. If there's time, we'll also talk about introducing parasites into your system for some interesting looking results!">
<meta name="author" content="Alex Sexton">

<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />

<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">

<link rel="stylesheet" href="css/reveal.min.css">
<link rel="stylesheet" href="css/theme/sky.css" id="theme">

<link rel="stylesheet" href="lib/css/zenburn.css">

Pooping Out CSS 💩

CSSConf.eu, Sept 13, 2013

      Alex Sexton / @SlexAxton

 http://alexsexton.com/talks/pooping-out-css

Fin.

Questions?

 http://alexsexton.com/talks/pooping-out-css