text:
package mysqlctl

import (
	"fmt"
	"regexp"
	"strings"

	log "github.com/golang/glog"

	"github.com/youtube/vitess/go/vt/mysqlctl/tmutils"
	tabletmanagerdatapb "github.com/youtube/vitess/go/vt/proto/tabletmanagerdata"
)

var autoIncr = regexp.MustCompile(" AUTO_INCREMENT=\\d+")

// GetSchema returns the schema for database for tables listed in
// tables. If tables is empty, return the schema for all tables.
func (mysqld *Mysqld) GetSchema(dbName string, tables, excludeTables []string, includeViews bool) (*tabletmanagerdatapb.SchemaDefinition, error) {
	sd := &tabletmanagerdatapb.SchemaDefinition{}

	// get the database creation command
	qr, fetchErr := mysqld.FetchSuperQuery("SHOW CREATE DATABASE IF NOT EXISTS " + dbName)
	if fetchErr != nil {
		return nil, fetchErr
	}
	if len(qr.Rows) == 0 {
		return nil, fmt.Errorf("empty create database statement for %v", dbName)
	}
	sd.DatabaseSchema = strings.Replace(qr.Rows[0][1].String(), "`"+dbName+"`", "`{{.DatabaseName}}`", 1)

	// get the list of tables we're interested in
	sql := "SELECT table_name, table_type, data_length, table_rows FROM information_schema.tables WHERE table_schema = '" + dbName + "'"
	if !includeViews {
		sql += " AND table_type = '" + tmutils.TableBaseTable + "'"
	}
	qr, err := mysqld.FetchSuperQuery(sql)
	if err != nil {
		return nil, err
	}
	if len(qr.Rows) == 0 {
		return sd, nil
	}

	sd.TableDefinitions = make([]*tabletmanagerdatapb.TableDefinition, 0, len(qr.Rows))
	for _, row := range qr.Rows {
		tableName := row[0].String()
		tableType := row[1].String()

		// compute dataLength
		var dataLength uint64
		if !row[2].IsNull() {
			// dataLength is NULL for views, then we use 0
			dataLength, err = row[2].ParseUint64()
			if err != nil {
				return nil, err
			}
		}

		// get row count
		var rowCount uint64
		if !row[3].IsNull() {
			rowCount, err = row[3].ParseUint64()
			if err != nil {
				return nil, err
			}
		}

		qr, fetchErr := mysqld.FetchSuperQuery("SHOW CREATE TABLE " + dbName + "." + tableName)
		if fetchErr != nil {
			return nil, fetchErr
		}
		if len(qr.Rows) == 0 {
			return nil, fmt.Errorf("empty create table statement for %v", tableName)
		}

		// Normalize & remove auto_increment because it changes on every insert
		// FIXME(alainjobart) find a way to share this with
		// vt/tabletserver/table_info.go:162
		norm := qr.Rows[0][1].String()
		norm = autoIncr.ReplaceAllLiteralString(norm, "")
		if tableType == tmutils.TableView {
			// Views will have the dbname in there, replace it
			// with {{.DatabaseName}}
			norm = strings.Replace(norm, "`"+dbName+"`", "`{{.DatabaseName}}`", -1)
		}

		td := &tabletmanagerdatapb.TableDefinition{}
		td.Name = tableName
		td.Schema = norm

		td.Columns, err = mysqld.GetColumns(dbName, tableName)
		if err != nil {
			return nil, err
		}
		td.PrimaryKeyColumns, err = mysqld.GetPrimaryKeyColumns(dbName, tableName)
		if err != nil {
			return nil, err
		}
		td.Type = tableType
		td.DataLength = dataLength
		td.RowCount = rowCount
		sd.TableDefinitions = append(sd.TableDefinitions, td)
	}

	sd, err = tmutils.FilterTables(sd, tables, excludeTables, includeViews)
	if err != nil {
		return nil, err
	}
	tmutils.GenerateSchemaVersion(sd)
	return sd, nil
}

// ResolveTables returns a list of actual tables+views matching a list
// of regexps
func ResolveTables(mysqld MysqlDaemon, dbName string, tables []string) ([]string, error) {
	sd, err := mysqld.GetSchema(dbName, tables, nil, true)
	if err != nil {
		return nil, err
	}
	result := make([]string, len(sd.TableDefinitions))
	for i, td := range sd.TableDefinitions {
		result[i] = td.Name
	}
	return result, nil
}

// GetColumns returns the columns of table.
func (mysqld *Mysqld) GetColumns(dbName, table string) ([]string, error) {
	conn, err := mysqld.dbaPool.Get(0)
	if err != nil {
		return nil, err
	}
	defer conn.Recycle()
	qr, err := conn.ExecuteFetch(fmt.Sprintf("select * from %v.%v where 1=0", dbName, table), 0, true)
	if err != nil {
		return nil, err
	}
	columns := make([]string, len(qr.Fields))
	for i, field := range qr.Fields {
		columns[i] = field.Name
	}
	return columns, nil

}

// GetPrimaryKeyColumns returns the primary key columns of table.
func (mysqld *Mysqld) GetPrimaryKeyColumns(dbName, table string) ([]string, error) {
	conn, err := mysqld.dbaPool.Get(0)
	if err != nil {
		return nil, err
	}
	defer conn.Recycle()
	qr, err := conn.ExecuteFetch(fmt.Sprintf("show index from %v.%v", dbName, table), 100, true)
	if err != nil {
		return nil, err
	}
	keyNameIndex := -1
	seqInIndexIndex := -1
	columnNameIndex := -1
	for i, field := range qr.Fields {
		switch field.Name {
		case "Key_name":
			keyNameIndex = i
		case "Seq_in_index":
			seqInIndexIndex = i
		case "Column_name":
			columnNameIndex = i
		}
	}
	if keyNameIndex == -1 || seqInIndexIndex == -1 || columnNameIndex == -1 {
		return nil, fmt.Errorf("Unknown columns in 'show index' result: %v", qr.Fields)
	}

	columns := make([]string, 0, 5)
	var expectedIndex int64 = 1
	for _, row := range qr.Rows {
		// skip non-primary keys
		if row[keyNameIndex].String() != "PRIMARY" {
			continue
		}

		// check the Seq_in_index is always increasing
		seqInIndex, err := row[seqInIndexIndex].ParseInt64()
		if err != nil {
			return nil, err
		}
		if seqInIndex != expectedIndex {
			return nil, fmt.Errorf("Unexpected index: %v != %v", seqInIndex, expectedIndex)
		}
		expectedIndex++

		columns = append(columns, row[columnNameIndex].String())
	}
	return columns, err
}

// PreflightSchemaChange will apply the schema change to a fake
// database that has the same schema as the target database, see if it
// works.
func (mysqld *Mysqld) PreflightSchemaChange(dbName string, change string) (*tmutils.SchemaChangeResult, error) {
	// gather current schema on real database
	beforeSchema, err := mysqld.GetSchema(dbName, nil, nil, true)
	if err != nil {
		return nil, err
	}

	// populate temporary database with it
	sql := "SET sql_log_bin = 0;\n"
	sql += "DROP DATABASE IF EXISTS _vt_preflight;\n"
	sql += "CREATE DATABASE _vt_preflight;\n"
	sql += "USE _vt_preflight;\n"
	for _, td := range beforeSchema.TableDefinitions {
		if td.Type == tmutils.TableBaseTable {
			sql += td.Schema + ";\n"
		}
	}
	for _, td := range beforeSchema.TableDefinitions {
		if td.Type == tmutils.TableView {
			// Views will have {{.DatabaseName}} in there, replace
			// it with _vt_preflight
			s := strings.Replace(td.Schema, "`{{.DatabaseName}}`", "`_vt_preflight`", -1)
			sql += s + ";\n"
		}
	}
	if err = mysqld.executeMysqlCommands(mysqld.dba.Uname, sql); err != nil {
		return nil, err
	}

	// apply schema change to the temporary database
	sql = "SET sql_log_bin = 0;\n"
	sql += "USE _vt_preflight;\n"
	sql += change
	if err = mysqld.executeMysqlCommands(mysqld.dba.Uname, sql); err != nil {
		return nil, err
	}

	// get the result
	afterSchema, err := mysqld.GetSchema("_vt_preflight", nil, nil, true)
	if err != nil {
		return nil, err
	}

	// and clean up the extra database
	sql = "SET sql_log_bin = 0;\n"
	sql += "DROP DATABASE _vt_preflight;\n"
	if err = mysqld.executeMysqlCommands(mysqld.dba.Uname, sql); err != nil {
		return nil, err
	}

	return &tmutils.SchemaChangeResult{BeforeSchema: beforeSchema, AfterSchema: afterSchema}, nil
}

// ApplySchemaChange will apply the schema change to the given database.
func (mysqld *Mysqld) ApplySchemaChange(dbName string, change *tmutils.SchemaChange) (*tmutils.SchemaChangeResult, error) {
	// check current schema matches
	beforeSchema, err := mysqld.GetSchema(dbName, nil, nil, true)
	if err != nil {
		return nil, err
	}
	if change.BeforeSchema != nil {
		schemaDiffs := tmutils.DiffSchemaToArray("actual", beforeSchema, "expected", change.BeforeSchema)
		if len(schemaDiffs) > 0 {
			for _, msg := range schemaDiffs {
				log.Warningf("BeforeSchema differs: %v", msg)
			}

			// let's see if the schema was already applied
			if change.AfterSchema != nil {
				schemaDiffs = tmutils.DiffSchemaToArray("actual", beforeSchema, "expected", change.AfterSchema)
				if len(schemaDiffs) == 0 {
					// no diff between the schema we expect
					// after the change and the current
					// schema, we already applied it
					return &tmutils.SchemaChangeResult{
						BeforeSchema: beforeSchema,
						AfterSchema:  beforeSchema}, nil
				}
			}

			if change.Force {
				log.Warningf("BeforeSchema differs, applying anyway")
			} else {
				return nil, fmt.Errorf("BeforeSchema differs")
			}
		}
	}

	sql := change.SQL
	if !change.AllowReplication {
		sql = "SET sql_log_bin = 0;\n" + sql
	}

	// add a 'use XXX' in front of the SQL
	sql = "USE " + dbName + ";\n" + sql

	// execute the schema change using an external mysql process
	// (to benefit from the extra commands in mysql cli)
	if err = mysqld.executeMysqlCommands(mysqld.dba.Uname, sql); err != nil {
		return nil, err
	}

	// get AfterSchema
	afterSchema, err := mysqld.GetSchema(dbName, nil, nil, true)
	if err != nil {
		return nil, err
	}

	// compare to the provided AfterSchema
	if change.AfterSchema != nil {
		schemaDiffs := tmutils.DiffSchemaToArray("actual", afterSchema, "expected", change.AfterSchema)
		if len(schemaDiffs) > 0 {
			for _, msg := range schemaDiffs {
				log.Warningf("AfterSchema differs: %v", msg)
			}
			if change.Force {
				log.Warningf("AfterSchema differs, not reporting error")
			} else {
				return nil, fmt.Errorf("AfterSchema differs")
			}
		}
	}

	return &tmutils.SchemaChangeResult{BeforeSchema: beforeSchema, AfterSchema: afterSchema}, nil
}


text:
public interface Browser {
    void browse(String x);
    boolean isURL(String url);
}

redpajama_set_name: RedPajamaGithub


text:
/**
 * Conway's Game of Life in JS
 * https://git.io/gol
 * MIT Licensed - GoL.js (c) 2016
 */

var Game = {};
Game.settings = {};

/**
 * Play a game step.
 */
Game.play = function () {
  for (var i = 1; i < Grid.amount * Grid.amount + 1; i++) {
    Grid.checkNeighbours(Grid.cells[i]);
    Grid.nextStates(Grid.cells[i]);
  } // end of for loop
  Grid.gameStep();
}

/**
 * Switch between edit and play modes.
 * @param String, 'pause' or 'play'
 * optional, only if a specific task needs to be done.
 */
Game.switchMode = function (mode) {
  var controls = $('.controls');

  // Emptying .trash, .random, .share and .size Div.
  $('.trash').empty();
  $('.random').empty();
  $('.share').empty();
  $('.size').empty();

  if (controls.hasClass('edit') || mode == 'pause') {
    // Removing the edit class and adding the save class.
    controls.removeClass('edit');
    controls.addClass('save');
    // Emptying the div.
    controls.empty();
    // Adding the save icon.
    controls.append($(''));
    // Adding all the option's icons.
    $('.trash').append($(''));
    $('.random').append($(''));
    $('.share').append($(''));
    $('.size').append($(''));

    return 'clear';
  } else if (controls.hasClass('save') || mode == 'play') {
    // Removing the save class and adding the edit class
    controls.removeClass('save');
    controls.addClass('edit');
    // Emptying the div.
    controls.empty();
    // Adding the pencil icon.
    controls.append($(''));

    // Other 'option' icons don't need to be deleted,
    // since this has been done at the start of the function.

    return 'set';
  }
}

/**
 * Switch the state of the given cell.
 * @param Element thisCell
 */
Game.switchState = function (thisCell) {
  var id = $(thisCell).attr('id');
  var gcell = Grid.cells[id];

  if ($('.controls').hasClass('save')) {
    if (gcell.state == 1) {
      Grid.setState(gcell, 0);
    }else {
      Grid.setState(gcell, 1);
    }
  }
}

/**
 * Clear the grid if edit mode is active.
 */
Game.trash = function () {
  if ($('.controls').hasClass('save')) {
    Grid.clearGrid();
  }
}

/**
 * Draw a random grid if edit mode is active.
 */
Game.randomGrid = function () {
  if ($('.controls').hasClass('save')) {
    Grid.randomGrid();
  }
}

/**
 * Initialize the game.
 * @param Object settings
 * @param Function callback
 */
Game.init = function (settings, callback) {

  // Set default values if no setting is defined.
  if (!settings) settings = {};
  if (!settings.gameInterval) settings.gameInterval = 200;
  if (!settings.diameterInterval) settings.diameterInterval = 250;
  if (!settings.width) settings.width = 50;
  if (!settings.height) settings.height = 50;
  if (!settings.type) settings.type = "random";

  // Put settings in Game object.
  Game.settings.gameInterval = settings.gameInterval;
  Game.settings.diameterInterval = settings.diameterInterval;
  Game.settings.mode = settings.mode;
  Game.settings.width = settings.width;
  Game.settings.height = settings.height;
  Game.settings.type = settings.type;

  // Initialize the Grid.
  Grid.drawGrid();

  // Check what game type was requested.
  if (this.settings.type == 'random') {
    Grid.randomGrid();
  }
  else if (this.settings.type == 'hash') {
    Codes.importFromURL();
  } else if (this.settings.type == 'empty') {
    Grid.emptyGrid();
  }
  else {
    throw "Unknown game type for settings.type";
  }

  // Update the cell diameter on window width change.
  Grid.updateDiameter();

  if (this.settings.type != 'empty'){
    // Initialize Game tick.
    Game.interval = window.setInterval(function() {
      Game.play();
    }, this.settings.gameInterval);
  }

  // Return to callback.
  if (callback) callback();
}

/**
 * Stop the Game.
 */
Game.stop = function () {

  clearInterval(Game.interval);
  clearInterval(Grid.interval);

  Game.switchMode();

  Grid.clearGrid();
  Grid.cells = {};
  Grid.YX = {};
  Grid.diameter = null;

  $("#grid").html("");

}

/**
 * Pause or un-pause the Game.
 * @param String, 'pause' or 'play'
 * Optional, only if a specific task needs to be done.
 */
Game.togglePause = function (mode) {
  if (Game.switchMode(mode) === 'clear') {
    clearInterval(Game.interval);
  } else {
    Game.interval = window.setInterval(function () {
      Game.play();
    }, Game.settings.gameInterval);
  }
}

/**
 * Request user input for a new gird size.
 * Makes sure this input is a number between (1< number <= 75).
 * Returns to callback. (only if the input passes the conditions listed above)
 */
Game.getNewSize = function(callback) {
  var newSize = prompt('Please enter a grid size!', 'Grid size');
  var number = Number(newSize);
  if (isNaN(newSize)) {
    alert('"'+newSize+'"'+' is not a number.\nPlease try again!');
    var returnValue = false;
  }else if (!isInt(number)) {
    alert(newSize+' is not a round number.\nPlease try again!');
    var returnValue = false;
  }else if (number > 75) {
    alert('Sorry '+newSize+' is too big!\nPlease try again!');
    var returnValue = false;
  }else if (number <= 1) {
    alert('Please enter a number greather than 1!\nPlease try again!');
    var returnValue = false;
  } else {
    var returnValue = number;
  }
  if (callback) callback(returnValue);
}

/**
 * Register all event listeners.
 * Returns all listener objects.
 * @return Object
 */
Game.registerEvents = function () {

  $(window).blur(function () {
     Game.togglePause('pause');
  });

  // Switch between edit and play modes.
  $('.controls').click(function () {
    Game.togglePause();
  });

  // Switch cell state on click.
  $(document).on('click','.cell', function (e) {
    var thisCell = e.target;
    Game.switchState(thisCell);
  });

  // Check if the mouse button is down or not.
  Game.isMouseDown = false;
  $(document).mousedown(function () {
    Game.isMouseDown = true;
  })
  .mouseup(function () {
    Game.isMouseDown = false;
  })

  // Trigger click event if the mouse enters the
  // cell while the mouse button is down.
  $(document).on('mouseenter', '.cell', function(e) {
    if (Game.isMouseDown) $(e.target).click();
  });

  // Trash game grid on click.
  $('.trash').click(function () {
    Game.trash();
  });

  // Randomize game grid on click.
  $('.random').click(function () {
    Game.randomGrid();
  });

  $('.size').click(function () {
    Game.getNewSize(function (newSize) {
      if (!newSize === false) {
        Game.newAmount(newSize, true);
      }
    });
  });

  // Copy sharable 'grid' link to clipboard on click.
  $('.share').click(function () {
    Codes.generateURL(function (url) {
      copyToClipboard(url);
    });
  });

}

/**
 * Set the game to a new Amount of cells.
 */
Game.newAmount = function (amount) {

  if (typeof(amount) != "number") {
    throw amount+' is not a valid amount'
  }
  if (Grid.amount == undefined) {
    Grid.amount = amount;
  }else {
    if (Grid.amount != amount) {
      this.stop();
      Game.init({width: amount, type:'empty'})
      Game.togglePause();
    }
  }
}


text:
/**
 * @since 2016-07-31 18:40
 * @author vivaxy
 */

import { createReducer } from 'redux-create-reducer';

import { BUTTON_DEFAULT, BUTTON_DISABLED, APPEND_NEWS } from '../config/actionTypes';

const defaultState = true;

export default createReducer(defaultState, {
    [BUTTON_DISABLED]: () => {
        return false;
    },
    [BUTTON_DEFAULT]: () => {
        return true;
    },
    [APPEND_NEWS]: () => {
        return true;
    },
});

export const setButtonDisabled = () => {
    return {
        type: BUTTON_DISABLED,
    };
};

export const setButtonDefault = () => {
    return {
        type: BUTTON_DEFAULT,
    };
};


text:
package goja.plugins.redis;

import redis.clients.jedis.Transaction;

public interface JedisAtom {

    void action(Transaction transaction);
}


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

<title>JMeterThreadMonitor (Apache JMeter API)</title>
<link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Overview

Package

Class

Tree

Deprecated

Index

Help

Apache JMeter

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

org.apache.jmeter.threads

Interface JMeterThreadMonitor

All Known Implementing Classes:

AbstractThreadGroup, PostThreadGroup, SetupThreadGroup, ThreadGroup

public interface JMeterThreadMonitor

Version:

$Revision: 1377076 $

Method Summary

Methods

Modifier and Type
Method and Description

void
threadFinished(JMeterThread thread)

Method Detail

threadFinished

void threadFinished(JMeterThread thread)

Overview

Package

Class

Tree

Deprecated

Index

Help

Apache JMeter

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

Copyright © 1998-2016 Apache Software Foundation. All Rights Reserved.


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

import SceneView from 'esri/views/SceneView';

import { SceneViewService } from './sceneView.service';
import { Util } from '../shared/util';

@Component({
    selector: 'esri-scene-view',
    template: `
                <div [hidden]="!sceneViewService.isSupported" id="scene-view" [class.inactive]="!sceneViewService.isActive" class="view" >
                </div>
             `
})
export class SceneViewComponent {

    constructor(public sceneViewService: SceneViewService) {
    }

    ngOnInit() {
    }

}


text:
define('zfegg/admin/controller/role',
    [
        'require',
        'zfegg/view/view',
        'zfegg/config',
        '../source/roles',
        '../source/role-resources',
        'zfegg/kendo/binder-window-center'
    ],
    function (req, View, config, roles, RoleResourcesAssigner) {
        'use strict';

        var restUrl = config.baseUrl + '/roles';

        var kGrid;
        return new View(
            '角色管理',
            req.toUrl('./role.html'),
            {
                model: {
                    roles: roles.hierarchicalDataSource,
                    isAssignDisabled: true,
                    isVisible: true,
                    selectedNode: null,
                    onSelect: function (e) {
                        var kTree = e.sender.element.data('kendoTreeView');
                        this.selectedNode = kTree.dataItem(e.node);
                        this.set('isAssignDisabled', false);
                    },
                    onClickAssign: function (e) {
                        var resourcesAssigner = new RoleResourcesAssigner(this.selectedNode);

                        resourcesAssigner.fetchItems(function (items) {
                            var view = new View(
                                '', req.toUrl('./assign-resource.html'),
                                {
                                    model: {
                                        isVisible: true,
                                        onCheckResource: function (e) {
                                            var resource = e.sender.dataItem(e.node);
                                            resourcesAssigner.assign(resource);
                                        },
                                        onWindowClose: function (e) {
                                            e.sender.destroy();
                                        },
                                        onButtonSubmit: function (e) {
                                            e.preventDefault();
                                            resourcesAssigner.dataSource.sync().then(function () {
                                                $(e.target).closest('[data-role=window]').data('kendoWindow').close();
                                            });
                                        },
                                        onButtonCancel: function (e) {
                                            e.preventDefault();
                                            $(e.target).closest('[data-role=window]').data('kendoWindow').close();
                                        },
                                        resources: items
                                    }
                                }
                            );

                            view.render();
                        });
                    }
                },
                init: function () {
                    var $tree = this.element.children('[data-role=treeview]'),
                        kTree = $tree.data('kendoTreeView');

                    kTree.options.template = kendo.template('#:item.name#   ');

                    $tree.on('click', '.k-delete', function () {
                        var node  = $(this).closest('.k-item'),
                            item = kTree.dataItem(node),
                            nodes = node.find('.k-item').andSelf();

                        nodes.each(function () {
                            var n = roles.dataSource.get(kTree.dataItem(this).role_id);
                            if (n) {
                                roles.dataSource.remove(n);
                            }
                        });
                        roles.dataSource.sync().then(function () {
                            kTree.remove(node);
                        });
                    });

                    $tree.on('click', '.k-add', function () {
                        var node  = $(this).closest('.k-item'),
                            item = kTree.dataItem(node),
                            name;

                        if (name = window.prompt('请输入角色名')) {
                            roles.dataSource.add({name: name, parent_id: item.role_id});
                            roles.dataSource.sync().then(function () {
                                var newItem = roles.dataSource.data().slice(-1)[0];
                                kTree.append(newItem.toJSON(), node);
                            });
                        }
                    });
                }
            }
        );
    });


text:
package de.iritgo.aktera.event;

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

public class EventHandlerTree
{
	private String eventId;

	private List<StandardEventHandler> handlers = new LinkedList<StandardEventHandler>();

	private Map<String, EventHandlerTree> children = new HashMap<String, EventHandlerTree>();

	public EventHandlerTree(String eventId)
	{
		this.eventId = eventId;
	}

	public EventHandlerTree()
	{
		this.eventId = "";
	}

	public void insert(String eventId, StandardEventHandler handler)
	{
		String eventIdHead = eventId.split("\\.")[0];
		String eventIdCons = eventId.substring(Math.min(eventId.length(), eventIdHead.length() + 1));

		EventHandlerTree node = children.get(eventIdHead);

		if (node == null)
		{
			node = new EventHandlerTree(eventIdHead);
			children.put(eventIdHead, node);
		}

		if (eventIdCons.length() != 0)
		{
			node.insert(eventIdCons, handler);

			return;
		}

		node.handlers.add(handler);
	}

	public EventHandlerTree getChild(String eventId)
	{
		return children.get(eventId);
	}

	public List<StandardEventHandler> getHandlers()
	{
		return handlers;
	}
}


text:
layout: page
title: Burke Family Reunion
date: 2016-05-24
author: Betty Farley
tags: weekly links, java
status: published
summary: Proin eros turpis, lobortis ac risus ac, pulvinar.
banner: images/banner/leisure-05.jpg
booking:
  startDate: 01/18/2017
  endDate: 01/20/2017
  ctyhocn: GSPAPHX
  groupCode: BFR
published: true
---
Lorem ipsum dolor sit amet, consectetur adipiscing elit. In hac habitasse platea dictumst. Nunc nec leo dapibus risus gravida vestibulum. Ut sit amet cursus lorem. Etiam suscipit felis sit amet tortor finibus efficitur. Donec ultrices fringilla dui, nec eleifend sapien ullamcorper a. Praesent risus lacus, accumsan vitae mollis a, malesuada ac massa. Aliquam est nibh, dictum at tempor et, scelerisque et ligula. Curabitur maximus porttitor dignissim.

* Nullam eget lorem eu ante sollicitudin auctor
* Aliquam pulvinar mauris a tellus gravida, ut dictum quam tempor.

Duis egestas ligula id turpis cursus commodo. Suspendisse dui lacus, feugiat laoreet consequat id, ornare sodales ante. Etiam a vestibulum nulla. Sed fermentum tincidunt viverra. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Praesent dictum luctus lorem et laoreet. Donec vitae urna sem. In fringilla luctus dapibus. Sed volutpat condimentum scelerisque. Nam elit neque, egestas eu turpis ac, tempus suscipit erat. Proin cursus massa feugiat velit commodo, nec dignissim elit varius. Aenean vel venenatis arcu. Curabitur scelerisque dui non eros ullamcorper, ut tempor purus sagittis. Cras neque urna, lacinia eget dolor nec, tempor ultrices dolor. Aenean malesuada, sem eu tristique luctus, est sem tincidunt sapien, vitae laoreet neque magna a risus.


text:
title: Sosial Media berbasis Pendidikan
date: 2014-01-23 11:08:00 +07:00
nohibah: '003'
nama: Rino Muhamad Nur
lokasi: Tangerang, Banten
organisasi: Surya University
lama: 6 Bulan ( Oktober 2014 - Maret 2015 )
target: Siswa-siswi dan Guru-guru sekolah SMP-SMA
keberhasilan: |-
  – Meningkatnya kualitas pendidikan di daerah baik pendidik/guru maupun siswanya.
  – Minimal 4 sekolah di satu desa dapat menggunakan sosial media berbasis pendidikan ini
  – Banyaknya Konten pedidikan dan buku digital dari sekolah-sekolah di kota
  – Tukar menukar konten pendidikan seperti quiz, buku digital, blog dll antar sekolah
tipe: Piranti lunak berbasis WEB dan aplikasi mobile ( android ) untuk mendukungnya.
strategi: "\t\n– Sosialisasi ke sekolah-sekolah di desa\n– Menjalin kerjasama dengan
  sekolah di kota sebagai sister school\n– Sosialisasi melalui media internet seperti
  Blog, Forum, Mailing List dan Sosial Media.\n– Gathering / Workshop di sekolah-sekolah
  tentang manfaat elearning\n\nUntuk mengoptimalkan penggunaan tentu akan ada sosilisasi
  penggunaan, training dan manual book yang bertujuan untuk memberikan panduan bagaimana
  menggunakan aplikasi tersebut. Kemudian di sosialisasikan juga bagaimana membuat
  materi, mengupload materi dan bekerjasama dalam satu ruang maya diantara para siswa
  dan guru-guru ini. Tools lain yaitu menggunakan BLOG dan Video agar lebih memaksimalkan
  cara penggunaan sehingga para pengguna dapat dengan cepat menggunakan layanan aplikasi
  ini.\n\nUntuk mengoptimalkan penggunaan tentu akan ada sosilisasi penggunaan, training
  dan manual book yang bertujuan untuk memberikan panduan bagaimana menggunakan aplikasi
  tersebut. Kemudian di sosialisasikan juga bagaimana membuat materi, mengupload materi
  dan bekerjasama dalam satu ruang maya diantara para siswa dan guru-guru ini. Tools
  lain yaitu menggunakan BLOG dan Video agar lebih memaksimalkan cara penggunaan sehingga
  para pengguna dapat dengan cepat menggunakan layanan aplikasi ini. Dengan cara ini
  memudahkan dalam sosialisasi dan training penggunaan aplikasi."
dana: Rp. 164,5 juta
deskripsi: Dalam upaya meningkatkan pembelajaran elektronis maka digital content sangat
  diperlukan dalam kelancarannya, oleh karena itu teknologi sosial media berbasis
  pendidikan yang akan dikembangkan ini sangat cocok dengan kebutuhan pendidikan mengaplikasi
  teknologi dan memeratakan kualitas pendidikan dalam konsep yang lebih menyenangkan
  dan lebih dinamis.
masalah: |-
  – Tidak meratanya pendidikan antara daerah pedesaan dan perkotaan
  – Kualitas pendidik didaerah masih minim dibanding dengan pendidik di kota begitu juga lulusannya.
  – Minimnya akses terhadap media digital seperti ebook dan konten pendidikan berbasis multimedia
  – Mahalnya harga buku-buku pendidikan dan distribusi buku yang memakan waktu cukup lama
  – Letak geografis Indonesia yang terdiri dari kepulauan sehingga cukup sulit untuk dijangkau secara fisik
solusi: |-
  – Penggunaan media internet dan konten digital
  – Bekerja sama dengan sekolah-sekolah yang sudah cukup baik menjadi sekolah pembimbing atau sister school
  – Membuat buku-buku digital dan konten pedidikan multimedia yang dapat diakses melalui internet
kuantitas: NA
judul: Sosial Media berbasis Pendidikan
layout: hibah
---

![003](/static/img/hibahcms/003.jpg){: .img-responsive }{: width="350" }

### {{ page.nohibah }} - {{ page.title }}

{{ page.deskripsi }}

---


text:
BeanIO
======

A Java library for marshalling and unmarshalling bean objects from XML, CSV, delimited and fixed length stream formats.

For more information, including an online reference guide, please visit http://www.beanio.org.

#### Note
This repository houses the source code for the future BeanIO 3.x.  For older versions, please see https://code.google.com/p/beanio/.


text:
package org.apache.calcite.adapter.jdbc;

import org.apache.calcite.avatica.ColumnMetaData;
import org.apache.calcite.avatica.util.DateTimeUtils;
import org.apache.calcite.linq4j.function.Function0;
import org.apache.calcite.linq4j.function.Function1;
import org.apache.calcite.sql.SqlDialect;
import org.apache.calcite.sql.SqlDialectFactory;
import org.apache.calcite.util.ImmutableNullableList;
import org.apache.calcite.util.Pair;

import org.apache.commons.dbcp.BasicDataSource;

import com.google.common.cache.CacheBuilder;
import com.google.common.cache.CacheLoader;
import com.google.common.cache.LoadingCache;
import com.google.common.collect.ImmutableList;
import com.google.common.primitives.Ints;

import java.sql.Connection;
import java.sql.DatabaseMetaData;
import java.sql.Date;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Time;
import java.sql.Timestamp;
import java.sql.Types;
import java.util.HashMap;
import java.util.IdentityHashMap;
import java.util.List;
import java.util.Map;
import java.util.TimeZone;
import javax.annotation.Nonnull;
import javax.sql.DataSource;

/**
 * Utilities for the JDBC provider.
 */
final class JdbcUtils {
  private JdbcUtils() {
    throw new AssertionError("no instances!");
  }

  /** Pool of dialects. */
  static class DialectPool {
    final Map<DataSource, Map<SqlDialectFactory, SqlDialect>> map0 = new IdentityHashMap<>();
    final Map<List, SqlDialect> map = new HashMap<>();

    public static final DialectPool INSTANCE = new DialectPool();

    // TODO: Discuss why we need a pool. If we do, I'd like to improve performance
    synchronized SqlDialect get(SqlDialectFactory dialectFactory, DataSource dataSource) {
      Map<SqlDialectFactory, SqlDialect> dialectMap = map0.get(dataSource);
      if (dialectMap != null) {
        final SqlDialect sqlDialect = dialectMap.get(dialectFactory);
        if (sqlDialect != null) {
          return sqlDialect;
        }
      }
      Connection connection = null;
      try {
        connection = dataSource.getConnection();
        DatabaseMetaData metaData = connection.getMetaData();
        String productName = metaData.getDatabaseProductName();
        String productVersion = metaData.getDatabaseProductVersion();
        List key = ImmutableList.of(productName, productVersion, dialectFactory);
        SqlDialect dialect = map.get(key);
        if (dialect == null) {
          dialect = dialectFactory.create(metaData);
          map.put(key, dialect);
          if (dialectMap == null) {
            dialectMap = new IdentityHashMap<>();
            map0.put(dataSource, dialectMap);
          }
          dialectMap.put(dialectFactory, dialect);
        }
        connection.close();
        connection = null;
        return dialect;
      } catch (SQLException e) {
        throw new RuntimeException(e);
      } finally {
        if (connection != null) {
          try {
            connection.close();
          } catch (SQLException e) {
            // ignore
          }
        }
      }
    }
  }

  /** Builder that calls {@link ResultSet#getObject(int)} for every column,
   * or {@code getXxx} if the result type is a primitive {@code xxx},
   * and returns an array of objects for each row. */
  static class ObjectArrayRowBuilder implements Function0<Object[]> {
    private final ResultSet resultSet;
    private final int columnCount;
    private final ColumnMetaData.Rep[] reps;
    private final int[] types;

    ObjectArrayRowBuilder(ResultSet resultSet, ColumnMetaData.Rep[] reps,
        int[] types)
        throws SQLException {
      this.resultSet = resultSet;
      this.reps = reps;
      this.types = types;
      this.columnCount = resultSet.getMetaData().getColumnCount();
    }

    public static Function1<ResultSet, Function0<Object[]>> factory(
        final List<Pair<ColumnMetaData.Rep, Integer>> list) {
      return new Function1<ResultSet, Function0<Object[]>>() {
        public Function0<Object[]> apply(ResultSet resultSet) {
          try {
            return new ObjectArrayRowBuilder(
                resultSet,
                Pair.left(list).toArray(new ColumnMetaData.Rep[list.size()]),
                Ints.toArray(Pair.right(list)));
          } catch (SQLException e) {
            throw new RuntimeException(e);
          }
        }
      };
    }

    public Object[] apply() {
      try {
        final Object[] values = new Object[columnCount];
        for (int i = 0; i < columnCount; i++) {
          values[i] = value(i);
        }
        return values;
      } catch (SQLException e) {
        throw new RuntimeException(e);
      }
    }

    /**
     * Gets a value from a given column in a JDBC result set.
     *
     * @param i Ordinal of column (1-based, per JDBC)
     */
    private Object value(int i) throws SQLException {
      // MySQL returns timestamps shifted into local time. Using
      // getTimestamp(int, Calendar) with a UTC calendar should prevent this,
      // but does not. So we shift explicitly.
      switch (types[i]) {
      case Types.TIMESTAMP:
        return shift(resultSet.getTimestamp(i + 1));
      case Types.TIME:
        return shift(resultSet.getTime(i + 1));
      case Types.DATE:
        return shift(resultSet.getDate(i + 1));
      }
      return reps[i].jdbcGet(resultSet, i + 1);
    }

    private static Timestamp shift(Timestamp v) {
      if (v == null) {
        return null;
      }
      long time = v.getTime();
      int offset = TimeZone.getDefault().getOffset(time);
      return new Timestamp(time + offset);
    }

    private static Time shift(Time v) {
      if (v == null) {
        return null;
      }
      long time = v.getTime();
      int offset = TimeZone.getDefault().getOffset(time);
      return new Time((time + offset) % DateTimeUtils.MILLIS_PER_DAY);
    }

    private static Date shift(Date v) {
      if (v == null) {
        return null;
      }
      long time = v.getTime();
      int offset = TimeZone.getDefault().getOffset(time);
      return new Date(time + offset);
    }
  }

  /** Ensures that if two data sources have the same definition, they will use
   * the same object.
   *
   * <p>This in turn makes it easier to cache
   * {@link org.apache.calcite.sql.SqlDialect} objects. Otherwise, each time we
   * see a new data source, we have to open a connection to find out what
   * database product and version it is. */
  static class DataSourcePool {
    public static final DataSourcePool INSTANCE = new DataSourcePool();

    private final LoadingCache<List<String>, BasicDataSource> cache =
        CacheBuilder.newBuilder().softValues().build(
            new CacheLoader<List<String>, BasicDataSource>() {
              @Override public BasicDataSource load(@Nonnull List<String> key) {
                BasicDataSource dataSource = new BasicDataSource();
                dataSource.setUrl(key.get(0));
                dataSource.setUsername(key.get(1));
                dataSource.setPassword(key.get(2));
                dataSource.setDriverClassName(key.get(3));
                return dataSource;
              }
            });

    public DataSource get(String url, String driverClassName,
        String username, String password) {
      // Get data source objects from a cache, so that we don't have to sniff
      // out what kind of database they are quite as often.
      final List<String> key =
          ImmutableNullableList.of(url, username, password, driverClassName);
      return cache.getUnchecked(key);
    }
  }
}

// End JdbcUtils.java


text:
[![Code Climate](https://codeclimate.com/github/novikserg/bolton/badges/gpa.svg)](https://codeclimate.com/github/novikserg/bolton)
[![Coverage Status](https://coveralls.io/repos/github/novikserg/bolton/badge.svg?branch=master)](https://coveralls.io/github/novikserg/bolton?branch=master)
[![Build Status](https://travis-ci.org/novikserg/bolton.svg?branch=master)](https://travis-ci.org/novikserg/bolton)

Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/bolton`. To experiment with that code, run `bin/console` for an interactive prompt.

TODO: Delete this and the text above, and describe your gem

## Installation

Add this line to your application's Gemfile:

```ruby
gem 'bolton'
```

And then execute:

    $ bundle

Or install it yourself as:

    $ gem install bolton

## Usage

TODO: Write usage instructions here

## Development

After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).

## Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/bolton.


text:
<?php

namespace App\FrontModule\Presenters;

use Nette\Application\ForbiddenRequestException;
use Texy;
use Nette\Application\BadRequestException;

class DetailPresenter extends BasePresenter
{
	/** @var \App\Model\ArticleManager @inject */
	public $articleManager;

	/** @var \Nette\Database\Row */
	public $articleDetail;

	public function actionDefault($id, $slug = '')
	{
		$this->articleDetail = $this->articleManager->get($id);
		if (!$this->articleDetail) {
			throw new BadRequestException;
		}

		if ($this->articleDetail->document_state == 'draft') {
			if (!$this->user->isLoggedIn()){
				throw new ForbiddenRequestException;
			}
			if ($this->user->getId() != $this->articleDetail->user_id){
				throw new ForbiddenRequestException;
			}
		}

		if ($slug != $this->articleDetail->slug || $this->language != $this->articleDetail->language){
			$this->redirect(303, 'Detail:default', [$id, $this->articleDetail->slug, 'language'=>$this->articleDetail->language]);
		}

	}

	/**
	 * @param int $id
	 */
	public function renderDefault($id, $slug = '')
	{
		$this->template->articleDetail = $this->articleDetail;

		if ($this->user->isAllowed('Article', 'like')) {
			$this->template->likesUserArticle = $this->articleManager->likesUserArticle($id, $this->user->id);
		}

		$this->template->articleLikes = $this->articleManager->getCountArticleLikes($id);
		$this->template->mutations = $this->articleManager->findArticleMutatations($id);
	}

}


text:
use std::io::{BufRead, Write};

use quick_xml::Error as XmlError;
use quick_xml::events::{BytesEnd, BytesStart, Event};
use quick_xml::events::attributes::Attributes;
use quick_xml::Reader;
use quick_xml::Writer;

use error::Error;
use fromxml::FromXml;
use toxml::{ToXml, WriterExt};
use util::element_text;

/// Represents a text input for an RSS channel.
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[derive(Debug, Default, Clone, PartialEq, Builder)]
#[builder(setter(into), default)]
pub struct TextInput {
    /// The label of the Submit button for the text input.
    title: String,
    /// A description of the text input.
    description: String,
    /// The name of the text object.
    name: String,
    /// The URL of the CGI script that processes the text input request.
    link: String,
}

impl TextInput {
    /// Return the title for this text field.
    ///
    /// # Examples
    ///
    /// ```
    /// use rss::TextInput;
    ///
    /// let mut text_input = TextInput::default();
    /// text_input.set_title("Input Title");
    /// assert_eq!(text_input.title(), "Input Title");
    /// ```
    pub fn title(&self) -> &str {
        self.title.as_str()
    }

    /// Set the title for this text field.
    ///
    /// # Examples
    ///
    /// ```
    /// use rss::TextInput;
    ///
    /// let mut text_input = TextInput::default();
    /// text_input.set_title("Input Title");
    /// ```
    pub fn set_title<V>(&mut self, title: V)
    where
        V: Into<String>,
    {
        self.title = title.into();
    }

    /// Return the description of this text field.
    ///
    /// # Examples
    ///
    /// ```
    /// use rss::TextInput;
    ///
    /// let mut text_input = TextInput::default();
    /// text_input.set_description("Input description");
    /// assert_eq!(text_input.description(), "Input description");
    /// ```
    pub fn description(&self) -> &str {
        self.description.as_str()
    }

    /// Set the description of this text field.
    ///
    /// # Examples
    ///
    /// ```
    /// use rss::TextInput;
    ///
    /// let mut text_input = TextInput::default();
    /// text_input.set_description("Input description");
    /// ```
    pub fn set_description<V>(&mut self, description: V)
    where
        V: Into<String>,
    {
        self.description = description.into();
    }

    /// Return the name of the text object in this input.
    ///
    /// # Examples
    ///
    /// ```
    /// use rss::TextInput;
    ///
    /// let mut text_input = TextInput::default();
    /// text_input.set_name("Input name");
    /// assert_eq!(text_input.name(), "Input name");
    /// ```
    pub fn name(&self) -> &str {
        self.name.as_str()
    }

    /// Set the name of the text object in this input.
    ///
    /// # Examples
    ///
    /// ```
    /// use rss::TextInput;
    ///
    /// let mut text_input = TextInput::default();
    /// text_input.set_name("Input name");;
    /// ```
    pub fn set_name<V>(&mut self, name: V)
    where
        V: Into<String>,
    {
        self.name = name.into();
    }

    /// Return the URL of the GCI script that processes the text input request.
    ///
    /// # Examples
    ///
    /// ```
    /// use rss::TextInput;
    ///
    /// let mut text_input = TextInput::default();
    /// text_input.set_link("http://example.com/submit");
    /// assert_eq!(text_input.link(), "http://example.com/submit");
    /// ```
    pub fn link(&self) -> &str {
        self.link.as_str()
    }

    /// Set the URL of the GCI script that processes the text input request.
    ///
    /// # Examples
    ///
    /// ```
    /// use rss::TextInput;
    ///
    /// let mut text_input = TextInput::default();
    /// text_input.set_link("http://example.com/submit");
    /// ```
    pub fn set_link<V>(&mut self, link: V)
    where
        V: Into<String>,
    {
        self.link = link.into();
    }
}

impl FromXml for TextInput {
    fn from_xml<R: BufRead>(reader: &mut Reader<R>, _: Attributes) -> Result<Self, Error> {
        let mut text_input = TextInput::default();
        let mut buf = Vec::new();

        loop {
            match reader.read_event(&mut buf)? {
                Event::Start(element) => match element.name() {
                    b"title" => text_input.title = element_text(reader)?.unwrap_or_default(),
                    b"description" => {
                        text_input.description = element_text(reader)?.unwrap_or_default()
                    }
                    b"name" => text_input.name = element_text(reader)?.unwrap_or_default(),
                    b"link" => text_input.link = element_text(reader)?.unwrap_or_default(),
                    n => reader.read_to_end(n, &mut Vec::new())?,
                },
                Event::End(_) => break,
                Event::Eof => return Err(Error::Eof),
                _ => {}
            }

            buf.clear();
        }

        Ok(text_input)
    }
}

impl ToXml for TextInput {
    fn to_xml<W: Write>(&self, writer: &mut Writer<W>) -> Result<(), XmlError> {
        let name = b"textInput";

        writer.write_event(Event::Start(BytesStart::borrowed(name, name.len())))?;

        writer.write_text_element(b"title", &self.title)?;
        writer.write_text_element(b"description", &self.description)?;
        writer.write_text_element(b"name", &self.name)?;
        writer.write_text_element(b"link", &self.link)?;

        writer.write_event(Event::End(BytesEnd::borrowed(name)))?;
        Ok(())
    }
}


text:
<!doctype html>
<!--
    @license
    Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
    This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
    The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
    The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
    Code distributed by Google as part of the polymer project is also
    subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
-->
<html>
  <head>
    <title></title>
    <meta charset="UTF-8">
    <script src="../../tools/chai/chai.js"></script>
    <script src="../../tools/htmltest.js"></script>

    <script src="../../../webcomponents.js"></script>
  </head>
  <body>
    <x-foo>plain</x-foo>
    <button is="x-baz">plain</button>
    <script>
      var assert = chai.assert;
      window.addEventListener('WebComponentsReady', function() {
        var p = Object.create(HTMLElement.prototype);
        p.createdCallback = function() {
          this.textContent = 'custom!';
        }
        document.registerElement('x-foo', {prototype: p});
        //
        var p = Object.create(HTMLButtonElement.prototype);
        p.createdCallback = function() {
          this.textContent = 'custom!';
        }
        document.registerElement('x-baz', {prototype: p, extends: 'button'});
        document.body.appendChild(document.createElement('button', 'x-baz')).id = 'baz2';
        //
        assert.equal(document.querySelector('x-foo').textContent, 'custom!',
          'x-foo must have custom text');
        //
        assert.equal(document.querySelector('[is=x-baz]').textContent,
          'custom!', 'button is="x-baz" must have custom text');
        assert.equal(document.querySelector('#baz2').textContent, 'custom!',
          'button is=x-baz can be created via document.createElement(button, x-baz)');
        //
        var p = Object.create(HTMLElement.prototype);
        p.attachedCallback = function() {
          this.textContent = 'custom!';
        }
        //
        document.registerElement('x-zot', {prototype: p});
        //
        var xfoo = document.querySelector('x-foo');
        var root = xfoo.createShadowRoot();
        var xzot = document.createElement('x-zot');
        var handler = function() {
          assert.equal(xzot.textContent, 'custom!', 'x-zot in shadow root must have custom text');
          done();
        }
        var ob = new MutationObserver(handler);
        ob.observe(root, {childList: true, subtree: true});
        root.appendChild(xzot);
      });
    </script>
  </body>
</html>


text:
/* base.scss Uses code from: normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css */
html { box-sizing: border-box; font-size: 18px; height: 100%; line-height: 1.5; -webkit-text-size-adjust: 100%; }

*, *:before, *:after { box-sizing: inherit; }

body { background: #EEEEEE; color: #333333; font-family: "Droid Serif", Georgia, serif; margin: 0; padding: 0; }

/* Mobile screens */
@media screen and (max-width: 40rem) { body { font-size: 20px; } }

main { display: block; }

h1 { font-size: 2rem; margin: 0; }

hr { box-sizing: content-box; height: 0; overflow: visible; }

pre { font-family: "Droid Sans Mono", Consolas, Menlo, Monaco, monospace; font-size: 0.8889rem; color: #800080; }

code { font-family: "Droid Sans Mono", Consolas, Menlo, Monaco, monospace; font-size: 0.8889rem; color: #800080; }

a, a:visited { background-color: transparent; color: #2542D1; }

a:hover { color: #5B21D1; }

abbr[title] { border-bottom: none; text-decoration: underline; text-decoration: underline dotted; }

b, strong { font-weight: bolder; }

code, kbd, samp { font-family: monospace, monospace; font-size: 1em; }

small { font-size: 80%; }

sub, sup { font-size: 75%; line-height: 0; position: relative; vertical-align: baseline; }

sub { bottom: -0.25em; }

sup { top: -0.5em; }

figure, img, video { display: block; max-width: 100%; width: auto; height: auto; margin: 0; padding: 0; border-style: none; }

figcaption { text-align: center; }

button, input, optgroup, select, textarea { font-family: inherit; font-size: 100%; line-height: 1.15; margin: 0; }

button, input { overflow: visible; }

button, select { text-transform: none; }

button, [type="button"], [type="reset"], [type="submit"] { -webkit-appearance: button; }

button::-moz-focus-inner, [type="button"]::-moz-focus-inner, [type="reset"]::-moz-focus-inner, [type="submit"]::-moz-focus-inner { border-style: none; padding: 0; }

button:-moz-focusring, [type="button"]:-moz-focusring, [type="reset"]:-moz-focusring, [type="submit"]:-moz-focusring { outline: 1px dotted ButtonText; }

fieldset { padding: 0.35em 0.75em 0.625em; }

legend { box-sizing: border-box; color: inherit; display: table; max-width: 100%; padding: 0; /* 3 */ white-space: normal; }

progress { vertical-align: baseline; }

textarea { overflow: auto; }

[type="checkbox"], [type="radio"] { box-sizing: border-box; padding: 0; }

[type="number"]::-webkit-inner-spin-button, [type="number"]::-webkit-outer-spin-button { height: auto; }

[type="search"] { -webkit-appearance: textfield; outline-offset: -2px; }

[type="search"]::-webkit-search-decoration { -webkit-appearance: none; }

::-webkit-file-upload-button { -webkit-appearance: button; font: inherit; }

details { display: block; }

summary { display: list-item; }

template { display: none; }

[hidden] { display: none; }

.container { display: flex; flex-direction: row; flex-wrap: wrap; }

header { flex: 1 1 100%; }

aside { display: block; flex: 1 2 25%; max-width: 15rem; min-width: 9rem; }

main { max-width: 45rem; min-width: 30rem; min-height: 100vh; flex: 2 0 75%; }

footer { flex: 1 0 100%; }

#sidebar-toggle { display: none; }

/* Large Screen */
@media screen and (min-width: 40rem) { main { padding-bottom: 5.0rem; padding-left: 2.6667rem; padding-right: 2.6667rem; padding-top: 1.7778rem; } }

/* Mobile screens */
@media screen and (max-width: 40rem) { aside { display: none; position: absolute; top: 110px; left: -16rem; visibility: hidden; opacity: 0; transition: visibility 0s, opacity 0.5s linear; }
  aside.show { display: block; width: 100%; left: 0; transition: width 1s; z-index: 25; /* above asciinema */ visibility: visible; opacity: 1; }
  #sidebar-toggle { display: block; position: absolute; left: 16px; z-index: 26; /* above aside */ }
  main { min-width: 16rem; min-height: 100vh; flex: 3 0 75%; padding: 1.7778rem; } }

header { background-color: #0F4C81; color: #FFFFFF; padding: 1.0rem; }

header h3 { font-size: 2.0rem; margin: 0.2222rem; }

header a, header a:visited { color: currentColor; text-decoration: none; }

aside { background-color: #EEEEEE; color: #333333; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Droid Sans", Roboto, Cantarell, "Helvetica Neue", sans-serif; }

aside nav { padding: 1.0rem; }

aside nav a, aside nav a:visited { color: currentColor; }

aside nav a:hover { color: #eebbc3; }

aside nav ul { padding-left: 1.0rem; }

main { background: #FFFFFF; }

footer { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Droid Sans", Roboto, Cantarell, "Helvetica Neue", sans-serif; padding: 2.0rem 1.0rem 0.5rem 1.0rem; }

footer span { margin: 0  8px; }

footer span { margin: 0  8px; }

span.sidenote { border: 1px solid #CCCCCC; display: block; float: right; font-size: 0.83333rem; margin: 8px 0 8px 8px; max-width: 9rem; padding: 8px; }

#sidebar-toggle button { width: 36px; height: 36px; background: url(menu-close.svg) no-repeat center center #FFFFFF; background-size: contain; border: none; outline: inherit; border-radius: 18px; }

#sidebar-toggle button.open { width: 36px; height: 36px; background: url(menu-open.svg) no-repeat center center #FFFFFF; background-size: contain; }


text:
namespace {

QHash<QString, QString> *types_map = 0;

void init()
{
    types_map = new QHash<QString, QString>;

    // Adapted from /etc/mime.types on ubuntu 12.04
    // TODO: on windows we should read the system registry for a more complete mime types list

    types_map->insert("%", "application/x-trash");
    types_map->insert("323", "text/h323");
    types_map->insert("3gp", "video/3gpp");
    types_map->insert("7z", "application/x-7z-compressed");
    types_map->insert("a", "application/octet-stream");
    types_map->insert("abw", "application/x-abiword");
    types_map->insert("ai", "application/postscript");
    types_map->insert("aif", "audio/x-aiff");
    types_map->insert("aifc", "audio/x-aiff");
    types_map->insert("aiff", "audio/x-aiff");
    types_map->insert("alc", "chemical/x-alchemy");
    types_map->insert("amr", "audio/amr");
    types_map->insert("anx", "application/annodex");
    types_map->insert("apk", "application/vnd.android.package-archive");
    types_map->insert("art", "image/x-jg");
    types_map->insert("asc", "text/plain");
    types_map->insert("asf", "video/x-ms-asf");
    types_map->insert("asn", "chemical/x-ncbi-asn1-spec");
    types_map->insert("aso", "chemical/x-ncbi-asn1-binary");
    types_map->insert("asx", "video/x-ms-asf");
    types_map->insert("atom", "application/atom+xml");
    types_map->insert("atomcat", "application/atomcat+xml");
    types_map->insert("atomsrv", "application/atomserv+xml");
    types_map->insert("au", "audio/basic");
    types_map->insert("avi", "video/x-msvideo");
    types_map->insert("awb", "audio/amr-wb");
    types_map->insert("axa", "audio/annodex");
    types_map->insert("axv", "video/annodex");
    types_map->insert("b", "chemical/x-molconn-Z");
    types_map->insert("bak", "application/x-trash");
    types_map->insert("bat", "application/x-msdos-program");
    types_map->insert("bcpio", "application/x-bcpio");
    types_map->insert("bib", "text/x-bibtex");
    types_map->insert("bin", "application/octet-stream");
    types_map->insert("bmp", "image/x-ms-bmp");
    types_map->insert("boo", "text/x-boo");
    types_map->insert("book", "application/x-maker");
    types_map->insert("brf", "text/plain");
    types_map->insert("bsd", "chemical/x-crossfire");
    types_map->insert("c", "text/x-csrc");
    types_map->insert("c++", "text/x-c++src");
    types_map->insert("c3d", "chemical/x-chem3d");
    types_map->insert("cab", "application/x-cab");
    types_map->insert("cac", "chemical/x-cache");
    types_map->insert("cache", "chemical/x-cache");
    types_map->insert("cap", "application/cap");
    types_map->insert("cascii", "chemical/x-cactvs-binary");
    types_map->insert("cat", "application/vnd.ms-pki.seccat");
    types_map->insert("cbin", "chemical/x-cactvs-binary");
    types_map->insert("cbr", "application/x-cbr");
    types_map->insert("cbz", "application/x-cbz");
    types_map->insert("cc", "text/x-c++src");
    types_map->insert("cda", "application/x-cdf");
    types_map->insert("cdf", "application/x-cdf");
    types_map->insert("cdr", "image/x-coreldraw");
    types_map->insert("cdt", "image/x-coreldrawtemplate");
    types_map->insert("cdx", "chemical/x-cdx");
    types_map->insert("cdy", "application/vnd.cinderella");
    types_map->insert("cef", "chemical/x-cxf");
    types_map->insert("cer", "chemical/x-cerius");
    types_map->insert("chm", "chemical/x-chemdraw");
    types_map->insert("chrt", "application/x-kchart");
    types_map->insert("cif", "chemical/x-cif");
    types_map->insert("class", "application/java-vm");
    types_map->insert("cls", "text/x-tex");
    types_map->insert("cmdf", "chemical/x-cmdf");
    types_map->insert("cml", "chemical/x-cml");
    types_map->insert("cod", "application/vnd.rim.cod");
    types_map->insert("com", "application/x-msdos-program");
    types_map->insert("cpa", "chemical/x-compass");
    types_map->insert("cpio", "application/x-cpio");
    types_map->insert("cpp", "text/x-c++src");
    types_map->insert("cpt", "image/x-corelphotopaint");
    types_map->insert("cr2", "image/x-canon-cr2");
    types_map->insert("crl", "application/x-pkcs7-crl");
    types_map->insert("crt", "application/x-x509-ca-cert");
    types_map->insert("crw", "image/x-canon-crw");
    types_map->insert("csd", "audio/csound");
    types_map->insert("csf", "chemical/x-cache-csf");
    types_map->insert("csh", "text/x-csh");
    types_map->insert("csm", "chemical/x-csml");
    types_map->insert("csml", "chemical/x-csml");
    types_map->insert("css", "text/css");
    types_map->insert("csv", "text/csv");
    types_map->insert("ctab", "chemical/x-cactvs-binary");
    types_map->insert("ctx", "chemical/x-ctx");
    types_map->insert("cu", "application/cu-seeme");
    types_map->insert("cub", "chemical/x-gaussian-cube");
    types_map->insert("cxf", "chemical/x-cxf");
    types_map->insert("cxx", "text/x-c++src");
    types_map->insert("d", "text/x-dsrc");
    types_map->insert("dat", "application/x-ns-proxy-autoconfig");
    types_map->insert("davmount", "application/davmount+xml");
    types_map->insert("dcr", "application/x-director");
    types_map->insert("deb", "application/x-debian-package");
    types_map->insert("dif", "video/dv");
    types_map->insert("diff", "text/x-diff");
    types_map->insert("dir", "application/x-director");
    types_map->insert("djv", "image/vnd.djvu");
    types_map->insert("djvu", "image/vnd.djvu");
    types_map->insert("dl", "video/dl");
    types_map->insert("dll", "application/x-msdos-program");
    types_map->insert("dmg", "application/x-apple-diskimage");
    types_map->insert("dms", "application/x-dms");
    types_map->insert("doc", "application/msword");
    types_map->insert("docm", "application/vnd.ms-word.document.macroEnabled.12");
    types_map->insert("docx", "application/vnd.openxmlformats-officedocument.wordprocessingml.document");
    types_map->insert("dot", "application/msword");
    types_map->insert("dotm", "application/vnd.ms-word.template.macroEnabled.12");
    types_map->insert("dotx", "application/vnd.openxmlformats-officedocument.wordprocessingml.template");
    types_map->insert("dv", "video/dv");
    types_map->insert("dvi", "application/x-dvi");
    types_map->insert("dx", "chemical/x-jcamp-dx");
    types_map->insert("dxr", "application/x-director");
    types_map->insert("emb", "chemical/x-embl-dl-nucleotide");
    types_map->insert("embl", "chemical/x-embl-dl-nucleotide");
    types_map->insert("eml", "message/rfc822");
    types_map->insert("ent", "chemical/x-pdb");
    types_map->insert("eps", "application/postscript");
    types_map->insert("eps2", "application/postscript");
    types_map->insert("eps3", "application/postscript");
    types_map->insert("epsf", "application/postscript");
    types_map->insert("epsi", "application/postscript");
    types_map->insert("erf", "image/x-epson-erf");
    types_map->insert("es", "application/ecmascript");
    types_map->insert("etx", "text/x-setext");
    types_map->insert("exe", "application/x-msdos-program");
    types_map->insert("ez", "application/andrew-inset");
    types_map->insert("fb", "application/x-maker");
    types_map->insert("fbdoc", "application/x-maker");
    types_map->insert("fch", "chemical/x-gaussian-checkpoint");
    types_map->insert("fchk", "chemical/x-gaussian-checkpoint");
    types_map->insert("fig", "application/x-xfig");
    types_map->insert("flac", "audio/flac");
    types_map->insert("fli", "video/fli");
    types_map->insert("flv", "video/x-flv");
    types_map->insert("fm", "application/x-maker");
    types_map->insert("fodg", "application/vnd.oasis.opendocument.graphics-flat-xml");
    types_map->insert("fodp", "application/vnd.oasis.opendocument.presentation-flat-xml");
    types_map->insert("fods", "application/vnd.oasis.opendocument.spreadsheet-flat-xml");
    types_map->insert("fodt", "application/vnd.oasis.opendocument.text-flat-xml");
    types_map->insert("frame", "application/x-maker");
    types_map->insert("frm", "application/x-maker");
    types_map->insert("gal", "chemical/x-gaussian-log");
    types_map->insert("gam", "chemical/x-gamess-input");
    types_map->insert("gamin", "chemical/x-gamess-input");
    types_map->insert("gan", "application/x-ganttproject");
    types_map->insert("gau", "chemical/x-gaussian-input");
    types_map->insert("gcd", "text/x-pcs-gcd");
    types_map->insert("gcf", "application/x-graphing-calculator");
    types_map->insert("gcg", "chemical/x-gcg8-sequence");
    types_map->insert("gen", "chemical/x-genbank");
    types_map->insert("gf", "application/x-tex-gf");
    types_map->insert("gif", "image/gif");
    types_map->insert("gjc", "chemical/x-gaussian-input");
    types_map->insert("gjf", "chemical/x-gaussian-input");
    types_map->insert("gl", "video/gl");
    types_map->insert("gnumeric", "application/x-gnumeric");
    types_map->insert("gpt", "chemical/x-mopac-graph");
    types_map->insert("gsf", "application/x-font");
    types_map->insert("gsm", "audio/x-gsm");
    types_map->insert("gtar", "application/x-gtar");
    types_map->insert("h", "text/x-chdr");
    types_map->insert("h++", "text/x-c++hdr");
    types_map->insert("hdf", "application/x-hdf");
    types_map->insert("hh", "text/x-c++hdr");
    types_map->insert("hin", "chemical/x-hin");
    types_map->insert("hpp", "text/x-c++hdr");
    types_map->insert("hqx", "application/mac-binhex40");
    types_map->insert("hs", "text/x-haskell");
    types_map->insert("hta", "application/hta");
    types_map->insert("htc", "text/x-component");
    types_map->insert("htm", "text/html");
    types_map->insert("html", "text/html");
    types_map->insert("hxx", "text/x-c++hdr");
    types_map->insert("ica", "application/x-ica");
    types_map->insert("ice", "x-conference/x-cooltalk");
    types_map->insert("ico", "image/x-icon");
    types_map->insert("ics", "text/calendar");
    types_map->insert("icz", "text/calendar");
    types_map->insert("ief", "image/ief");
    types_map->insert("iges", "model/iges");
    types_map->insert("igs", "model/iges");
    types_map->insert("iii", "application/x-iphone");
    types_map->insert("info", "application/x-info");
    types_map->insert("inp", "chemical/x-gamess-input");
    types_map->insert("ins", "application/x-internet-signup");
    types_map->insert("iso", "application/x-iso9660-image");
    types_map->insert("isp", "application/x-internet-signup");
    types_map->insert("ist", "chemical/x-isostar");
    types_map->insert("istr", "chemical/x-isostar");
    types_map->insert("jad", "text/vnd.sun.j2me.app-descriptor");
    types_map->insert("jam", "application/x-jam");
    types_map->insert("jar", "application/java-archive");
    types_map->insert("java", "text/x-java");
    types_map->insert("jdx", "chemical/x-jcamp-dx");
    types_map->insert("jmz", "application/x-jmol");
    types_map->insert("jng", "image/x-jng");
    types_map->insert("jnlp", "application/x-java-jnlp-file");
    types_map->insert("jpe", "image/jpeg");
    types_map->insert("jpeg", "image/jpeg");
    types_map->insert("jpg", "image/jpeg");
    types_map->insert("js", "application/javascript");
    types_map->insert("json", "application/json");
    types_map->insert("kar", "audio/midi");
    types_map->insert("key", "application/pgp-keys");
    types_map->insert("kil", "application/x-killustrator");
    types_map->insert("kin", "chemical/x-kinemage");
    types_map->insert("kml", "application/vnd.google-earth.kml+xml");
    types_map->insert("kmz", "application/vnd.google-earth.kmz");
    types_map->insert("kpr", "application/x-kpresenter");
    types_map->insert("kpt", "application/x-kpresenter");
    types_map->insert("ksh", "text/plain");
    types_map->insert("ksp", "application/x-kspread");
    types_map->insert("kwd", "application/x-kword");
    types_map->insert("kwt", "application/x-kword");
    types_map->insert("latex", "application/x-latex");
    types_map->insert("lha", "application/x-lha");
    types_map->insert("lhs", "text/x-literate-haskell");
    types_map->insert("lin", "application/bbolin");
    types_map->insert("lsf", "video/x-la-asf");
    types_map->insert("lsx", "video/x-la-asf");
    types_map->insert("ltx", "text/x-tex");
    types_map->insert("lyx", "application/x-lyx");
    types_map->insert("lzh", "application/x-lzh");
    types_map->insert("lzx", "application/x-lzx");
    types_map->insert("m1v", "video/mpeg");
    types_map->insert("m3g", "application/m3g");
    types_map->insert("m3u", "audio/x-mpegurl");
    types_map->insert("m3u8", "application/x-mpegURL");
    types_map->insert("m4a", "audio/mpeg");
    types_map->insert("maker", "application/x-maker");
    types_map->insert("man", "application/x-troff-man");
    types_map->insert("manifest", "text/cache-manifest");
    types_map->insert("mcif", "chemical/x-mmcif");
    types_map->insert("mcm", "chemical/x-macmolecule");
    types_map->insert("mdb", "application/msaccess");
    types_map->insert("me", "application/x-troff-me");
    types_map->insert("mesh", "model/mesh");
    types_map->insert("mht", "message/rfc822");
    types_map->insert("mhtml", "message/rfc822");
    types_map->insert("mid", "audio/midi");
    types_map->insert("midi", "audio/midi");
    types_map->insert("mif", "application/x-mif");
    types_map->insert("mkv", "video/x-matroska");
    types_map->insert("mm", "application/x-freemind");
    types_map->insert("mmd", "chemical/x-macromodel-input");
    types_map->insert("mmf", "application/vnd.smaf");
    types_map->insert("mml", "text/mathml");
    types_map->insert("mmod", "chemical/x-macromodel-input");
    types_map->insert("mng", "video/x-mng");
    types_map->insert("moc", "text/x-moc");
    types_map->insert("mol", "chemical/x-mdl-molfile");
    types_map->insert("mol2", "chemical/x-mol2");
    types_map->insert("moo", "chemical/x-mopac-out");
    types_map->insert("mop", "chemical/x-mopac-input");
    types_map->insert("mopcrt", "chemical/x-mopac-input");
    types_map->insert("mov", "video/quicktime");
    types_map->insert("movie", "video/x-sgi-movie");
    types_map->insert("mp2", "audio/mpeg");
    types_map->insert("mp3", "audio/mpeg");
    types_map->insert("mp4", "video/mp4");
    types_map->insert("mpa", "video/mpeg");
    types_map->insert("mpc", "chemical/x-mopac-input");
    types_map->insert("mpe", "video/mpeg");
    types_map->insert("mpeg", "video/mpeg");
    types_map->insert("mpega", "audio/mpeg");
    types_map->insert("mpg", "video/mpeg");
    types_map->insert("mpga", "audio/mpeg");
    types_map->insert("mph", "application/x-comsol");
    types_map->insert("mpv", "video/x-matroska");
    types_map->insert("ms", "application/x-troff-ms");
    types_map->insert("msh", "model/mesh");
    types_map->insert("msi", "application/x-msi");
    types_map->insert("mvb", "chemical/x-mopac-vib");
    types_map->insert("mxf", "application/mxf");
    types_map->insert("mxu", "video/vnd.mpegurl");
    types_map->insert("nb", "application/mathematica");
    types_map->insert("nbp", "application/mathematica");
    types_map->insert("nc", "application/x-netcdf");
    types_map->insert("nef", "image/x-nikon-nef");
    types_map->insert("nwc", "application/x-nwc");
    types_map->insert("nws", "message/rfc822");
    types_map->insert("o", "application/x-object");
    types_map->insert("obj", "application/octet-stream");
    types_map->insert("oda", "application/oda");
    types_map->insert("odb", "application/vnd.sun.xml.base");
    types_map->insert("odc", "application/vnd.oasis.opendocument.chart");
    types_map->insert("odf", "application/vnd.oasis.opendocument.formula");
    types_map->insert("odg", "application/vnd.oasis.opendocument.graphics");
    types_map->insert("odi", "application/vnd.oasis.opendocument.image");
    types_map->insert("odm", "application/vnd.oasis.opendocument.text-master");
    types_map->insert("odp", "application/vnd.oasis.opendocument.presentation");
    types_map->insert("ods", "application/vnd.oasis.opendocument.spreadsheet");
    types_map->insert("odt", "application/vnd.oasis.opendocument.text");
    types_map->insert("oga", "audio/ogg");
    types_map->insert("ogg", "audio/ogg");
    types_map->insert("ogv", "video/ogg");
    types_map->insert("ogx", "application/ogg");
    types_map->insert("old", "application/x-trash");
    types_map->insert("one", "application/onenote");
    types_map->insert("onepkg", "application/onenote");
    types_map->insert("onetmp", "application/onenote");
    types_map->insert("onetoc2", "application/onenote");
    types_map->insert("orc", "audio/csound");
    types_map->insert("orf", "image/x-olympus-orf");
    types_map->insert("otg", "application/vnd.oasis.opendocument.graphics-template");
    types_map->insert("oth", "application/vnd.oasis.opendocument.text-web");
    types_map->insert("otp", "application/vnd.oasis.opendocument.presentation-template");
    types_map->insert("ots", "application/vnd.oasis.opendocument.spreadsheet-template");
    types_map->insert("ott", "application/vnd.oasis.opendocument.text-template");
    types_map->insert("oxt", "application/vnd.openofficeorg.extension");
    types_map->insert("oza", "application/x-oz-application");
    types_map->insert("p", "text/x-pascal");
    types_map->insert("p12", "application/x-pkcs12");
    types_map->insert("p7c", "application/pkcs7-mime");
    types_map->insert("p7r", "application/x-pkcs7-certreqresp");
    types_map->insert("pac", "application/x-ns-proxy-autoconfig");
    types_map->insert("pas", "text/x-pascal");
    types_map->insert("pat", "image/x-coreldrawpattern");
    types_map->insert("patch", "text/x-diff");
    types_map->insert("pbm", "image/x-portable-bitmap");
    types_map->insert("pcap", "application/cap");
    types_map->insert("pcf", "application/x-font");
    types_map->insert("pcf.Z", "application/x-font");
    types_map->insert("pcx", "image/pcx");
    types_map->insert("pdb", "chemical/x-pdb");
    types_map->insert("pdf", "application/pdf");
    types_map->insert("pfa", "application/x-font");
    types_map->insert("pfb", "application/x-font");
    types_map->insert("pfx", "application/x-pkcs12");
    types_map->insert("pgm", "image/x-portable-graymap");
    types_map->insert("pgn", "application/x-chess-pgn");
    types_map->insert("pgp", "application/pgp-signature");
    types_map->insert("php", "application/x-httpd-php");
    types_map->insert("php3", "application/x-httpd-php3");
    types_map->insert("php3p", "application/x-httpd-php3-preprocessed");
    types_map->insert("php4", "application/x-httpd-php4");
    types_map->insert("php5", "application/x-httpd-php5");
    types_map->insert("phps", "application/x-httpd-php-source");
    types_map->insert("pht", "application/x-httpd-php");
    types_map->insert("phtml", "application/x-httpd-php");
    types_map->insert("pk", "application/x-tex-pk");
    types_map->insert("pl", "text/x-perl");
    types_map->insert("pls", "audio/x-scpls");
    types_map->insert("pm", "text/x-perl");
    types_map->insert("png", "image/png");
    types_map->insert("pnm", "image/x-portable-anymap");
    types_map->insert("pot", "text/plain");
    types_map->insert("potm", "application/vnd.ms-powerpoint.template.macroEnabled.12");
    types_map->insert("potx", "application/vnd.openxmlformats-officedocument.presentationml.template");
    types_map->insert("ppa", "application/vnd.ms-powerpoint");
    types_map->insert("ppam", "application/vnd.ms-powerpoint.addin.macroEnabled.12");
    types_map->insert("ppm", "image/x-portable-pixmap");
    types_map->insert("pps", "application/vnd.ms-powerpoint");
    types_map->insert("ppsm", "application/vnd.ms-powerpoint.slideshow.macroEnabled.12");
    types_map->insert("ppsx", "application/vnd.openxmlformats-officedocument.presentationml.slideshow");
    types_map->insert("ppt", "application/vnd.ms-powerpoint");
    types_map->insert("pptm", "application/vnd.ms-powerpoint.presentation.macroEnabled.12");
    types_map->insert("pptx", "application/vnd.openxmlformats-officedocument.presentationml.presentation");
    types_map->insert("prf", "application/pics-rules");
    types_map->insert("prt", "chemical/x-ncbi-asn1-ascii");
    types_map->insert("ps", "application/postscript");
    types_map->insert("psd", "image/x-photoshop");
    types_map->insert("pwz", "application/vnd.ms-powerpoint");
    types_map->insert("py", "text/x-python");
    types_map->insert("pyc", "application/x-python-code");
    types_map->insert("pyo", "application/x-python-code");
    types_map->insert("qgs", "application/x-qgis");
    types_map->insert("qt", "video/quicktime");
    types_map->insert("qtl", "application/x-quicktimeplayer");
    types_map->insert("ra", "audio/x-realaudio");
    types_map->insert("ram", "audio/x-pn-realaudio");
    types_map->insert("rar", "application/rar");
    types_map->insert("ras", "image/x-cmu-raster");
    types_map->insert("rb", "application/x-ruby");
    types_map->insert("rd", "chemical/x-mdl-rdfile");
    types_map->insert("rdf", "application/rdf+xml");
    types_map->insert("rdp", "application/x-rdp");
    types_map->insert("rgb", "image/x-rgb");
    types_map->insert("rhtml", "application/x-httpd-eruby");
    types_map->insert("rm", "audio/x-pn-realaudio");
    types_map->insert("roff", "application/x-troff");
    types_map->insert("ros", "chemical/x-rosdal");
    types_map->insert("rpm", "application/x-redhat-package-manager");
    types_map->insert("rss", "application/rss+xml");
    types_map->insert("rtf", "application/rtf");
    types_map->insert("rtx", "text/richtext");
    types_map->insert("rxn", "chemical/x-mdl-rxnfile");
    types_map->insert("scala", "text/x-scala");
    types_map->insert("sce", "application/x-scilab");
    types_map->insert("sci", "application/x-scilab");
    types_map->insert("sco", "audio/csound");
    types_map->insert("scr", "application/x-silverlight");
    types_map->insert("sct", "text/scriptlet");
    types_map->insert("sd", "chemical/x-mdl-sdfile");
    types_map->insert("sd2", "audio/x-sd2");
    types_map->insert("sda", "application/vnd.stardivision.draw");
    types_map->insert("sdc", "application/vnd.stardivision.calc");
    types_map->insert("sdd", "application/vnd.stardivision.impress");
    types_map->insert("sdf", "chemical/x-mdl-sdfile");
    types_map->insert("sdp", "application/vnd.stardivision.impress");
    types_map->insert("sds", "application/vnd.stardivision.chart");
    types_map->insert("sdw", "application/vnd.stardivision.writer");
    types_map->insert("ser", "application/java-serialized-object");
    types_map->insert("sfv", "text/x-sfv");
    types_map->insert("sgf", "application/x-go-sgf");
    types_map->insert("sgl", "application/vnd.stardivision.writer-global");
    types_map->insert("sgm", "text/x-sgml");
    types_map->insert("sgml", "text/x-sgml");
    types_map->insert("sh", "text/x-sh");
    types_map->insert("shar", "application/x-shar");
    types_map->insert("shp", "application/x-qgis");
    types_map->insert("shtml", "text/html");
    types_map->insert("shx", "application/x-qgis");
    types_map->insert("sid", "audio/prs.sid");
    types_map->insert("sik", "application/x-trash");
    types_map->insert("silo", "model/mesh");
    types_map->insert("sis", "application/vnd.symbian.install");
    types_map->insert("sisx", "x-epoc/x-sisx-app");
    types_map->insert("sit", "application/x-stuffit");
    types_map->insert("sitx", "application/x-stuffit");
    types_map->insert("skd", "application/x-koan");
    types_map->insert("skm", "application/x-koan");
    types_map->insert("skp", "application/x-koan");
    types_map->insert("skt", "application/x-koan");
    types_map->insert("sldm", "application/vnd.ms-powerpoint.slide.macroEnabled.12");
    types_map->insert("sldx", "application/vnd.openxmlformats-officedocument.presentationml.slide");
    types_map->insert("smf", "application/vnd.stardivision.math");
    types_map->insert("smi", "application/smil");
    types_map->insert("smil", "application/smil");
    types_map->insert("snd", "audio/basic");
    types_map->insert("so", "application/octet-stream");
    types_map->insert("spc", "chemical/x-galactic-spc");
    types_map->insert("spl", "application/x-futuresplash");
    types_map->insert("spx", "audio/ogg");
    types_map->insert("sql", "application/x-sql");
    types_map->insert("src", "application/x-wais-source");
    types_map->insert("stc", "application/vnd.sun.xml.calc.template");
    types_map->insert("std", "application/vnd.sun.xml.draw.template");
    types_map->insert("sti", "application/vnd.sun.xml.impress.template");
    types_map->insert("stl", "application/sla");
    types_map->insert("stw", "application/vnd.sun.xml.writer.template");
    types_map->insert("sty", "text/x-tex");
    types_map->insert("sv4cpio", "application/x-sv4cpio");
    types_map->insert("sv4crc", "application/x-sv4crc");
    types_map->insert("svg", "image/svg+xml");
    types_map->insert("svgz", "image/svg+xml");
    types_map->insert("sw", "chemical/x-swissprot");
    types_map->insert("swf", "application/x-shockwave-flash");
    types_map->insert("swfl", "application/x-shockwave-flash");
    types_map->insert("sxc", "application/vnd.sun.xml.calc");
    types_map->insert("sxd", "application/vnd.sun.xml.draw");
    types_map->insert("sxg", "application/vnd.sun.xml.writer.global");
    types_map->insert("sxi", "application/vnd.sun.xml.impress");
    types_map->insert("sxm", "application/vnd.sun.xml.math");
    types_map->insert("sxw", "application/vnd.sun.xml.writer");
    types_map->insert("t", "application/x-troff");
    types_map->insert("tar", "application/x-tar");
    types_map->insert("taz", "application/x-gtar-compressed");
    types_map->insert("tcl", "text/x-tcl");
    types_map->insert("tex", "text/x-tex");
    types_map->insert("texi", "application/x-texinfo");
    types_map->insert("texinfo", "application/x-texinfo");
    types_map->insert("text", "text/plain");
    types_map->insert("tgf", "chemical/x-mdl-tgf");
    types_map->insert("tgz", "application/x-gtar-compressed");
    types_map->insert("thmx", "application/vnd.ms-officetheme");
    types_map->insert("tif", "image/tiff");
    types_map->insert("tiff", "image/tiff");
    types_map->insert("tk", "text/x-tcl");
    types_map->insert("tm", "text/texmacs");
    types_map->insert("torrent", "application/x-bittorrent");
    types_map->insert("tr", "application/x-troff");
    types_map->insert("ts", "video/MP2T");
    types_map->insert("tsp", "application/dsptype");
    types_map->insert("tsv", "text/tab-separated-values");
    types_map->insert("txt", "text/plain");
    types_map->insert("udeb", "application/x-debian-package");
    types_map->insert("uls", "text/iuls");
    types_map->insert("ustar", "application/x-ustar");
    types_map->insert("val", "chemical/x-ncbi-asn1-binary");
    types_map->insert("vcd", "application/x-cdlink");
    types_map->insert("vcf", "text/x-vcard");
    types_map->insert("vcs", "text/x-vcalendar");
    types_map->insert("vmd", "chemical/x-vmd");
    types_map->insert("vms", "chemical/x-vamas-iso14976");
    types_map->insert("vor", "application/vnd.stardivision.writer");
    types_map->insert("vrm", "x-world/x-vrml");
    types_map->insert("vrml", "x-world/x-vrml");
    types_map->insert("vsd", "application/vnd.visio");
    types_map->insert("wad", "application/x-doom");
    types_map->insert("wav", "audio/x-wav");
    types_map->insert("wax", "audio/x-ms-wax");
    types_map->insert("wbmp", "image/vnd.wap.wbmp");
    types_map->insert("wbxml", "application/vnd.wap.wbxml");
    types_map->insert("webm", "video/webm");
    types_map->insert("wiz", "application/msword");
    types_map->insert("wk", "application/x-123");
    types_map->insert("wm", "video/x-ms-wm");
    types_map->insert("wma", "audio/x-ms-wma");
    types_map->insert("wmd", "application/x-ms-wmd");
    types_map->insert("wml", "text/vnd.wap.wml");
    types_map->insert("wmlc", "application/vnd.wap.wmlc");
    types_map->insert("wmls", "text/vnd.wap.wmlscript");
    types_map->insert("wmlsc", "application/vnd.wap.wmlscriptc");
    types_map->insert("wmv", "video/x-ms-wmv");
    types_map->insert("wmx", "video/x-ms-wmx");
    types_map->insert("wmz", "application/x-ms-wmz");
    types_map->insert("wp5", "application/vnd.wordperfect5.1");
    types_map->insert("wpd", "application/vnd.wordperfect");
    types_map->insert("wrl", "x-world/x-vrml");
    types_map->insert("wsc", "text/scriptlet");
    types_map->insert("wsdl", "application/xml");
    types_map->insert("wvx", "video/x-ms-wvx");
    types_map->insert("wz", "application/x-wingz");
    types_map->insert("x3d", "model/x3d+xml");
    types_map->insert("x3db", "model/x3d+binary");
    types_map->insert("x3dv", "model/x3d+vrml");
    types_map->insert("xbm", "image/x-xbitmap");
    types_map->insert("xcf", "application/x-xcf");
    types_map->insert("xht", "application/xhtml+xml");
    types_map->insert("xhtml", "application/xhtml+xml");
    types_map->insert("xlam", "application/vnd.ms-excel.addin.macroEnabled.12");
    types_map->insert("xlb", "application/vnd.ms-excel");
    types_map->insert("xls", "application/vnd.ms-excel");
    types_map->insert("xlsb", "application/vnd.ms-excel.sheet.binary.macroEnabled.12");
    types_map->insert("xlsm", "application/vnd.ms-excel.sheet.macroEnabled.12");
    types_map->insert("xlsx", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
    types_map->insert("xlt", "application/vnd.ms-excel");
    types_map->insert("xltm", "application/vnd.ms-excel.template.macroEnabled.12");
    types_map->insert("xltx", "application/vnd.openxmlformats-officedocument.spreadsheetml.template");
    types_map->insert("xml", "application/xml");
    types_map->insert("xpdl", "application/xml");
    types_map->insert("xpi", "application/x-xpinstall");
    types_map->insert("xpm", "image/x-xpixmap");
    types_map->insert("xsd", "application/xml");
    types_map->insert("xsl", "application/xml");
    types_map->insert("xspf", "application/xspf+xml");
    types_map->insert("xtel", "chemical/x-xtel");
    types_map->insert("xul", "application/vnd.mozilla.xul+xml");
    types_map->insert("xwd", "image/x-xwindowdump");
    types_map->insert("xyz", "chemical/x-xyz");
    types_map->insert("zip", "application/zip");
    types_map->insert("zmt", "chemical/x-mopac-input");
    types_map->insert("~", "application/x-trash");
}

QString iconNameFromFileName(const QString& fileName)
{
    QString mimetype = mimeTypeFromFileName(fileName);

    if (mimetype.isEmpty()) {
        return "";
    }

    if (mimetype == "application/pdf") {
        return "pdf";
    } else if (mimetype.startsWith("image")) {
        return "image";
    } else if (mimetype.startsWith("text")) {
        return "text";
    } else if (mimetype.startsWith("audio")) {
        return "audio";
    } else if (mimetype.startsWith("video")) {
        return "video";
    } else if (mimetype.contains("msword") || mimetype.contains("ms-word")) {
        return "ms_word";
    } else if (mimetype.contains("mspowerpoint") || mimetype.contains("ms-powerpoint")) {
        return "ms_ppt";
    } else if (mimetype.contains("msexcel") || mimetype.contains("ms-excel")) {
        return "ms_excel";
    } else if (mimetype.contains("openxmlformats-officedocument")) {
        // see http://stackoverflow.com/questions/4212861/what-is-a-correct-mime-type-for-docx-pptx-etc
        if (mimetype.contains("wordprocessingml")) {
            return "ms_word";
        } else if (mimetype.contains("spreadsheetml")) {
            return "ms_excel";
        } else if (mimetype.contains("presentationml")) {
            return "ms_ppt";
        }
        // } else if (mimetype.contains("application")) {
        //     return "binary";
    }

    return "";
}

} // namespace

QString mimeTypeFromFileName(const QString& fileName)
{
    if (types_map == 0) {
        init();
    }

    QString suffix = QFileInfo(fileName).suffix().toLower();

    return types_map->value(suffix);
}

QString getIconByFileName(const QString& fileName)
{
    QString icon = iconNameFromFileName(fileName);

    if (icon.isEmpty()) {
        icon = "unknown";
    }

    return QString(":/images/files/file_%1").arg(icon);
}

QString getIconByFileNameV2(const QString& fileName)
{
    QString icon = iconNameFromFileName(fileName);

    return QString(":/images/files_v2/file_%1").arg(icon.isEmpty() ? "unknown" : icon);
}

QString pathJoin(const QString& a,
                 const QString& b)
{
    QStringList list(b);
    return pathJoin(a, list);
}

QString pathJoin(const QString& a,
                 const QString& b,
                 const QString& c)
{
    QStringList list;
    list << b << c;
    return pathJoin(a, list);
}

QString pathJoin(const QString& a,
                 const QString& b,
                 const QString& c,
                 const QString& d)
{
    QStringList list;
    list << b << c << d;
    return pathJoin(a, list);
}

QString pathJoin(const QString& a, const QStringList& rest)
{
    QString result = a;
    foreach (const QString& b, rest) {
        bool resultEndsWithSlash = result.endsWith("/");
        bool bStartWithSlash = b.startsWith("/");
        if (resultEndsWithSlash && bStartWithSlash) {
            result.append(b.right(b.size() - 1));
        } else if (resultEndsWithSlash || bStartWithSlash) {
            result.append(b);
        } else {
            result.append("/" + b);
        }
    }

    return result;
}

bool createDirIfNotExists(const QString& path)
{
    QDir parent_dir = getParentPath(path);
    return parent_dir.mkpath(getBaseName(path));
}

QString getParentPath(const QString& path)
{
    if (path.isEmpty()) {
        return "";
    }

    QString p = QDir::fromNativeSeparators(path);
    int pos = path.lastIndexOf("/", path.endsWith("/") ? -2 : -1);
    if (pos == -1) {
        return "";
    }
    return p.left(pos + 1);
}

QString getBaseName(const QString& path)
{
    if (path.isEmpty()) {
        return "";
    }

    QString p = QDir::fromNativeSeparators(path);
    int pos = path.lastIndexOf("/", path.endsWith("/") ? -2 : -1);
    if (pos == -1) {
        return path;
    }
    return p.mid(pos + 1);
}


text:
layout: page
subheadline: "Tech"
title: "Webcampak 2.0 - Le retour des capteurs"
date: 2012-10-13 21:41:55+00:00
teaser: "Bien que présents dans la précédente version du Webcampak, l'affichage des capteurs était désactivé dans Webcampak 2.0."
header:
    image_fullwidth: "header_typewriter.jpg"
    caption: Image by Florian Klauer
    caption_url: "http://florianklauer.de/"
image:
    thumb:  typewriter_thumb.jpg
    homepage: homepage_typewriter.jpg
categories:
    - Tech
comments: false
show_meta: true
redirect_from:
    - /en/2012/10/13/webcampak-2-0-le-retour-des-capteurs/
    - /fr/2012/10/13/webcampak-2-0-le-retour-des-capteurs/
    - /2012/10/13/webcampak-2-0-le-retour-des-capteurs/
---

Ils sont maintenant de retour. Quand une source dispose de capteurs environmentaux un bouton sera présent pour afficher les mesures enregistrées.

Pour rappel un grand nombre de capteurs différents sont disponibles, les plus fréquemment installés étant la température et l'humidité.

[![]({{ site.urlimg }}blog/2012/10/wpak2.toronto.sensors-1024x436.png)]({{ site.urlimg }}blog/2012/10/wpak2.toronto.sensors.png)

_Cet article a été automatique importé de notre ancien blog, merci de nous excuser pour tout problème d'affichage ou image manquante._


text:
A tiny lib which estimates a memory requirements and sizes of Torch ANN model.

The basic usage is as follow:

	model=nn.Sequential();  -- make a multi-layer perceptron
	model:add(nn.SpatialConvolutionMM(1, 32, 4, 4)) -- output size: 29x29
	model:add(nn.Tanh())
	model:add(nn.SpatialMaxPooling(2, 2, 2, 2)) -- output size 14x14

	model:add(nn.Reshape(32 * 98 * 98, true))

	model:add(nn.Linear(307328, 200))
	model:add(nn.Tanh())

	-- Describe(model)
	estimator = NewEstimatator(model)

	size,dim = estimator({10, 200, 200})
	v,g = readableBytes(size)
	print(string.format('Estimated memory: %d%s (%d), output dimetion %dx%d', v,g,size, dim[1], dim[2]))

The library supports only few basic layer types:
- Sequential
- Linear
- ReLU
- Tanh
- Reshape
- SpatialConvolutionMM
- SpatialMaxPooling


text:
const TCHAR COMMAND_ARG_HELP[] = TEXT("Usage :\r\
\r\
notepad++ [--help] [-multiInst] [-noPlugin] [-lLanguage] [-LlangCode] [-nLineNumber] [-cColumnNumber] [-xPos] [-yPos] [-nosession] [-notabbar] [-ro] [-systemtray] [-loadingTime] [-alwaysOnTop] [-openSession] [-r] [fullFilePathName]\r\
\r\
    --help : This help message\r\
    -multiInst : Launch another Notepad++ instance\r\
    -noPlugin : Launch Notepad++ without loading any plugin\r\
    -l : Launch Notepad++ by applying indicated programming language\r\
         to the file to open\r\
    -L : Launch Notepad++ by applying indicated localization\r\
         langCode is browser language code\r\
    -n : Launch Notepad++ by scrolling indicated line on the file to open\r\
    -c : Launch Notepad++ on scrolling indicated column on the file to open\r\
    -x : Launch Notepad++ by indicating its left side position on the screen\r\
    -y : Launch Notepad++ by indicating its top position on the screen\r\
    -nosession : Launch Notepad++ without any session\r\
    -notabbar : Launch Notepad++ without tabbar\r\
    -ro : Launch Notepad++ and make the file to open read only\r\
    -systemtray : Launch Notepad++ directly in system tray\r\
    -loadingTime : Display Notepad++ loading time\r\
    -alwaysOnTop : Make Notepad++ always on top\r\
    -openSession : Open a specific session. fullFilePathName must be a session file\r\
    -r : Open files recursively. This argument will be ignored\r\
         if fullFilePathName contain no wildcard character\r\
    fullFilePathName : file or folder name to open (absolute or relative path name)\r\
");

class Notepad_plus_Window : public Window {
public:
	Notepad_plus_Window() {};
	void init(HINSTANCE, HWND, const TCHAR *cmdLine, CmdLineParams *cmdLineParams);

	bool isDlgsMsg(MSG *msg) const;

	HACCEL getAccTable() const {
		return _notepad_plus_plus_core.getAccTable();
	};

	bool emergency(generic_string emergencySavedDir) {
		return _notepad_plus_plus_core.emergency(emergencySavedDir);
	};

	bool isPrelaunch() const {
		return _isPrelaunch;
	};

	void setIsPrelaunch(bool val) {
		_isPrelaunch = val;
	};

    virtual void destroy(){
        ::DestroyWindow(_hSelf);
    };

	static const TCHAR * Notepad_plus_Window::getClassName() {
		return _className;
	};
	static HWND gNppHWND;	//static handle to Notepad++ window, NULL if non-existant

private:
	Notepad_plus _notepad_plus_plus_core;
	static LRESULT CALLBACK Notepad_plus_Proc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam);
	LRESULT runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam);

	static const TCHAR _className[32];
	bool _isPrelaunch;
	bool _disablePluginsManager;
};

#endif //NOTEPAD_PLUS_WINDOW_H