code
stringlengths 3
1.05M
| repo_name
stringlengths 4
116
| path
stringlengths 3
942
| language
stringclasses 30
values | license
stringclasses 15
values | size
int32 3
1.05M
|
---|---|---|---|---|---|
from twisted.internet import reactor, defer
from telephus.client import CassandraClient
from telephus.protocol import ManagedCassandraClientFactory
from telephus.cassandra.ttypes import *
import simplejson, collections, os, uuid
json_encode = simplejson.dumps
json_decode = simplejson.loads
try:
import pygtk
pygtk.require("2.0")
except:
pass
import gtk
import gtk.glade
class ChitonViewer(object):
def __init__(self, host=None, port=None):
self.gladefile = os.path.join(os.path.dirname(__file__), "chiton.glade")
self.cmanager = None
self._client = None
self._ksmap = {}
self._currentks = None
self._currentcf = None
self._pageamt = 25
self._maxcomphist = 100
self._lastcol = None
self.columns = None
self.keyspaces = None
self.windowname = "mainWindow"
self.wTree = gtk.glade.XML(self.gladefile, self.windowname)
self.window = self.wTree.get_widget(self.windowname)
self.columnsView = self.wTree.get_widget("columnsView")
self.keyspaceView = self.wTree.get_widget("keyspaceView")
self._loadprefs()
self.columnEntry = self.wTree.get_widget("columnEntry")
self.columnCompletionStore = self._setCompletion(self.columnEntry,
self._prefs['completion']['columnEntry'])
self.rowEntry = self.wTree.get_widget("rowEntry")
self.rowCompletionStore = self._setCompletion(self.rowEntry,
self._prefs['completion']['rowEntry'])
self.columnLabel = self.wTree.get_widget("columnLabel")
self.entryTable = self.wTree.get_widget("entryTable")
self.goButton = self.wTree.get_widget("goButton")
self.pageToolbar = self.wTree.get_widget("pageToolbar")
self.pagePrev = self.wTree.get_widget("prevbutton")
self.pageNext = self.wTree.get_widget("nextbutton")
self.statusbar = self.wTree.get_widget("statusbar")
self.sid = self.statusbar.get_context_id("status")
self.statusbar.push(self.sid, '')
self.goButton.connect("clicked", self.updateView)
self.pageNext.connect("clicked", self.nextPage)
self.pagePrev.connect("clicked", self.prevPage)
self.keyspaceView.get_selection().connect('changed', self.keyspaceChanged)
self.wTree.get_widget("quitmenuitem").connect("activate", self._quit)
self.wTree.get_widget("connectmenuitem").connect("activate", self._connectDialog)
self._resetpages()
self.wTree.signal_autoconnect({
"on_mainWindow_destroy": self._quit,
})
self.window.show()
if host and port:
self._connect(host, port)
def _quit(self, res=None):
if self.cmanager:
self.cmanager.shutdown()
try:
open(self.prefpath, 'w').write(json_encode(self._prefs))
except Exception, e:
print e
reactor.stop()
return False
def _prefpath(self):
return os.path.join(os.path.expanduser('~'), '.chiton.json')
prefpath = property(_prefpath)
def _loadprefs(self):
self._prefs = {}
try:
self._prefs = json_decode(open(self.prefpath).read())
except Exception, e:
print e
def ldict():
return collections.defaultdict(list)
if not self._prefs:
self._prefs = collections.defaultdict(ldict)
def _resetpages(self):
self._currpage = 1
self._firstcol = ''
self._lastcol = ''
self._lastrow = None
def _setCompletion(self, entry, data):
completer = gtk.EntryCompletion()
store = gtk.ListStore(str)
completer.set_model(store)
completer.set_text_column(0)
entry.set_completion(completer)
for item in data:
store.append([item])
return store
def _updateCompletion(self):
row = self.rowEntry.get_text()
column = self.columnEntry.get_text()
if row not in self._prefs['completion']['rowEntry']:
self.rowCompletionStore.append([row])
self._prefs['completion']['rowEntry'].append(row)
if column not in self._prefs['completion']['columnEntry']:
self.columnCompletionStore.append([column])
self._prefs['completion']['columnEntry'].append(column)
for k in ('rowEntry', 'columnEntry'):
if len(self._prefs['completion'][k]) > self._maxcomphist:
self._prefs['completion'][k].pop(0)
def _addcol(self, view, name, colId, width=None):
col = gtk.TreeViewColumn(name, gtk.CellRendererText(), text=colId)
col.set_resizable(True)
if width:
col.set_fixed_width(width)
col.set_sort_column_id(colId)
view.append_column(col)
def _status(self, status):
self.statusbar.pop(self.sid)
self.statusbar.push(self.sid, status)
def _showError(self, err):
errTree = gtk.glade.XML(self.gladefile, "errorDialog")
errorDialog = errTree.get_widget("errorDialog")
errorDialog.set_markup(str(err))
errorDialog.run()
errorDialog.destroy()
@defer.inlineCallbacks
def _connect(self, host, port):
try:
if self.cmanager:
self.cmanager.shutdown()
self.cmanager = ManagedCassandraClientFactory()
print "connecting..."
for x in xrange(3):
reactor.connectTCP(host, int(port), self.cmanager)
yield self.cmanager.deferred
yield self._setupKeyspaces()
self._setupColumns()
except Exception, e:
if self.cmanager:
self.cmanager.shutdown()
self.cmanager = None
self._status(str(e))
self._showError(e)
raise
defer.returnValue(None)
@defer.inlineCallbacks
def _connectDialog(self, source=None):
cdlg = ConnectDialog(self.gladefile)
result, host, port = cdlg.run()
if result == 0:
yield self._connect(host, port)
@defer.inlineCallbacks
def _setupKeyspaces(self):
if self.keyspaces:
self.keyspaces.clear()
for c in self.keyspaceView.get_columns():
self.keyspaceView.remove_column(c)
self._addcol(self.keyspaceView, 'Keyspaces', 0, width=20)
self.keyspaces = gtk.TreeStore(str)
self.keyspaceView.set_model(self.keyspaces)
c = CassandraClient(self.cmanager, '')
self._status("Fetching keyspaces...")
ks = yield c.get_string_list_property('keyspaces')
self._status("Found %s keyspaces" % len(ks))
for i,k in enumerate(ks):
self.keyspaces.append(None, [k])
kiter = self.keyspaces.get_iter(str(i))
self._status("Describing keyspace '%s'..." % k)
r = yield c.describe_keyspace(k)
self._status("Received description of keyspace '%s':"""
"%s column families" % (k, len(r)))
self._ksmap[k] = r
print r
for col, info in r.items():
self.keyspaces.append(kiter, [col])
def _setupColumns(self):
if self.columns:
self.columns.clear()
for c in self.columnsView.get_columns():
self.columnsView.remove_column(c)
self._addcol(self.columnsView, 'Column name', 0)
self._addcol(self.columnsView, 'Value', 1)
self._addcol(self.columnsView, 'Timestamp', 2)
self.columns = gtk.ListStore(str, str, str)
self.columnsView.set_model(self.columns)
def keyspaceChanged(self, selection):
self._resetpages()
tree, path = selection.get_selected_rows()
if path:
if len(path[0]) == 1:
self._currentks = tree[path[0]][0]
self._currentcf = None
self.entryTable.hide()
elif len(path[0]) == 2:
self._currentks = tree[(path[0][0],)][0]
self._currentcf = tree[path[0]][0]
self.entryTable.show()
self.columns.clear()
if self._currentcf:
self._client = CassandraClient(self.cmanager, self._currentks)
cf = self._ksmap[self._currentks][self._currentcf]
if cf['Type'] == 'Super':
self._status("Column family '%s': Type: %s, CompareWith: %s, """
"CompareSubWith: %s" % (self._currentcf, cf['Type'],
cf['CompareWith'], cf['CompareSubcolumnsWith']))
self.columnEntry.show()
self.columnLabel.show()
else:
self._status("Column family '%s': Type: %s, CompareWith: %s """
% (self._currentcf, cf['Type'], cf['CompareWith']))
self.columnEntry.hide()
self.columnLabel.hide()
def decodeColumn(self, column):
unames = ['org.apache.cassandra.db.marshal.TimeUUIDType',
'org.apache.cassandra.db.marshal.LexicalUUIDType']
cf = self._ksmap[self._currentks][self._currentcf]
if cf['Type'] == 'Super':
compare = 'CompareSubcolumnsWith'
else:
compare = 'CompareWith'
if cf[compare] in unames:
return uuid.UUID(bytes=column)
else:
return column
@defer.inlineCallbacks
def updateView(self, source=None, start='', reverse=False):
if source == self.goButton:
self._resetpages()
self._updateCompletion()
try:
if self._ksmap[self._currentks][self._currentcf]['Type'] == 'Super':
path = ColumnParent(column_family=self._currentcf,
super_column=self.columnEntry.get_text())
else:
path = ColumnParent(column_family=self._currentcf)
self._status("Fetching data...")
cols = yield self._client.get_slice(self.rowEntry.get_text(), path,
count=self._pageamt, start=start, reverse=reverse)
self._status("%s columns retrieved" % len(cols))
self.columns.clear()
if reverse:
cols.reverse()
for col in cols:
self.columns.append([self.decodeColumn(col.column.name),
col.column.value, col.column.timestamp])
if cols:
self._firstcol = cols[0].column.name
self._lastcol = cols[-1].column.name
if self._lastrow == self.rowEntry.get_text():
if reverse:
self._currpage -= 1
else:
self._currpage += 1
self._lastrow = self.rowEntry.get_text()
if self._currpage > 1:
self.pagePrev.set_property('sensitive', True)
else:
self.pagePrev.set_property('sensitive', False)
if len(cols) >= self._pageamt:
self.pageNext.set_property('sensitive', True)
else:
self.pageNext.set_property('sensitive', False)
except Exception, e:
self._showError(e)
raise
def nextPage(self, source):
self.updateView(start=self._lastcol)
def prevPage(self, source):
self.updateView(start=self._firstcol, reverse=True)
class ConnectDialog(object):
def __init__(self, gladefile):
self.wTree = gtk.glade.XML(gladefile, "connectDialog")
self.dialog = self.wTree.get_widget("connectDialog")
self.hostEntry = self.wTree.get_widget("hostEntry")
self.portEntry = self.wTree.get_widget("portEntry")
def run(self):
self.result = self.dialog.run()
host, port = self.hostEntry.get_text(), self.portEntry.get_text()
self.dialog.destroy()
return self.result, host, port
| driftx/chiton | chiton/viewer.py | Python | mit | 12,230 |
---
layout: page
title: Joseph Winters's 49th Birthday
date: 2016-05-24
author: Nicholas Cain
tags: weekly links, java
status: published
summary: Proin nec quam eros. Nunc vitae.
banner: images/banner/leisure-04.jpg
booking:
startDate: 11/25/2016
endDate: 11/28/2016
ctyhocn: TIXFLHX
groupCode: JW4B
published: true
---
Quisque ac venenatis nisi. Morbi mattis, neque sed facilisis vehicula, nunc lectus ultrices nunc, bibendum finibus arcu lorem sit amet velit. Donec finibus eget turpis quis auctor. Sed urna sem, molestie quis nulla vitae, porttitor luctus mauris. Pellentesque pretium eros eget massa venenatis, quis hendrerit eros pharetra. Donec ut congue quam. Cras id blandit lectus. Donec maximus quam porta sem pharetra, a sollicitudin elit molestie. Donec dignissim ornare tempus. Quisque feugiat mi ut massa interdum, vitae tempor dui tempus. Cras id congue ligula. Aliquam est dui, sagittis non congue ac, rutrum non dui.
1 Donec ac enim id risus consequat efficitur
1 Sed vel neque ut urna pellentesque pellentesque
1 Donec rhoncus ante sit amet ante pulvinar suscipit
1 Quisque vel sem viverra, auctor arcu ut, pharetra elit
1 Aliquam porta neque ut est lacinia volutpat
1 Nam suscipit nunc quis sagittis dictum.
Vestibulum eu malesuada ligula, euismod placerat mi. Phasellus scelerisque felis et odio sodales ornare. Nullam imperdiet felis id blandit tristique. Praesent at dignissim diam. Suspendisse accumsan placerat risus, sed dapibus erat consequat quis. Mauris vehicula metus at porta tincidunt. Maecenas venenatis semper tellus, ut rutrum lectus aliquam eget. Ut pulvinar convallis ex non aliquam. Aenean consequat ultricies justo, malesuada tristique neque dictum ac. Cras porta magna eu lacus varius mollis eget vitae tortor.
Nam ultricies consectetur tortor, id tristique metus dapibus ac. Integer urna nulla, pretium et libero in, sollicitudin posuere purus. Proin et luctus dolor, lacinia porttitor tellus. Suspendisse id venenatis magna. Quisque id pharetra ex. Vivamus feugiat, leo at rutrum consequat, leo lectus auctor dolor, ut sollicitudin massa erat sed justo. Curabitur facilisis lectus et semper hendrerit. Integer sagittis nisi et magna porta suscipit. Maecenas a molestie tellus.
| KlishGroup/prose-pogs | pogs/T/TIXFLHX/JW4B/index.md | Markdown | mit | 2,228 |
/*jshint camelcase: false */
module.exports = {
API: {
consumer_key: '',
consumer_secret: '',
access_token: '',
access_token_secret: '',
},
track: 'sdjlkflkdsjsdlf',
media: 'media/Patria.jpg'
};
| icosti/Patria | config.js | JavaScript | mit | 243 |
---
layout: default
title: Posters | ptheywood.uk
---
<section id="posters">
<h2 class="sub-header">Posters</h2>
<ul class="pt-list poster-list">
{% assign sorted_poster_years = site.data.posters | sort: 'year' %}
{% for year in sorted_poster_years reversed %}
<li>
<h3>{{ year.year }}</h3>
<ul>
{% assign sorted_posters = year.posters | sort: 'date' %}
{% for poster in sorted_posters reversed %}
<li>
<h4>
"{{ poster.title }}"
</h4>
<h5>
{% if poster.authors %}
{{ poster.authors }}
<br />
{% endif %}
<time>{{ poster.date }}</time>
-
<a href="{{ poster.event_url}}" >{{ poster.event }}</a>
</h5>
<p>{{ poster.note }}</p>
{% if poster.pdf %}
<a class="button" href="{{ poster.pdf }}" target="_blank">PDF</a>
{% endif %}
</li>
{% endfor %}
</ul>
</li>
{% endfor %}
</ul>
</section>
| ptheywood/ptheywood.github.io | posters/index.html | HTML | mit | 1,299 |
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("FindOccurances")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("FindOccurances")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("052aff6a-85e6-4f69-ab15-b68c2f1a79ff")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
| TsvetanMilanov/TelerikAcademyHW | 12_DataStructuresAndAlgorithms/02_LinearDataStructures/LinearDataStructures/FindOccurances/Properties/AssemblyInfo.cs | C# | mit | 1,404 |
#
# The MIT License (MIT)
#
# Copyright (c) 2017 Gaël PORTAY <[email protected]>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
#
CFLAGS += -std=c99 -Werror -Wextra -g
LOADLIBES += -lzmq -lczmq -lprotobuf-c
.PHONY: all
all: zpc-subscriber zpc-publisher
zpc-subscriber zpc-publisher: zpc-message.pb-c.o
%.pb-c.h %.pb-c.c: %.proto
protoc-c --c_out=. $<
.PHONY: test-publisher
test-publisher: zpc-publisher
./$< "tcp://*:5555" test -D
.PHONY: test-subscriber
test-subscriber: zpc-subscriber
./$< "tcp://localhost:5555" test -D
.PHONY: clean
clean:
rm -f *.o *.pb-c.* zpc-subscriber zpc-publisher
| gazoo74/templates | c/zmq+protobuf/Makefile | Makefile | mit | 1,630 |
require "zph/version"
require "thor"
module ZPH
class CLI < Thor
def simplecov
puts <<HERE
require 'simplecov-vim/formatter'
SimpleCov.start do
formatter SimpleCov::Formatter::VimFormatter
end
HERE
end
def simplecov_spec_helper
puts <<HERE
require 'simplecov-vim/formatter'
HERE
end
end
end
| zph/zph_gem | lib/zph.rb | Ruby | mit | 329 |
<?php
namespace Mangati\Cachet\Result\Generic;
use Mangati\Cachet\Result\Envelope;
use JMS\Serializer\Annotation as JMS;
class StringEnvelope implements Envelope
{
/**
* @var string
* @JMS\Type("string")
*/
private $data;
/**
* Get the value of Data
*
* @return string
*/
public function getData()
{
return $this->data;
}
/**
* Set the value of Data
*
* @param string data
*
* @return self
*/
public function setData($data)
{
$this->data = $data;
return $this;
}
}
| mangati/cachet | src/Mangati/Cachet/Result/Generic/StringEnvelope.php | PHP | mit | 600 |
<?php
/**
* @file
* Contains \Drupal\Console\Command\ChainCommand.
*/
namespace Drupal\Console\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Input\InputOption;
class ChainCommand extends Command
{
/**
* {@inheritdoc}
*/
protected function configure()
{
$this
->setName('chain')
->setDescription($this->trans('commands.chain.description'))
->addOption(
'file',
null,
InputOption::VALUE_OPTIONAL,
$this->trans('commands.chain.options.file')
);
}
/**
* {@inheritdoc}
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$message = $this->getMessageHelper();
$interactive = false;
$learning = false;
if ($input->hasOption('learning')) {
$learning = $input->getOption('learning');
}
$file = null;
if ($input->hasOption('file')) {
$file = $input->getOption('file');
}
if (!$file) {
$message->addErrorMessage(
$this->trans('commands.chain.messages.missing_file')
);
return 1;
}
if (strpos($file, '~') === 0) {
$home = rtrim(getenv('HOME') ?: getenv('USERPROFILE'), '/');
$file = realpath(preg_replace('/~/', $home, $file, 1));
}
if (!file_exists($file)) {
$message->addErrorMessage(
sprintf(
$this->trans('commands.chain.messages.invalid_file'),
$file
)
);
return 1;
}
$configData = $this->getApplication()->getConfig()->getFileContents($file);
if (array_key_exists('commands', $configData)) {
$commands = $configData['commands'];
}
foreach ($commands as $command) {
$moduleInputs = [];
$arguments = !empty($command['arguments']) ? $command['arguments'] : [];
$options = !empty($command['options']) ? $command['options'] : [];
foreach ($arguments as $key => $value) {
$moduleInputs[$key] = is_null($value) ? '' : $value;
}
foreach ($options as $key => $value) {
$moduleInputs['--'.$key] = is_null($value) ? '' : $value;
}
$this->getChain()
->addCommand($command['command'], $moduleInputs, $interactive, $learning);
}
}
}
| karmazzin/DrupalConsole | src/Command/ChainCommand.php | PHP | mit | 2,649 |
<?php
/**
* The MIT License (MIT)
*
* Copyright (c) 2016. Michael Karbowiak
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
namespace Thessia\Tasks\Cron;
use League\Container\Container;
use MongoDB\BSON\UTCDatetime;
use MongoDB\Collection;
use Monolog\Logger;
use Thessia\Helper\EVEApi\Account;
use Thessia\Helper\Pheal;
class ApiKeyChecker {
private $container;
public function perform() {
/** @var \MongoClient $mongo */
$mongo = $this->container->get("mongo");
/** @var Logger $log */
$log = $this->container->get("log");
/** @var Pheal $pheal */
$pheal = $this->container->get("pheal");
/** @var Account $account */
$account = $this->container->get("ccpAccount");
/** @var Collection $collection */
$collection = $mongo->selectCollection("thessia", "apiKeys");
if($pheal->is904ed()) {
$log->addInfo("CRON: 904ed..");
exit;
}
$log->addInfo("CRON: Updating API keys");
$date = strtotime(date("Y-m-d H:i:s", strtotime("-6 hour"))) * 1000;
$apiKeys = $collection->aggregate(array(
array('$match' => array("lastValidation" => array("\$lt" => new UTCDatetime($date)))),
array('$limit' => 100)
))->toArray();
foreach ($apiKeys as $api) {
$keyID = $api["keyID"];
$vCode = $api["vCode"];
$keyInfo = $account->accountAPIKeyInfo($keyID, $vCode);
if(isset($keyInfo["result"]) && !empty($keyInfo["result"])) {
foreach ($keyInfo["result"] as $key) {
$keyType = $key["type"];
$accessMask = $key["accessMask"];
$expires = !empty($key["expires"]) ? strtotime($key["expires"]) * 1000 : strtotime("2038-01-01 00:00:00") * 1000;
$keyData = array(
"keyID" => $keyID,
"vCode" => $vCode,
"errorCode" => 0,
"lastValidation" => new UTCDatetime(time() * 1000),
"keyType" => $keyType,
"accessMask" => $accessMask,
"expires" => new UTCDatetime($expires),
);
foreach ($key["characters"] as $char) {
$keyData["characters"][] = array(
"characterID" => (int) $char["characterID"],
"characterName" => $char["characterName"],
"corporationID" => (int) $char["corporationID"],
"corporationName" => $char["corporationName"],
"allianceID" => (int) $char["allianceID"],
"allianceName" => $char["allianceName"],
"factionID" => (int) $char["factionID"],
"factionName" => $char["factionName"],
"isDirector" => (bool) $keyType == "Corporation" ? true : false,
"cachedUntil" => new UTCDatetime(null),
);
}
$collection->replaceOne(array("keyID" => $keyID), $keyData, array("upsert" => true));
}
}
}
exit;
}
/**
* Defines how often the cronjob runs, every 1 second, every 60 seconds, every 86400 seconds, etc.
*/
public function getRunTimes()
{
return 60;
}
public function setUp()
{
$this->container = getContainer();
}
public function tearDown()
{
}
} | new-eden/Thessia | tasks/Cron/ApiKeyChecker.php | PHP | mit | 4,807 |
<!doctype html>
<html>
<head>
<link href='https://fonts.googleapis.com/css?family=Roboto:400,300,700' rel='stylesheet' type='text/css'>
<link href="https://s3.amazonaws.com/codecademy-content/projects/bootstrap.min.css" rel="stylesheet" />
<link href="css/main.css" rel="stylesheet" />
<script src="js/vendor/angular.min.js"></script>
</head>
<body ng-app="OutboxApp">
<div class="header">
<div class="container">
<img src="img/logo.svg" width="140" height="150">
</div>
</div>
<div class="main" ng-controller="HomeController">
<div class="container">
<div class="email" ng-repeat="email in emails">
<span class="from">{{ email.from }}</span> <span class="subject">{{ email.subject }}</span><span class="date">{{ email.datetime | date}}</span>
</div>
</div>
</div>
<!-- Modules -->
<script src="js/app.js"></script>
<!-- Controllers -->
<script src="js/controllers/HomeController.js"></script>
<!-- Services -->
<script src="js/services/emails.js"></script>
</body>
</html>
| leoachear/codecademy_AngularJS | UNIT 3 SERVICES/Project Outbox 1/index.html | HTML | mit | 1,109 |
package ego.gomoku.core;
import java.util.LinkedHashMap;
import java.util.Map;
class Cache {
Config config;
GameMap gameMap;
private QueueMap<Long, Boolean> cacheCombo = new QueueMap<>();
Cache(Config config, GameMap gameMap) {
this.config = config;
this.gameMap = gameMap;
}
void recordComboResult(boolean value) {
if (Config.cacheSize > 0) {
cacheCombo.put(gameMap.getHashCode(), value);
}
}
Boolean getComboResult() {
if (Config.cacheSize > 0) {
if (cacheCombo.containsKey(gameMap.getHashCode())) {
return cacheCombo.get(gameMap.getHashCode());
}
}
return null;
}
public void clear(){
cacheCombo.clear();
}
class QueueMap<K, V> extends LinkedHashMap<K, V> {
protected boolean removeEldestEntry(Map.Entry eldest) {
return size() > Config.cacheSize;
}
}
}
| tangyan02/ego | src/main/java/ego/gomoku/core/Cache.java | Java | mit | 964 |
Imports System.Reflection
Imports System.Runtime.CompilerServices
Imports System.Runtime.InteropServices
' Information about this assembly is defined by the following
' attributes.
'
' change them to the information which is associated with the assembly
' you compile.
<assembly: AssemblyTitle("Hermes")>
<assembly: AssemblyDescription("Web/Email/Files Framework for Building Simple ASP.NET Web Applications")>
' This sets the default COM visibility of types in the assembly to invisible.
' If you need to expose a type to COM, use <ComVisible(true)> on that type.
<assembly: ComVisible(False)>
' The assembly version has following format :
'
' Major.Minor.Build.Revision
'
' You can specify all values by your own or you can build default build and revision
' numbers with the '*' character (the default):
<assembly: AssemblyVersion("1.0.*")> | thiscouldbejd/Hermes | Assembly/AssemblyInfo.vb | Visual Basic | mit | 851 |
var Buffer = require('safe-buffer').Buffer;
var Transform = require('stream').Transform;
var bufUtil = require('./buf-util');
var OPTIONS = { highWaterMark: 0 };
var LF = Buffer.from('\n');
function getBuffer(data) {
return !data || Buffer.isBuffer(data) ? data : Buffer.from(String(data));
}
function pack(data) {
if (!data) {
return Buffer.from('\n0\n');
}
return Buffer.concat([Buffer.from('\n' + data.length + '\n'), data]);
}
exports.pack = function (data) {
return pack(getBuffer(data));
};
exports.getEncodeTransform = function () {
var trans = new Transform(OPTIONS);
trans._transform = function (chunk, _, cb) {
cb(null, pack(chunk));
};
trans.push_ = trans.push;
trans.push = function (chunk, encoding) {
if (chunk) {
return trans.push_(chunk, encoding);
}
};
trans.end_ = trans.end;
trans.end = function (chunk, encoding, callback) {
chunk && trans.write(chunk, encoding, callback);
return trans.end_(function () {
trans.push_(pack());
});
};
return trans;
};
function Parser() {
var buf;
var len = 0;
var parseChunk = function () {
if (len <= 0) {
var index = bufUtil.indexOf(buf, LF, 1);
if (index === -1) {
return;
}
len = parseInt(String(buf.slice(1, index)), 10);
if (!len) {
return false;
}
buf = buf.slice(index + 1);
if (!buf.length) {
return;
}
}
var curLen = len;
var chunk = buf.slice(0, curLen);
len -= chunk.length;
buf = buf.length > curLen ? buf.slice(curLen) : null;
return chunk;
};
var self = this;
self.write = function (chunk) {
if (chunk) {
buf = buf ? Buffer.concat([buf, chunk]) : chunk;
} else if (!buf) {
return;
}
var data = parseChunk();
if (data === false) {
return self.onEnd && self.onEnd();
}
if (!data) {
if (chunk === false) {
return;
}
return self.onContinue && self.onContinue();
}
self.onData && self.onData(data);
self.write(false);
};
}
exports.getDecodeTransform = function () {
var trans = new Transform(OPTIONS);
var parser = new Parser();
var transCb, data;
parser.onEnd = function () {
data && trans.push(data);
trans.push(null);
};
parser.onContinue = function () {
if (transCb) {
transCb();
transCb = null;
}
};
parser.onData = function (chunk) {
data = data ? Buffer.concat([data, chunk]) : chunk;
if (transCb) {
transCb(null, data);
transCb = data = null;
}
};
trans._transform = function (chunk, _, cb) {
transCb = cb;
parser.write(chunk);
};
return trans;
};
| avwo/whistle | lib/util/transproto.js | JavaScript | mit | 2,684 |
#pragma once
#include "Runtime/CIOWin.hpp"
namespace metaforce::MP1 {
class CAudioStateWin : public CIOWin {
public:
CAudioStateWin() : CIOWin("CAudioStateWin") {}
CIOWin::EMessageReturn OnMessage(const CArchitectureMessage& msg, CArchitectureQueue& queue) override;
};
} // namespace metaforce::MP1
| AxioDL/PathShagged | Runtime/MP1/CAudioStateWin.hpp | C++ | mit | 307 |
import { Component, OnInit, Output, Input } from '@angular/core';
//importation du service
import { TaskService } from "../services/tasks.service";
//importation du modèle
import { TaskItem } from "../models/task.item";
@Component({
selector: 'todo-archive-page',
styles: [`h1{font-size:1.5rem`],
templateUrl: 'app/partials/components/todo.archive.component.html',
providers:[TaskService]
})
export class ToDoArchiveComponent implements OnInit{
private collection: TaskItem[];
constructor(
private taskService: TaskService
){};
ngOnInit(): void {
//get tasks for the view
this.taskService.getTasksTodoArchive().then(tasks => this.collection = tasks);
}
}
| timothee-bayart/examen | app/components/ToDoArchiveComponent.ts | TypeScript | mit | 728 |
namespace OggVorbisEncoder.Setup.Templates.BookBlocks.Stereo16.Uncoupled.Chapter1
{
public class Page2_0 : IStaticCodeBook
{
public int Dimensions { get; } = 4;
public byte[] LengthList { get; } = {
3, 4, 4, 5, 6, 6, 5, 6, 6, 5, 6, 6, 6, 7, 8, 6,
7, 8, 5, 6, 6, 6, 8, 7, 6, 8, 7, 5, 6, 6, 6, 8,
8, 6, 8, 8, 6, 8, 8, 7, 7,10, 8, 9, 9, 6, 8, 8,
7, 9, 8, 8, 9,10, 5, 6, 6, 6, 8, 8, 7, 8, 8, 6,
8, 8, 8,10, 9, 7, 8, 9, 6, 8, 8, 8, 9, 9, 7,10,
8,
};
public CodeBookMapType MapType { get; } = (CodeBookMapType)1;
public int QuantMin { get; } = -535822336;
public int QuantDelta { get; } = 1611661312;
public int Quant { get; } = 2;
public int QuantSequenceP { get; } = 0;
public int[] QuantList { get; } = {
1,
0,
2,
};
}
} | vr-the-feedback/vr-the-feedback-unity | Assets/VRTheFeedback/Scripts/OggVorbisEncoder/Setup/Templates/BookBlocks/Stereo16/Uncoupled/Chapter1/Page2_0.cs | C# | mit | 874 |
require 'spec_helper'
describe Salesforce::Configuration do
let(:configuration) { Salesforce::Configuration.new }
before(:each){ configuration.reset }
describe '#reset' do
it 'removes previous cached response' do
configuration.instance_variable_set(:@response, true)
configuration.reset
configuration.instance_variable_get(:@response).should == nil
end
end
describe '#use_defaults' do
specify { configuration.should respond_to(:use_defaults) }
end
describe '#service_path' do
specify { configuration.service_path.should be_a(String) }
end
context 'salesforce interaction' do
describe '#ask_salesforce' do
context 'given valid credentials' do
before do
hydra = Typhoeus::Hydra.hydra
response = Typhoeus::Response.new(
:code => 200, :headers => "",
:body => '{ "access_token": "123", "instance_url":"fubar"}',
:time => 0.3
)
hydra.stub(
:post,
Salesforce.configuration.access_token_url
).and_return(response)
end
specify do
configuration.send(:ask_salesforce).should be_a(Typhoeus::Response)
end
end
end
end
end
| i0rek/salesforce | spec/unit/salesforce/configuration_spec.rb | Ruby | mit | 1,257 |
import Mixin from '@ember/object/mixin';
/*
* Mixin that all controllers/components should implement, if they want to make use of this AdvancedValidations addon
*/
export default Mixin.create({
validations: []
/**
validations:[
{
fields:'model.myAttr',
validator:'NonEmptyValidator'
},
{
fields:'myAttr2',
validator: function(attr){
return true;
}
},
{
fields:['myAttr3', 'myAttr4'],
validator: 'MultipleFieldsValidator'
},
{
fields:
}
]
**/
});
| AnnotationSro/ember-advanced-validations | addon/mixins/adv-validable.js | JavaScript | mit | 516 |
/*
Copyright (c) 2016 Ryan Porter
*/
/**
This node applies an accumulating function to the values of the input array and outputs a single value.
## Attributes
<table>
<tr><th> Attribute Name <th> Short Name <th> Attribute Type
<tr><td> input <td> i <td> doubleArray
<tr><td colspan = "3"> Input values that will be reduced to a single value.
<tr><td> operation <td> op <td> enum
<tr><td colspan = "3"> The operation that will be applied to the `input` values.
@param "No Operation" Output will be 0.0.
@param Sum Output will be the first value plus the remaining values.
@param Difference Output will be the first value minus the remaining values.
@param Average Output will be the average of the input values.
@param Product Output will be the first value times the remaining values.
@param Quotient Output will be the first value divided by the remaining values.
@param Exponent Output will be the first value raised to the remaining values.
@param Min Output will be the smallest value.
@param Max Output will be the largest value.
@param Length Output will be the number of values.
<tr><td> output <td> o <td> double
<tr><td colspan = "3"> The result of the operation.
</table>
*/
#ifndef n_reduceArray_H
#define n_reduceArray_H
#include <maya/MDataBlock.h>
#include <maya/MPlug.h>
#include <maya/MPxNode.h>
#include <maya/MString.h>
#include <maya/MTypeId.h>
class ReduceArrayNode : public MPxNode
{
public:
virtual MStatus compute(const MPlug& plug, MDataBlock& data);
virtual void postConstructor();
static void* creator();
static MStatus initialize();
public:
static MTypeId kNODE_ID;
static MString kNODE_NAME;
static MObject aInput;
static MObject aOperation;
static MObject aOutput;
};
#endif | yantor3d/arrayNodes | src/n_reduce.h | C | mit | 2,301 |
//
// IServiceContainer.h
// CardRecognizer
//
// Created by Vladimir Tchernitski on 09/06/15.
// Copyright (c) 2015 Vladimir Tchernitski. All rights reserved.
//
#ifndef __CardRecognizer__IServiceContainer__
#define __CardRecognizer__IServiceContainer__
#include "IBaseObj.h"
using namespace std;
class IServiceContainer : public IBaseObj, public enable_shared_from_this<IServiceContainer>
{
public:
virtual ~IServiceContainer() {}
public:
virtual bool Initialize() = 0;
virtual shared_ptr<IBaseObj> resolve( const type_info& service ) = 0;
template <class T>
shared_ptr<T> resolve() { return dynamic_pointer_cast<T> (resolve(typeid(T))); }
};
class CServiceContainer;
class IServiceContainerFactory
{
public:
static bool CreateServiceContainer(shared_ptr<IServiceContainer>& serviceContainer);
};
#endif /* defined(__CardRecognizer__IServiceContainer__) */
| zalexej/PayCards_iOS_Source | PayCardsRecognizer/CrossPlatform/Include/IServiceContainer.h | C | mit | 929 |
package ftc.electronvolts.util;
/**
* This file was made by the electronVolts, FTC team 7393
*
* Factory class for InputScaler
* These can be used for joystick scaling
*/
public class Functions {
/**
* A constant function y(x) = c
*
* @param c the constant
* @return the created Function
*/
public static Function constant(final double c) {
return new Function() {
@Override
public double f(double x) {
return c;
}
};
}
/**
* A linear function y(x) = mx + b
*
* @param m the slope
* @param b the y-intercept
* @return the created Function
*/
public static Function linear(final double m, final double b) {
return new Function() {
@Override
public double f(double x) {
return m * x + b;
}
};
}
/**
* A quadratic function y(x) = ax^2 + bx + c
*
* @param a the squared coefficient
* @param b the linear coefficient
* @param c the constant coefficient
* @return the created Function
*/
public static Function quadratic(final double a, final double b, final double c) {
return new Function() {
@Override
public double f(double x) {
return a * x * x + b * x + c;
}
};
}
/**
* A cubic function y(x) = ax^3 + bx^2 + cx + d
*
* @param a the cubed coefficient
* @param b the squared coefficient
* @param c the linear coefficient
* @param d the constant coefficient
* @return the created Function
*/
public static Function cubic(final double a, final double b, final double c, final double d) {
return new Function() {
@Override
public double f(double x) {
return a * x * x * x + b * x * x + c * x + d;
}
};
}
/**
* A polynomial function:
* y(x) = a[n]*x^n + a[n-1]*x^(n-1) + ... + a[2]*x^2 + a[1]*x + a[0]
* note: the first coefficient is the constant term, not the highest term
*
* @param coefficients the constants for each x term
* @return the created Function
*/
public static Function polynomial(final double[] coefficients) {
return new Function() {
@Override
public double f(double x) {
double output = 0;
double xPart = 1;
for (int i = 0; i < coefficients.length; i++) {
output += coefficients[i] * xPart;
xPart *= x;
}
return output;
}
};
}
/**
* The output = the input squared with the sign retained
*
* @return the created Function
*/
public static Function squared() {
return new Function() {
@Override
public double f(double x) {
return x * x * Math.signum(x);
}
};
}
/**
* The output = the input cubed
*
* @return the created Function
*/
public static Function cubed() {
return new Function() {
@Override
public double f(double x) {
return x * x * x;
}
};
}
/**
* @param deadZone the deadzone to use
* @return the created Function
*/
public static Function deadzone(final DeadZone deadZone) {
return new Function() {
@Override
public double f(double x) {
if (deadZone.isInside(x)) {
return 0;
} else {
return x;
}
}
};
}
/**
* limits the input to between min and max
*
* @param min the min value
* @param max the min value
* @return the created Function
*/
public static Function limit(final double min, final double max) {
return new Function() {
@Override
public double f(double x) {
return Utility.limit(x, min, max);
}
};
}
/**
* Combines 2 Functions like a composite function b(a(x))
*
* @param inner a(x)
* @param outer b(x)
* @return the created Function
*/
public static Function composite(final Function inner, final Function outer) {
return new Function() {
@Override
public double f(double x) {
return outer.f(inner.f(x));
}
};
}
/**
* No modification to the input
*
* @return the created Function
*/
public static Function none() {
return new Function() {
@Override
public double f(double x) {
return x;
}
};
}
/**
* Multiplies the input by a constant
*
* @param m the slope
* @return the created Function
*/
public static Function linear(final double m) {
return linear(m, 0);
}
/**
* Logarithmic scaling
*
* @param logBase the base of the logarithm
* @return the created Function
*/
public static Function logarithmic(final double logBase) {
return new Function() {
@Override
public double f(double x) {
if (logBase > 0) {
double sign = Math.signum(x);
x = Math.abs(x);
// a log function including the points (0,0) and (1,1)
return sign * Math.log(logBase * x + 1) / Math.log(logBase + 1);
} else {
return x;
}
}
};
}
/**
* e^ax based scaling
* for a != 0
* y(x) = signum(x) * (e^abs(ax)-1)/(e^a-1)
*
* for a = 0
* y(x) = x
*
*
* @param a constant value that determines how curved the function is
* @return the created Function
*/
public static Function eBased(final double a) {
return new Function() {
@Override
public double f(double x) {
if (a == 0) {
return x;
} else {
double sign = Math.signum(x);
x = Math.abs(x);
// a e-based function including the points (0,0) and (1,1)
return sign * Math.expm1(a*x)/Math.expm1(a);
}
}
};
}
/**
* a line from (-1,-1) to (-x,-y) to (0,0) to (x,y) to (1,1)
*
* @param pointX x
* @param pointY y
* @param maxValue the maximum value of the input
* @return the created Function
*/
public static Function piecewise(double pointX, double pointY, double maxValue) {
final double x = Utility.motorLimit(Math.abs(pointX));
final double y = Utility.motorLimit(Math.abs(pointY));
final double max = Utility.motorLimit(Math.abs(maxValue));
final double slope1;
if (x == 0) {
slope1 = 0;
} else {
slope1 = y / x;
}
final double slope2;
if (x == 1) {
slope2 = 0;
} else {
slope2 = (y - max) / (x - 1);
}
return new Function() {
public double f(double input) {
if (Math.abs(input) < x) {
return slope1 * input;
} else {
return Utility.motorLimit((slope2 * (Math.abs(input) - x) + y) * Math.signum(input));
}
}
};
}
}
| FTC7393/state-machine-framework | src/ftc/electronvolts/util/Functions.java | Java | mit | 7,705 |
'use strict';
function randomClamped() {
return Math.random() - Math.random();
}
function Neuron(inputCount) {
this.weights = [];
for (var i = 0; i <= inputCount; i++) {
// Create random weight between -1 and 1
this.weights.push(randomClamped());
}
}
module.exports = Neuron; | robertleeplummerjr/idea.js | src/hive/neuron.js | JavaScript | mit | 295 |
<?php
namespace Omnipay\Paysafecard\Message;
use Omnipay\Common\Exception\InvalidResponseException;
/**
* Paysafecard Fetch Transaction Request.
*
* @author Alexander Fedra <[email protected]>
* @copyright 2015 DerCoder
* @license http://opensource.org/licenses/mit-license.php MIT
*
* @version 1.1 Paysafecard API Specification
*/
class FetchTransactionRequest extends AbstractRequest
{
/**
* {@inheritdoc}
*/
protected function getMethod()
{
return 'getSerialNumbers';
}
/**
* Get the data for this request.
*
* @throws InvalidRequestException
*
* @return string request data
*/
public function getData()
{
$this->validate(
'username',
'password',
'transactionId',
'currency'
);
$document = new \DOMDocument('1.0', 'utf-8');
$document->formatOutput = false;
$document->createElement('soapenv:Header');
$envelope = $document->appendChild(
$document->createElementNS('http://schemas.xmlsoap.org/soap/envelope/', 'soapenv:Envelope')
);
$envelope->setAttribute('xmlns:urn', 'urn:pscservice');
$body = $envelope->appendChild(
$document->createElement('soapenv:Body')
);
$serialNumbers = $body->appendChild(
$document->createElement('urn:getSerialNumbers')
);
$serialNumbers->appendChild(
$document->createElement('urn:username', $this->getUsername())
);
$serialNumbers->appendChild(
$document->createElement('urn:password', $this->getPassword())
);
$serialNumbers->appendChild(
$document->createElement('urn:mtid', $this->getTransactionId())
);
$serialNumbers->appendChild(
$document->createElement('urn:subId', $this->getSubId())
);
$serialNumbers->appendChild(
$document->createElement('urn:currency', $this->getCurrency())
);
return $document->saveXML();
}
/**
* Create a proper response based on the request.
*
* @param \SimpleXMLElement $xml
*
* @return PurchaseResponse
*
* @throws InvalidResponseException
*/
protected function createResponse(\SimpleXMLElement $xml)
{
return new FetchTransactionResponse($this, $xml);
}
}
| dercoder/omnipay-paysafecard | src/Message/FetchTransactionRequest.php | PHP | mit | 2,431 |
var http = require('http');
http.createServer(function(rqs, res){
res.writeHead(200, {'Content-Type': 'text/html'});
res.end('Hello\n');
}).listen(1234, '127.0.0.1');
console.log("Server is running at 127.0.0.1:1234"); | bangwu/mynode | lession01/app.js | JavaScript | mit | 223 |
package edu.psu.compbio.seqcode.gse.ewok.verbs;
import org.biojava.bio.seq.*;
import java.util.*;
import edu.psu.compbio.seqcode.gse.datasets.general.Region;
import edu.psu.compbio.seqcode.gse.datasets.species.Genome;
import edu.psu.compbio.seqcode.gse.ewok.*;
import edu.psu.compbio.seqcode.gse.ewok.nouns.*;
public class FH2RegionIter implements Iterator<Region> {
private Iterator<Feature> iter;
private Genome g;
public FH2RegionIter(FeatureHolder fh, Genome g) {
iter = fh.features();
this.g = g;
}
public boolean hasNext() {
return iter.hasNext();
}
public Region next() {
Feature f = iter.next();
return new Region(g,
f.getSequence().getName(),
f.getLocation().getMin(),
f.getLocation().getMax());
}
public void remove() {
throw new UnsupportedOperationException("Can't remove from a RH2RegionIter");
}
}
| shaunmahony/seqcode | src/edu/psu/compbio/seqcode/gse/ewok/verbs/FH2RegionIter.java | Java | mit | 982 |
<?php
/*
* This file is part of the yuki package.
* Copyright (c) 2011 olamedia <[email protected]>
*
* Licensed under The MIT License
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/**
* yEvent
*
* @package yuki
* @subpackage events
* @author olamedia
* @license http://www.opensource.org/licenses/mit-license.php MIT
*/
class yEvent implements ArrayAccess{
protected $_subject = null;
protected $_name = '';
protected $_parameters = array();
protected $_processed = false;
protected $_value = null;
public function __construct($name, $subject = null, $parameters = array()){
$this->_name = $name;
$this->_subject = $subject;
$this->_parameters = $parameters;
}
public function setName($name){
$this->_name = $name;
return $this;
}
public function getName(){
return $this->_name;
}
public function setSubject($subject){
$this->_subject = $subject;
return $this;
}
public function getSubject(){
return $this->_subject;
}
public function setProcessed($processed = true){
$this->_processed = (boolean) $processed;
return $this;
}
public function isProcessed(){
return $this->_processed;
}
public function setReturnValue($value){
$this->_value = $value;
return $this;
}
public function getReturnValue(){
return $this->_value;
}
public function hasParameter($name){
return array_key_exists($this->_parameters, $name);
}
public function removeParameter($name){
unset($this->_parameters[$name]);
return $this;
}
public function setParameter($name, $value){
$this->_parameters[$name] = $value;
return $this;
}
public function getParameter($name, $default = null){
if (!array_key_exists($this->_parameters, $name)){
return $default;
}
return $this->_parameters[$name];
}
public function setParameters($paramaters = array()){
$this->_parameters = $paramaters;
return $this;
}
public function getParameters(){
return $this->_parameters;
}
public function hasParameters(){
return!empty($this->_parameters);
}
public function removeParameters(){
$this->_parameters = array();
return $this;
}
public function offsetExists($offset){
return $this->hasParameter($offset);
}
public function offsetSet($offset, $value){
$this->setParameter($offset, $value);
}
public function offsetUnset($offset){
$this->removeParameter($offset);
}
public function offsetGet($offset){
return $this->getParameter($offset);
}
}
| olamedia/yuki | src/events/yEvent.php | PHP | mit | 2,858 |
<!DOCTYPE html>
<html data-require="math graphie graphie-geometry interactive constructions kmatrix">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Compass constructions</title>
<script data-main="../local-only/main.js" src="../local-only/require.js"></script>
<script>
var applyRefFrame = function(coord, rot) {
var rotCoord = [];
rotCoord[0] = Math.cos(rot) * coord[0] - Math.sin(rot) * coord[1];
rotCoord[1] = Math.sin(rot) * coord[0] + Math.cos(rot) * coord[1];
return rotCoord;
};
</script>
</head>
<body>
<div class="exercise">
<div class="vars">
<var id="ROT">(random() < 0.5 ? randRange(10, 80): randRange(100, 170)) * PI / 180</var>
<var id="SLOPE">tan(ROT)</var>
<var id="HGRAPH">0</var>
</div>
<div class="problems">
<div id="perpendicular">
<div class="problem">
<form>
<input onclick="javascript: KhanUtil.construction.addCompass();" type="button" value="Add Compass">
<input onclick="javascript: KhanUtil.construction.addStraightedge();" type="button" value="Add Straightedge">
<input onclick="javascript: KhanUtil.construction.removeAllTools();" type="button" value="Clear">
</form>
<p class="question">
Construct a line perpendicular to the given line.
</p>
<div class="graphie" id="construction">
init({
range: [[-5, 5], [-5, 5]],
scale: 50
});
addMouseLayer();
addConstruction("construction");
var a = applyRefFrame([4, 0], ROT);
var b = applyRefFrame([-4, 0], ROT);
addDummyStraightedge(a, b);
</div>
</div>
<div class="solution" data-type="custom">
<div class="instruction">
Use the compass and straightedge tools to construct
a line perpendicular to the given line.
</div>
<div class="guess">getToolProperties(construction)</div>
<div class="validator-function">
// If there's only one element, it's the given line
if (guess.length === 0) {
return "";
}
// first determine if there is a perp. line within 7 degrees
perp = null;
_.each(guess, function(tool) {
if (tool.first != null) {
ang = atan2(
tool.second.coord[1] - tool.first.coord[1],
tool.second.coord[0] - tool.first.coord[0]);
deg = ang * 180 / PI;
origDeg = ROT * 180 / PI;
if (abs(deg-origDeg+90) < 7 || abs(deg-origDeg-90) < 7) {
perp = tool;
}
}
});
if (perp == null) {
return false;
}
// next make sure there are two compasses,
// each of which are centered on the line
comps = _.filter(guess, function(tool) {
return tool.center != null;
});
if (comps.length < 2) {
return false;
}
onLine = [];
_.each(comps, function(comp1) {
_.each(comps, function(comp2) {
thisSlope = (comp1.center.coord[1] -
comp2.center.coord[1]) / (comp1.center.coord[0]
- comp2.center.coord[0]);
thisYInt = comp1.center.coord[1] -
thisSlope*comp1.center.coord[0];
if (abs(thisSlope - SLOPE) < 0.5 &&
abs(thisYInt) < 0.1) {
onLine = [comp1,comp2];
}
});
});
// Really, Javascript? [] !== []? Fine.
if (onLine.length < 2) {
return false;
}
// now we know that the slope of the straightedge
// is good, and the two compasses are an on the line,
// so if the straightedge has the same y-intercept
// as the y-intercept of the line going between
// the two points of intersection of the two compasses
var a = onLine[0].center.coord[0];
var b = onLine[0].center.coord[1];
var c = onLine[1].center.coord[0];
var d = onLine[1].center.coord[1];
var r = onLine[0].radius;
var s = onLine[1].radius;
var e = c - a;
var f = d - b;
var p = sqrt(pow(e,2) + pow(f,2));
var k = (pow(p,2) + pow(r,2) -
pow(s,2))/(2*p);
var x1 = a + e * k / p + (f / p)
* sqrt(pow(r, 2) - pow(k, 2));
var y1 = b + f * k / p - (e / p)
* sqrt(pow(r, 2) - pow(k, 2));
interYInt = y1 + x1 * (1 / SLOPE);
perpYInt = perp.first.coord[1]
+ perp.first.coord[0] * (1 / SLOPE);
// give some leeway for the y-int when the slope
// is high
return abs(interYInt - perpYInt) < 1;
</div>
<div class="show-guess">
showConstructionGuess(guess);
</div>
</div>
<div class="hints">
<div>
<div class="graphie" data-update="construction">
graph.perp = raphael.set();
graph.perp.push(line(
applyRefFrame([0, 10], ROT),
applyRefFrame([0, -10], ROT), {
strokeWidth: 1,
stroke: BLUE
})).toBack();
</div>
<p>
We could just draw a line and <em>try</em> to make it perpendicular,
but then <strong>we have no guarantee </strong> that it's perfectly perpendicular.
</p>
<p>
How can you guarantee that a line is perpendicular?
</p>
</div>
<div>
<div class="graphie" data-update="construction">
graph.perpPoints = raphael.set();
graph.hintLines = raphael.set();
style({
fill: BLUE,
stroke: null,
}, function() {
graph.perpPoints.push(circle(
applyRefFrame([0, -1], ROT), 0.08));
graph.perpPoints.push(circle(
applyRefFrame([0, 1], ROT), 0.08));
});
graph.perp.push(drawHintLine(
applyRefFrame([0, 0], ROT),
applyRefFrame([0, 1], ROT), 1));
graph.perp.push(drawHintLine(
applyRefFrame([0, 0], ROT),
applyRefFrame([0, -1], ROT), 1));
graph.hintLines.push(drawHintLine(
applyRefFrame([0, -1], ROT),
applyRefFrame([1, 0], ROT), 2));
graph.hintLines.push(drawHintLine(
applyRefFrame([0, 1], ROT),
applyRefFrame([1, 0], ROT), 2));
graph.hintLines.push(drawHintLine(
applyRefFrame([0, -1],ROT),
applyRefFrame([-2, 0],ROT), 3));
graph.hintLines.push(drawHintLine(
applyRefFrame([0, 1],ROT),
applyRefFrame([-2, 0],ROT), 3));
graph.perp.toBack();
graph.hintLines.toBack();
graph.perpPoints.toBack();
</div>
<p>
If we pick <span class="hint_blue">
two points</span> on the perpendicular line
which are an equal distance from the intersection,
they will also be the same distance from every other
point on the line we started with.
</p>
</div>
<div>
<div class="graphie" data-update="construction">
graph.perp.remove();
</div>
<p>
If we don't already have the perpendicular line, is there another way to find the blue points?
</p>
</div>
<div>
<div class="graphie" data-update="construction">
circle(applyRefFrame([1, 0], ROT), 0.08, {
fill: GRAY,
stroke: null
});
circle(applyRefFrame([1, 0], ROT),
eDist(applyRefFrame([0, -1], ROT),
applyRefFrame([1, 0], ROT)), {
stroke: GRAY,
strokeWidth: 1,
fill: "none",
strokeDasharray: "- "
});
</div>
<p>
If we use the compass to put a circle somewhere on the
line, the circle will include all points that are the
same distance from that point, including the two blue
points.
</p>
</div>
<div>
<div class="graphie" data-update="construction">
circle(applyRefFrame([-2, 0], ROT), 0.08, {
fill: GRAY,
stroke: null
});
circle(applyRefFrame([-2, 0], ROT),
eDist(applyRefFrame([0, -1], ROT),
applyRefFrame([-2, 0], ROT)), {
stroke: GRAY,
strokeWidth: 1,
fill: "none",
strokeDasharray: "- "
});
</div>
<p>
We can add a second circle somewhere else on the line
that intersects with the first circle.
</p>
</div>
<div>
<div class="graphie" data-update="construction">
graph.hintLines.remove();
</div>
<p>
The points where the two circles intersect can be used
to draw a perpendicular line.
</p>
</div>
<div>
<div class="graphie" data-update="construction">
graph.perpPoints.attr({fill: GRAY});
line(applyRefFrame([0, 10], ROT),
applyRefFrame([0, -10], ROT), {
strokeWidth: 1,
stroke: GRAY,
strokeDasharray: "- "
}).toBack();
</div>
<p>
Use a straightedge to connect the two points where the
circles intersect. This line is perpendicular to the
given line.
</p>
</div>
</div>
</div>
<div id="parallel">
<div class="vars">
<var id="DEG">ROT * 180/PI - 180</var>
<var id="DY">randRange(3, 5) / 2</var>
<var id="A">applyRefFrame([2, -DY], ROT)</var>
<var id="B">applyRefFrame([-2, -DY], ROT)</var>
<var id="P">applyRefFrame([0, DY], ROT)</var>
<var id="R">1.2</var>
</div>
<div class="problem">
<form>
<input onclick="javascript: KhanUtil.construction.addCompass();" type="button" value="Add Compass">
<input onclick="javascript: KhanUtil.construction.addStraightedge();" type="button" value="Add Straightedge">
<input onclick="javascript: KhanUtil.construction.removeAllTools();" type="button" value="Clear">
</form>
<p class="question">
Construct a line parallel to the given line, going through <code>P</code>.
</p>
<div class="graphie" id="construction">
init({
range: [[-5, 5], [-5, 5]],
scale: 50
});
addMouseLayer();
addConstruction("construction");
addDummyStraightedge(A, B);
addDummyPoint(P);
label(P, "P", SLOPE < 0 ? "left" : "below");
</div>
</div>
<div class="solution" data-type="custom">
<div class="instruction">
Use the compass and straightedge tools to construct
a line parallel to the given line.
</div>
<div class="guess">getToolProperties(construction)</div>
<div class="validator-function">
if (guess.length === 0) {
return "";
}
// Ways to construct a line a given point P that's parallel to a given line L.
// 1. Choose two points, A and B, on L and then use A, B, P to create a parallelogram.
// (This can be done using only compasses - no need to draw the unneeded sides.)
// 2. Draw a line from P that crosses L. Transfer the angle created to P.
// (This is the method suggested in hints)
// 3. Construct two perpendicular lines. Messy, but ok.
// 4. More?
// Common requirements to all(?) good parallel constructions.
// 1) Require that there is one parallel line through P.
// - i.e., the problem is solved!
// 2) There are at least two circles with an intersection point on that line.
// - Some construction has been used to create the line.
// Note that using the tools given, it is possible to simply draw a line one the given one then parallel transport it to P.
// It is also possible to create a "construction" that uses the above parallel transport as part of it.
// Q: Are these two conditions too permissive? Will theses checks be gamed or too easily allow false constructions?
// Lines that go through P
var lines = _.filter(guess, function(tool) {
if (tool.first != null) {
return isPointOnLineSegment([tool.first.coord, tool.second.coord], P, 0.1);
}
});
// Ensure at least one of the lines is at the correct angle **within 5 degrees**
var parallel = _.filter(lines, function(tool) {
var ang = atan2(
tool.second.coord[1] - tool.first.coord[1],
tool.second.coord[0] - tool.first.coord[0]);
// Check angle of line
var deltaAngle = abs(abs(ang - ROT) * 180 / PI - 90);
if (abs(deltaAngle - 90) > 5) {
return false;
} else {
return true;
}
});
if (parallel.length === 0) {
return false;
}
var compasses = _.filter(guess, function(tool) {
if (tool.radius != null) {
return true;
}
});
// Find intersections of compasses that lie on the parallel line
var compassintersections = [];
// Circle intersection code from constructions.js
for (var i=0; i<compasses.length; i++) {
for (var j=0; j<i; j++) {
var a = compasses[i].center.coord[0];
var b = compasses[i].center.coord[1];
var c = compasses[j].center.coord[0];
var d = compasses[j].center.coord[1];
var r = compasses[i].radius;
var s = compasses[j].radius;
var e = c - a;
var f = d - b;
var p = Math.sqrt(Math.pow(e, 2) + Math.pow(f, 2));
var k = (Math.pow(p, 2) + Math.pow(r, 2) - Math.pow(s, 2)) / (2 * p);
var x1 = a + e * k / p + (f / p) * Math.sqrt(Math.pow(r, 2) - Math.pow(k, 2));
var y1 = b + f * k / p - (e / p) * Math.sqrt(Math.pow(r, 2) - Math.pow(k, 2));
var x2 = a + e * k / p - (f / p) * Math.sqrt(Math.pow(r, 2) - Math.pow(k, 2));
var y2 = b + f * k / p + (e / p) * Math.sqrt(Math.pow(r, 2) - Math.pow(k, 2));
if (!isNaN(x1)) {compassintersections.push([x1, y1]);}
if (!isNaN(x2)) {compassintersections.push([x2, y2]);}
}}
var intersections = _.filter(compassintersections, function(compint) {
for (var i=0; i<parallel.length; i++) {
var tool = parallel[i];
return isPointOnLineSegment([tool.first.coord, tool.second.coord], compint, 0.1);
};
});
if (intersections.length > 0) { return true; }
return false;
</div>
<div class="show-guess">
showConstructionGuess(guess);
</div>
</div>
<div class="hints">
<div>
<div class="graphie" data-update="construction">
var dx = 10 * cos(ROT);
var dy = 10 * sin(ROT);
graph.parallel = raphael.set();
graph.parallel.push(line([P[0] - dx, P[1] - dy], [P[0] + dx, P[1] + dy], {
strokeWidth: 1,
stroke: BLUE
})).toBack();
</div>
<p>
We could just draw a line at <code>P</code> and <em>try</em> to make it parallel,
but then <strong>we have no guarantee </strong> that it's perfectly parallel.
</p>
</div>
<div>
<div class="graphie" data-update="construction">
var d = applyRefFrame([-1, DY], ROT);
line([A[0] + d[0] * 10, A[1] + d[1] * 10],
[A[0] - d[0] * 10, A[1] - d[1] * 10], {
strokeWidth: 1,
stroke: BLUE
}).toBack();
graph.angleAP = atan2(P[1] - A[1], P[0] - A[0]);
arc(A, 0.5, graph.angleAP * 180 / PI, DEG, false, {
strokeWidth: 1,
stroke: BLUE
}).toBack();
graph.parallel.push(arc(P, 0.5, graph.angleAP * 180 / PI, DEG, false, {
strokeWidth: 1,
stroke: BLUE
}));
addDummyPoint(A);
label(A, "A", SLOPE < 0 ? "above" : "below");
</div>
<p>
If we did have parallel line and drew a line from a point <code>A</code> on the given line,
through <code>P</code>, then the angle at <code>A</code> must be the same as the angle at <code>P</code>.
</p>
<p>
Therefore, if we copy the angle at <code>A</code> to point <code>P</code>,
we will be able to construct parallel lines.
</p>
</div>
<div>
<div class="graphie" data-update="construction">
var d1 = applyRefFrame([-R, 0], ROT);
var d2 = applyRefFrame([R, 0], graph.angleAP);
graph.p1 = [A[0] + d1[0], A[1] + d1[1]];
graph.p2 = [A[0] + d2[0], A[1] + d2[1]];
graph.p3 = [P[0] + d1[0], P[1] + d1[1]];
graph.p4 = [P[0] + d2[0], P[1] + d2[1]];
circle(graph.p1, 0.08, { stroke: null, fill: BLUE });
circle(graph.p2, 0.08, { stroke: null, fill: BLUE });
graph.hintPoint1 = circle(graph.p3, 0.08, { stroke: null, fill: BLUE });
graph.hintPoint2 = circle(graph.p4, 0.08, { stroke: null, fill: BLUE });
drawHintLine(A, graph.p1, 2).toBack();
drawHintLine(A, graph.p2, 2).toBack();
graph.parallel.push(drawHintLine(graph.p1, graph.p2, 1));
graph.parallel.push(drawHintLine(graph.p3, graph.p4, 1));
graph.parallel.push(drawHintLine(P, graph.p3, 2));
graph.parallel.push(drawHintLine(P, graph.p4, 2));
graph.parallel.toBack();
</div>
<p>
If we construct <span class="hint_blue">a triangle</span> with a vertex at
point <code>A</code>, then construct a triangle with the same side lengths
at and a vertex at point <code>P</code>, the angles at <code>A</code> and
<code>P</code> will be the same.
</p>
</div>
<div>
<div class="graphie" data-update="construction">
graph.parallel.remove();
graph.hintPoint1.remove();
graph.hintPoint2.remove();
circle(A, 0.08, {
stroke: null,
fill: GRAY
});
circle(A, R, {
fill: null,
stroke: GRAY,
strokeWidth: 1,
strokeDasharray: "- "
});
</div>
<p>
We can use a compass centered at <code>A</code> to find all the point a
given distance from <code>A</code>.
</p>
</div>
<div>
<div class="graphie" data-update="construction">
var compassVertex = circle(A, 0.08, {
stroke: null,
fill: GRAY
});
var compassCircumference = circle(A, R, {
fill: null,
stroke: GRAY,
strokeWidth: 1,
strokeDasharray: "- "
});
compassVertex.animate({
cx: scalePoint(P)[0],
cy: scalePoint(P)[1]
}, 1000);
compassCircumference.animate({
cx: scalePoint(P)[0],
cy: scalePoint(P)[1]
}, 1000);
</div>
<p>
We can use a compass <strong>with same radius</strong> centered at <code>P</code>
to find all the points the same distance from <code>P</code>. We can ensure we have
get the same radius by putting the compass at point <code>A</code> first, getting
the radii equal, then moving the compass to point <code>P</code>.
</p>
</div>
<div>
<div class="graphie" data-update="construction">
graph.compassVertex = circle(graph.p2, 0.08, {
stroke: null,
fill: GRAY
}).toBack();
graph.compassCircumference = circle(graph.p2, eDist(graph.p1, graph.p2), {
fill: null,
stroke: GRAY,
strokeWidth: 1,
strokeDasharray: "- "
});
</div>
<p>
To find the distance between the <span class="hint_blue">two points equidistant from <code>A</code></span>
we can add center a compass on one point and change the radius to go through the other point.
</p>
</div>
<div>
<div class="graphie" data-update="construction">
graph.compassVertex.animate({
cx: scalePoint(graph.p4)[0],
cy: scalePoint(graph.p4)[1]
}, 1000);
graph.compassCircumference.animate({
cx: scalePoint(graph.p4)[0],
cy: scalePoint(graph.p4)[1]
}, 1000);
</div>
<p>
Now move the compass to the point where the first compass intersected with the line through <code>P</code>.
</p>
</div>
<div>
<div class="graphie" data-update="construction">
drawHintLine(graph.p1, graph.p2, 1);
drawHintLine(graph.p3, graph.p4, 1);
drawHintLine(P, graph.p3, 2);
drawHintLine(P, graph.p4, 2);
circle(graph.p3, 0.08, { stroke: null, fill: BLUE });
circle(graph.p4, 0.08, { stroke: null, fill: BLUE });
</div>
<p>
Now we can use the point where the two compasses intersect to construct a triangle
with the same side lengths as the triange at point <code>A</code>.
</p>
</div>
<div>
<div class="graphie" data-update="construction">
var dx = 10 * cos(ROT);
var dy = 10 * sin(ROT);
line([P[0] + dx, P[1] + dy], [P[0] - dx, P[1] - dy], {
strokeWidth: 1,
stroke: BLUE
}).toBack();
</div>
<p>
Finally use a straightedge to connect point <code>P</code> to where the two compasses intersect.
This line will be parallel to the original line.
</p>
</div>
</div>
</div>
<div id="bisector">
<div class="problem">
<form>
<input onclick="javascript: KhanUtil.construction.addCompass();" type="button" value="Add Compass">
<input onclick="javascript: KhanUtil.construction.addStraightedge();" type="button" value="Add Straightedge">
<input onclick="javascript: KhanUtil.construction.removeAllTools();" type="button" value="Clear">
</form>
<p class="question">
Construct a perpendicular bisector of the line segment
<code>\overline{AB}</code>.
</p>
<div class="graphie" id="construction">
init({
range: [[-5,5],[-5,5]],
scale: 50
});
addMouseLayer();
addConstruction("construction");
var a = applyRefFrame([1.5, 0], ROT);
var b = applyRefFrame([-1.5, 0], ROT);
a = [roundToNearest(0.01, a[0]),
roundToNearest(0.01, a[1])];
b = [roundToNearest(0.01, b[0]),
roundToNearest(0.01, b[1])];
addDummyStraightedge(a, b, false);
addDummyPoint(a);
addDummyPoint(b);
var offset = "above";
if ((ROT * 180 / PI) > 50 &&
(ROT * 180 / PI) < 90) {
offset = "left";
}
if ((ROT * 180 / PI) < 130 &&
(ROT * 180 / PI) > 90) {
offset = "right";
}
label(a, "A", offset);
label(b, "B", offset);
</div>
</div>
<div class="solution" data-type="custom">
<div class="instruction">
Use the compass and straightedge tools to construct
a perpendicular bisector of <code>\overline{AB}</code>.
</div>
<div class="guess">getToolProperties(construction)</div>
<div class="validator-function">
// If there's only one element, it's the given line
if (guess.length === 0) {
return "";
}
// first determine if there is a perp. line within 7 degrees
perp = null;
_.each(guess, function(tool) {
if (tool.first != null) {
ang = atan2(
tool.second.coord[1] - tool.first.coord[1],
tool.second.coord[0] - tool.first.coord[0]);
deg = ang * 180 / PI;
origDeg = ROT * 180 / PI;
if ((abs(deg - origDeg + 90) % 360) < 7 ||
(abs(deg - origDeg - 90) % 360) < 7) {
perp = tool;
}
}
});
if (perp == null) {
return false;
}
// next make sure there are two compasses,
// each of which are centered on the line,
// with equal radius
comps = _.filter(guess, function(tool) {
return tool.center != null;
});
if (comps.length < 2) {
return false;
}
onLine = [];
_.each(comps, function(comp1) {
_.each(comps, function(comp2) {
thisSlope = (comp1.center.coord[1] - comp2.center.coord[1]) /
(comp1.center.coord[0] - comp2.center.coord[0]);
thisYInt = comp1.center.coord[1] - thisSlope * comp1.center.coord[0];
if (abs(thisSlope - SLOPE) < 0.5 &&
abs(thisYInt) < 0.1 &&
abs(comp1.radius - comp2.radius) < 0.1) {
onLine = [comp1, comp2];
}
});
});
// Really, Javascript? [] !== []? Fine.
if (onLine.length < 2) {
return false;
}
// now we know that the slope of the straightedge
// is good, and the two compasses are an on the line,
// so if the straightedge has the same y-intercept
// as the y-intercept of the line going between
// the two points of intersection of the two compasses
interYInt = 0;
perpYInt = perp.first.coord[1] + perp.first.coord[0] * (1/SLOPE);
return abs(interYInt - perpYInt) < 0.5;
</div>
<div class="show-guess">
showConstructionGuess(guess);
</div>
</div>
<div class="hints">
<div>
<div class="graphie" data-update="construction">
graph.perp = raphael.set();
graph.perp.push(line(
applyRefFrame([0, 10], ROT),
applyRefFrame([0, -10], ROT), {
strokeWidth: 1,
stroke: BLUE
})).toBack();
</div>
<p>
We could just draw a line and <em>try</em> to get it
right, but then <strong>we have no guarantee</strong>
that it's actually perfectly perpendicular or that it
bisects the segment at exactly the midpoint.
</p>
<p>
How can you guarantee that a line is really a
perpendicular bisector?
</p>
</div>
<div>
<div class="graphie" data-update="construction">
graph.hintLines = raphael.set();
style({
fill: BLUE,
stroke: null,
}, function() {
graph.perpPoint1 = circle(
applyRefFrame([0, -1], ROT), 0.08);
graph.perpPoint2 = circle(
applyRefFrame([0, 1], ROT), 0.08);
});
graph.perp.push(drawHintLine(
applyRefFrame([0, 0], ROT),
applyRefFrame([0, 1], ROT), 1));
graph.perp.push(drawHintLine(
applyRefFrame([0, 0], ROT),
applyRefFrame([0, -1], ROT), 1));
graph.hintLines.push(drawHintLine(
applyRefFrame([0, -1], ROT),
applyRefFrame([1.5, 0], ROT), 2));
graph.hintLines.push(drawHintLine(
applyRefFrame([0, 1], ROT),
applyRefFrame([1.5, 0], ROT), 2));
graph.hintLines.push(drawHintLine(
applyRefFrame([0, -1],ROT),
applyRefFrame([-1.5, 0],ROT), 2));
graph.hintLines.push(drawHintLine(
applyRefFrame([0, 1],ROT),
applyRefFrame([-1.5, 0],ROT), 2));
graph.perp.toBack();
graph.hintLines.toBack();
graph.perpPoint1.toBack();
graph.perpPoint2.toBack();
</div>
<p>
If we pick <span class="hint_blue">
two points</span> on the perpendicular bisector
which are an equal distance from the intersection,
they will also be the same distance from both
endpoints of the segment we started with.
</p>
</div>
<div>
<div class="graphie" data-update="construction">
graph.perp.remove();
</div>
<p>
If we don't already have the perpendicular bisector,
is there another way to find the blue points?
</p>
</div>
<div>
<div class="graphie" data-update="construction">
circle(applyRefFrame([1.5, 0], ROT), 0.08, {
fill: GRAY,
stroke: null
});
graph.compass1 = circle(applyRefFrame([1.5, 0], ROT),
eDist(applyRefFrame([0, -1], ROT),
applyRefFrame([1.5, 0], ROT)), {
stroke: GRAY,
strokeWidth: 1,
fill: "none",
strokeDasharray: "- "
}).toBack();
</div>
<p>
If we use the compass to put a circle centered at point
<code>A</code>, the circle will include all points that
are the same distance from point <code>A</code>,
including the two blue points.
</p>
</div>
<div>
<div class="graphie" data-update="construction">
circle(applyRefFrame([-1.5, 0], ROT), 0.08, {
fill: GRAY,
stroke: null
});
graph.compass2 = circle(applyRefFrame([-1.5, 0], ROT),
eDist(applyRefFrame([0, -1], ROT),
applyRefFrame([-2, 0], ROT)), {
stroke: GRAY,
strokeWidth: 1,
fill: "none",
strokeDasharray: "- "
}).toBack();
</div>
<p>
We can add a second circle at point <code>B</code>
that intersects with the first circle.
</p>
</div>
<div>
<div class="graphie" data-update="construction">
graph.hintLines.remove();
</div>
<p>
But wait! We can use these circles to draw a
perpendicular line, <strong>but not a bisector!
</strong> That's because the two circles are different
sizes.
</p>
</div>
<div>
<div class="graphie" data-update="construction">
graph.compass1.animate({
rx: scaleVector(3)[0],
ry: scaleVector(3)[1]
}, 250);
graph.compass2.animate({
rx: scaleVector(3)[0],
ry: scaleVector(3)[1]
}, 250);
graph.perpPoint1.animate({
cx: scalePoint(applyRefFrame(
[0, -3/2 * sqrt(3)], ROT))[0],
cy: scalePoint(applyRefFrame(
[0, -3/2 * sqrt(3)], ROT))[1]
}, 250);
graph.perpPoint2.animate({
cx: scalePoint(applyRefFrame(
[0, 3/2 * sqrt(3)], ROT))[0],
cy: scalePoint(applyRefFrame(
[0, 3/2 * sqrt(3)], ROT))[1]
}, 250);
</div>
<p>
One nice way to make the circles the same size is to
set the radii equal to the distance between
<code>A</code> and <code>B</code>. You can do this by
setting the center at one point and the edge of the
circle at the other.
</p>
</div>
<div>
<div class="graphie" data-update="construction">
graph.perpPoint1.attr({fill: GRAY});
graph.perpPoint2.attr({fill: GRAY});
line(applyRefFrame([0, 10], ROT),
applyRefFrame([0, -10], ROT), {
strokeWidth: 1,
stroke: GRAY,
strokeDasharray: "- "
}).toBack();
</div>
<p>
Use a straightedge to connect the two points where the
circles intersect. This line is the perpendicular
bisector of <code>\overline{AB}</code>.
</p>
</div>
</div>
</div>
<div id="angle-bisect">
<div class="vars" data-apply="replace">
<var id="ROT">randRange(30, 80) * PI / 180</var>
<var id="CENTER">[randRange(-3, 0), 0]</var>
<var id="HGRAPH">1</var>
<var id="A">CENTER</var>
<var id="B">[CENTER[0] + 4, CENTER[1]]</var>
<var id="C">
(function() {
var c = applyRefFrame([4, 0], ROT);
c = [c[0] + CENTER[0], c[1] + CENTER[1]];
c = [roundToNearest(0.01, c[0]),
roundToNearest(0.01, c[1])];
return c;
})()
</var>
</div>
<div class="problem">
<form>
<input onclick="javascript: KhanUtil.construction.addCompass();" type="button" value="Add Compass">
<input onclick="javascript: KhanUtil.construction.addStraightedge();" type="button" value="Add Straightedge">
<input onclick="javascript: KhanUtil.construction.removeAllTools();" type="button" value="Clear">
</form>
<p class="question">
Construct an angle bisector for the given angle.
</p>
<div class="graphie" id="construction">
init({
range: [[-5, 5], [-2, 5]],
scale: 50
});
addMouseLayer();
addConstruction("construction");
addDummyRay(A, B);
addDummyRay(A, C);
</div>
</div>
<div class="solution" data-type="custom">
<div class="instruction">
Use the compass and straightedge tools to construct an angle bisector.
</div>
<div class="guess">getToolProperties(construction)</div>
<div class="validator-function">
if (guess.length === 0) {
return "";
}
// first determine if there is a line bisecting
var bisect = null;
_.each(guess, function(tool) {
if (tool.first != null) {
ang = atan2(
(tool.second.coord[1] - tool.first.coord[1]),
(tool.second.coord[0] - tool.first.coord[0]));
ang = ang < 0 ? ang + PI : ang;
if (abs((ROT / 2) - ang) < 3 * PI / 180) {
bisect = tool;
}
}
});
if (bisect == null) {
return false;
}
// next make sure there is a compass with
// center on the center of the angle such that
// its intersections with the angle are the
// centers of two further compasses (yup)
var middle = null;
var bottom = null;
var top = null;
var comps = _.filter(guess, function(tool) {
return tool.center != null;
});
if (comps.length < 3) {
return false;
}
_.each(comps, function(comp) {
if(eDist(comp.center.coord, CENTER) < 0.5) {
middle = comp;
}
});
if (middle == null) {
return false;
}
var botInter = [];
_.each(comps, function(comp) {
botInter = [CENTER[0] + middle.radius, CENTER[1]];
if (eDist(comp.center.coord, botInter) < 0.5) {
bottom = comp;
}
});
var topInter = [];
_.each(comps, function(comp) {
topInter = [CENTER[0] +
applyRefFrame([middle.radius, 0], ROT)[0], CENTER[1]
+ applyRefFrame([middle.radius, 0], ROT)[1]];
if( eDist(comp.center.coord, topInter) < 0.5) {
top = comp;
}
});
if (bottom == null || top == null) {
return false;
}
return abs(bottom.radius - top.radius) < 0.5;
</div>
<div class="show-guess">showConstructionGuess(guess);</div>
</div>
<div class="hints">
<div>
<div class="graphie" data-update="construction">
var farPoint = [
applyRefFrame([10, 0], ROT / 2)[0] + CENTER[0],
applyRefFrame([10, 0], ROT / 2)[1] + CENTER[1]
];
graph.bisect = line(CENTER, farPoint, {
stroke: BLUE,
strokeWidth: 1
});
graph.bisect.toBack();
</div>
<p>
We could just draw a line and <em>try</em> to make it
bisect the angle, but that's difficult to do
and <strong>there is no guarantee</strong> it's a
perfect bisector.
</p>
</div>
<div>
<div class="graphie" data-update="construction">
graph.hintLines = raphael.set();
graph.intersect1 = [CENTER[0] + 2, CENTER[1]];
graph.intersect2 = [
applyRefFrame([2, 0], ROT)[0] + CENTER[0],
applyRefFrame([2, 0], ROT)[1] + CENTER[1]];
circle(graph.intersect1, 0.08, { stroke: null, fill: BLUE });
circle(graph.intersect2, 0.08, { stroke: null, fill: BLUE });
graph.hintLines.push(drawHintLine(CENTER, graph.intersect1, 1));
graph.hintLines.push(drawHintLine(CENTER, graph.intersect2, 1));
graph.hintLines.push(drawHintLine(graph.intersect1, [
applyRefFrame([2.5, 0], ROT / 2)[0] + CENTER[0],
applyRefFrame([2.5, 0], ROT / 2)[1] + CENTER[1]], 2));
graph.hintLines.push(drawHintLine(graph.intersect2, [
applyRefFrame([2.5, 0], ROT / 2)[0] + CENTER[0],
applyRefFrame([2.5, 0], ROT / 2)[1] + CENTER[1]], 2));
graph.hintLines.push(drawHintLine(graph.intersect1, [
applyRefFrame([4, 0], ROT / 2)[0] + CENTER[0],
applyRefFrame([4, 0], ROT / 2)[1] + CENTER[1]], 3));
graph.hintLines.push(drawHintLine(graph.intersect2, [
applyRefFrame([4, 0], ROT / 2)[0] + CENTER[0],
applyRefFrame([4, 0], ROT / 2)[1] + CENTER[1]], 3));
graph.hintLines.toBack();
</div>
<p>
If we pick <span class="hint_blue">any two points on
the given lines</span> that are the same distance from
the vertex of the angle, every point on the bisector
line will be equidistant from those points.
</p>
</div>
<div>
<div class="graphie" data-update="construction">
circle(CENTER, 0.08, {
stroke: null,
fill: GRAY
});
circle(CENTER, 2, {
fill: null,
stroke: GRAY,
strokeWidth: 1,
strokeDasharray: "- "
});
</div>
<p>
We can use a compass centered at the vertex to find
<span class="hint_blue">two points equidistant from
the vertex</span>.
</p>
</div>
<div>
<div class="graphie" data-update="construction">
graph.bisect.remove();
circle(graph.intersect1, 0.08, {
stroke: null,
fill: GRAY
});
graph.compass1 = circle(graph.intersect1, 1.5, {
fill: null,
stroke: GRAY,
strokeWidth: 1,
strokeDasharray: "- "
});
circle(graph.intersect2, 0.08, {
stroke: null,
fill: GRAY
});
graph.compass2 = circle(graph.intersect2, 1.8, {
fill: null,
stroke: GRAY,
strokeWidth: 1,
strokeDasharray: "- "
});
graph.hintLines.remove();
</div>
<p>
If we use two more compasses centered at each of the
<span class="hint_blue">two points</span>, we can see
that they intersect, <strong>but not on the angle
bisector!</strong> That's because the two circles are
not the same size.
</p>
</div>
<div>
<div class="graphie" data-update="construction">
graph.compass1.animate({
rx: scaleVector(2)[0],
ry: scaleVector(2)[1]
}, 250);
graph.compass2.animate({
rx: scaleVector(2)[0],
ry: scaleVector(2)[1]
}, 250);
</div>
<p>
A nice way to make the circles the same size is to
set the edges of both circles so they pass through the
vertex.
</p>
</div>
<div>
<div class="graphie" data-update="construction">
circle([CENTER[0] + 2 + 2 * cos(ROT), CENTER[1] + 2 * sin(ROT)], 0.08, {
stroke: null,
fill: GRAY
});
line([
applyRefFrame([-10, 0], ROT / 2)[0] + CENTER[0],
applyRefFrame([-10 , 0], ROT / 2)[1] + CENTER[1]
], [
applyRefFrame([10, 0], ROT / 2)[0] + CENTER[0],
applyRefFrame([10 , 0], ROT / 2)[1] + CENTER[1]
], {
stroke: GRAY,
strokeWidth: 1,
strokeDasharray: "- "
});
</div>
<p>
Use a straightedge to connect the vertex to the point
where the last two circles intersect. This line is the
angle bisector.
</p>
</div>
</div>
</div>
<div id="copy-segment">
<div class="vars">
<var id="LENGTH">randRange(3, 6) / 2</var>
<var id="DY">randRange(2, 4) / 2</var>
<var id="A">applyRefFrame([LENGTH / 2, -DY], ROT)</var>
<var id="B">applyRefFrame([-LENGTH / 2, -DY], ROT)</var>
<var id="P">applyRefFrame([0, DY], ROT)</var>
</div>
<div class="problem">
<form>
<input onclick="javascript: KhanUtil.construction.addCompass();" type="button" value="Add Compass">
<input onclick="javascript: KhanUtil.construction.addStraightedge(false);" type="button" value="Add Straightedge">
<input onclick="javascript: KhanUtil.construction.removeAllTools();" type="button" value="Clear">
</form>
<p class="question">
Construct a line the same length as <code>\overline{AB}</code>, with one end at <code>P</code>.
</p>
<div class="graphie" id="construction">
init({
range: [[-5, 5], [-5, 5]],
scale: 50
});
addMouseLayer();
addConstruction("construction");
addDummyStraightedge(A, B, false);
addDummyPoint(A);
addDummyPoint(B);
addDummyPoint(P);
var label_position = abs(SLOPE) > 1.5 ? "left" : "below"
label(A, "A", label_position);
label(B, "B", label_position);
label(P, "P", "below");
</div>
</div>
<div class="solution" data-type="custom">
<div class="instruction">
Use the compass and straightedge tools to construct
a line the same length as <code>\overline{AB}</code>.
</div>
<div class="guess">getToolProperties(construction)</div>
<div class="validator-function">
if (guess.length === 0) {
return "";
}
// Ensure there is a line at P of the correct length
var line = _.any(guess, function(tool) {
return tool.first != null &&
(eDist(tool.first.coord, P) < 0.5 || eDist(tool.second.coord, P) < 0.5) &&
abs(eDist(tool.first.coord, tool.second.coord) - LENGTH) < 0.5;
});
if (!line) {
return false;
}
// Ensure there is a compass at P of the correct length
var compass = findCompass(guess, { cx: P[0], cy: P[1], radius: LENGTH });
return compass.length === 1;
</div>
<div class="show-guess">
showConstructionGuess(guess);
</div>
</div>
<div class="hints">
<div>
<div class="graphie" data-update="construction">
graph.p1 = [P[0] + LENGTH * cos(ROT), P[1] + LENGTH * sin(ROT)];
graph.segment = line(P, graph.p1, {
strokeWidth: 1,
stroke: BLUE,
extend: false
}).toBack();
graph.lineEnd = circle(graph.p1, 0.08, {
stroke: null,
fill: BLUE
});
</div>
<p>
We could just draw a line at <code>P</code> and <em>try</em> to
make it the same length as <code>\overline{AB}</code>, but then
<strong>we have no guarantee </strong> that it's actually the same length.
</p>
<p>How could we find all the points the correct length from <code>P</code>?</p>
</div>
<div>
<div class="graphie" data-update="construction">
graph.segment.remove();
graph.lineEnd.remove();
graph.compassVertex = circle(A, 0.08, {
stroke: null,
fill: GRAY
});
graph.compassCircumference = circle(A, LENGTH, {
fill: null,
stroke: GRAY,
strokeWidth: 1,
strokeDasharray: "- "
});
</div>
<p>
If we center a compass on <code>A</code> and set its radius such that it
intersects <code>B</code>, then we will have a compass with a radius of
the correct length.
</p>
</div>
<div>
<div class="graphie" data-update="construction">
graph.compassVertex.animate({
cx: scalePoint(P)[0],
cy: scalePoint(P)[1]
}, 1000);
graph.compassCircumference.animate({
cx: scalePoint(P)[0],
cy: scalePoint(P)[1]
}, 1000);
</div>
<p>Now we can move the compass to <code>P</code>.</p>
</div>
<div>
<div class="graphie" data-update="construction">
graph.segment = line(P, graph.p1, {
strokeWidth: 1,
stroke: BLUE,
extend: false
}).toBack();
graph.lineEnd = circle(graph.p1, 0.08, {
stroke: null,
fill: BLUE
});
</div>
<p>Finally use a straightedge to connect point <code>P</code> to any point on the compass circumference.</p>
</div>
</div>
</div>
<div id="copy-angle">
<div class="vars" data-apply="replace">
<var id="ROT">randRange(30, 80) * PI / 180</var>
<var id="CENTER">[randFromArray([-2, 2]), 0]</var>
<var id="HGRAPH">1</var>
<var id="A">[CENTER[0] - 1.5, CENTER[1]]</var>
<var id="B">[CENTER[0] + 1.5, CENTER[1]]</var>
<var id="C">
(function() {
var c = applyRefFrame([3, 0], ROT);
c = [c[0] + A[0], c[1] + CENTER[1]];
c = [roundToNearest(0.01, c[0]),
roundToNearest(0.01, c[1])];
return c;
})()
</var>
<var id="P">[-CENTER[0] - 1, 2.5]</var>
</div>
<div class="problem">
<form>
<input onclick="javascript: KhanUtil.construction.addCompass();" type="button" value="Add Compass">
<input onclick="javascript: KhanUtil.construction.addStraightedge(false);" type="button" value="Add Straightedge">
<input onclick="javascript: KhanUtil.construction.removeAllTools();" type="button" value="Clear">
</form>
<p class="question">
Construct a copy of angle <code>\angle BAC</code> with the vertex at point <code>P</code>.
</p>
<div class="graphie" id="construction">
init({
range: [[-5, 5], [-2, 5]],
scale: 50
});
addMouseLayer();
addConstruction("construction");
addDummyRay(A, B);
addDummyRay(A, C);
addDummyPoint(P);
label(A, "A", "below");
label(B, "B", "below");
label(C, "C", "above");
label(P, "P", "below");
</div>
</div>
<div class="solution" data-type="custom">
<div class="instruction">
Use the compass and straightedge tools to copy <code>\angle BAC</code> to <code>P</code>.
</div>
<div class="guess">getToolProperties(construction)</div>
<div class="validator-function">
if (guess.length === 0) {
return "";
}
// Find two lines going through P
var lines = _.filter(guess, function(tool) {
return tool.first != null &&
(eDist(tool.first.coord, P) < 0.5 || eDist(tool.second.coord, P) < 0.5)
});
if (lines.length !== 2) {
return false;
}
// Find angles in degrees for the two lines
var angles = _.map(lines, function(tool) {
var p1, p2;
if (eDist(tool.first.coord, P) < 0.5) {
p1 = tool.first.coord;
p2 = tool.second.coord;
} else {
p1 = tool.second.coord;
p2 = tool.first.coord;
}
return atan2(p1[1] - p2[1], p1[0] - p2[0]);
});
// Find smallest angle between lines
var angle1 = angles[0] * 180 / PI;
var angle2 = angles[1] * 180 / PI;
angle1 += (angle1 < 0) ? 180 : 0;
angle2 += (angle2 < 0) ? 180 : 0;
var deltaAngle = min(180 - abs(angle1 - angle2), abs(angle1 - angle2));
if (abs(deltaAngle - ROT * 180 / PI) > 3) {
return false;
}
// Ensure there is a compass centered on P and find its radius
var compass1 = findCompass(guess, { cx: P[0], cy: P[1] });
if (compass1.length !== 1) {
return false;
}
// Ensure there is a compass centered on p1 or p2 with correct radius
var r = compass1[0].radius;
var p1 = [P[0] - r * cos(angles[0]), P[1] - r * sin(angles[0])];
var p2 = [P[0] - r * cos(angles[1]), P[1] - r * sin(angles[1])];
// Radius, r2, will be base of an isosceles with one angle of ROT and two sides of r
var angle = (PI - ROT) / 2;
var r2 = 2 * r * cos(angle);
var compass2 = findCompass(guess, { cx: p1[0], cy: p1[1], radius: r2 });
var compass3 = findCompass(guess, { cx: p2[0], cy: p2[1], radius: r2 });
return (compass2.length === 1 || compass3.length === 1);
</div>
<div class="show-guess">showConstructionGuess(guess);</div>
</div>
<div class="hints">
<div>
<div class="graphie" data-update="construction">
line(P, [P[0] + 2.5, P[1]], {
strokeWidth: 1,
stroke: BLUE
}).toBack();
circle([P[0] + 2.5, P[1]], 0.08, {
stroke: null,
fill: BLUE
});
</div>
<p>First we need to draw a line through <code>P</code>.</p>
</div>
<div>
<div class="graphie" data-update="construction">
graph.p4 = [applyRefFrame([2, 0], ROT)[0] + P[0], applyRefFrame([2, 0], ROT)[1] + P[1]];
graph.hintLines = raphael.set();
graph.hintLines.push(line(P, graph.p4, {
strokeWidth: 1,
stroke: BLUE
})).toBack();
graph.hintPoint = circle(graph.p4, 0.08, { stroke: null, fill: BLUE });
</div>
<p>
We could just draw a second line through <code>P</code> and <em>try</em> to
make the angle the same as <code>\angle BAC</code>, but that's difficult to do
and <strong>there is no guarantee</strong> the angle will be exactly the same.
</p>
</div>
<div>
<div class="graphie" data-update="construction">
graph.p1 = [A[0] + 2, A[1]];
graph.p2 = [applyRefFrame([2, 0], ROT)[0] + A[0], applyRefFrame([2, 0], ROT)[1] + A[1]];
graph.p3 = [P[0] + 2, P[1]];
circle(graph.p1, 0.08, { stroke: null, fill: BLUE });
circle(graph.p2, 0.08, { stroke: null, fill: BLUE });
drawHintLine(A, graph.p1, 2).toBack();
drawHintLine(A, graph.p2, 2).toBack();
graph.hintLines.push(drawHintLine(graph.p1, graph.p2, 1));
graph.hintLines.push(drawHintLine(graph.p3, graph.p4, 1));
graph.hintLines.push(drawHintLine(P, graph.p3, 2));
graph.hintLines.push(drawHintLine(P, graph.p4, 2));
graph.hintLines.toBack();
</div>
<p>
If we construct <span class="hint_blue">a triangle</span> with a vertex at
point <code>A</code>, then construct a triangle with the same side lengths
at and a vertex at point <code>P</code>, the angles at <code>A</code> and
<code>P</code> will be the same.
</p>
</div>
<div>
<div class="graphie" data-update="construction">
graph.hintLines.remove();
graph.hintPoint.remove();
circle(A, 0.08, {
stroke: null,
fill: GRAY
});
circle(A, 2, {
fill: null,
stroke: GRAY,
strokeWidth: 1,
strokeDasharray: "- "
});
</div>
<p>
We can use a compass centered at <code>A</code> to find
<span class="hint_blue">two points equidistant from <code>A</code></span>.
</p>
</div>
<div>
<div class="graphie" data-update="construction">
var compassVertex = circle(A, 0.08, {
stroke: null,
fill: GRAY
});
var compassCircumference = circle(A, 2, {
fill: null,
stroke: GRAY,
strokeWidth: 1,
strokeDasharray: "- "
});
compassVertex.animate({
cx: scalePoint(P)[0],
cy: scalePoint(P)[1]
}, 1000);
compassCircumference.animate({
cx: scalePoint(P)[0],
cy: scalePoint(P)[1]
}, 1000);
// This should appear later
circle(graph.p3, 0.08, { stroke: null, fill: BLUE });
drawHintLine(P, graph.p3, 2);
</div>
<p>
We can use a compass <strong>with same radius</strong> centered at <code>P</code>
to find all the points the same distance from <code>P</code>. We can ensure we have
get the same radius by putting the compass at point <code>A</code> first, getting
the radii equal, then moving the compass to point <code>P</code>.
</p>
</div>
<div>
<div class="graphie" data-update="construction">
graph.compassVertex = circle(graph.p1, 0.08, {
stroke: null,
fill: GRAY
});
graph.compassCircumference = circle(graph.p1, eDist(graph.p1, graph.p2), {
fill: null,
stroke: GRAY,
strokeWidth: 1,
strokeDasharray: "- "
});
</div>
<p>
To find the distance between the <span class="hint_blue">two points equidistant from <code>A</code></span>
we can add center a compass on one point and change the radius to go through the other point.
</p>
</div>
<div>
<div class="graphie" data-update="construction">
graph.compassVertex.animate({
cx: scalePoint(graph.p3)[0],
cy: scalePoint(graph.p3)[1]
}, 1000);
graph.compassCircumference.animate({
cx: scalePoint(graph.p3)[0],
cy: scalePoint(graph.p3)[1]
}, 1000);
</div>
<p>
Now move the compass to the point where the first compass intersected with the line through <code>P</code>.
</p>
</div>
<div>
<div class="graphie" data-update="construction">
var dx = 10 * cos(ROT);
var dy = 10 * sin(ROT);
drawHintLine(P, graph.p4, 2);
drawHintLine(graph.p3, graph.p4, 1);
line(P, graph.p4, {
strokeWidth: 1,
stroke: BLUE
}).toBack();
line(P, graph.p4, {
strokeWidth: 1,
stroke: BLUE
}).toBack();
circle(graph.p4, 0.08, { stroke: null, fill: BLUE });
</div>
<p>
Finally use a straightedge to connect point <code>P</code> to where the two compasses intersect.
The angle formed at point <code>P</code> will be the same as <code>\angle BAC</code>.
</p>
</div>
</div>
</div>
</div>
</div>
</body>
</html>
| sushantceb/demo | ke/exercises/constructions_1.html | HTML | mit | 75,138 |
// flow-typed signature: bba8a13d5ff7e182551ae885b5b550e2
// flow-typed version: <<STUB>>/eslint-plugin-ava_v^5.1.1/flow_v0.77.0
/**
* This is an autogenerated libdef stub for:
*
* 'eslint-plugin-ava'
*
* Fill this stub out by replacing all the `any` types.
*
* Once filled out, we encourage you to share your work with the
* community by sending a pull request to:
* https://github.com/flowtype/flow-typed
*/
declare module 'eslint-plugin-ava' {
declare module.exports: any;
}
/**
* We include stubs for each file inside this npm package in case you need to
* require those files directly. Feel free to delete any files that aren't
* needed.
*/
declare module 'eslint-plugin-ava/create-ava-rule' {
declare module.exports: any;
}
declare module 'eslint-plugin-ava/rules/assertion-arguments' {
declare module.exports: any;
}
declare module 'eslint-plugin-ava/rules/assertion-message' {
declare module.exports: any;
}
declare module 'eslint-plugin-ava/rules/max-asserts' {
declare module.exports: any;
}
declare module 'eslint-plugin-ava/rules/no-async-fn-without-await' {
declare module.exports: any;
}
declare module 'eslint-plugin-ava/rules/no-cb-test' {
declare module.exports: any;
}
declare module 'eslint-plugin-ava/rules/no-duplicate-modifiers' {
declare module.exports: any;
}
declare module 'eslint-plugin-ava/rules/no-identical-title' {
declare module.exports: any;
}
declare module 'eslint-plugin-ava/rules/no-ignored-test-files' {
declare module.exports: any;
}
declare module 'eslint-plugin-ava/rules/no-import-test-files' {
declare module.exports: any;
}
declare module 'eslint-plugin-ava/rules/no-invalid-end' {
declare module.exports: any;
}
declare module 'eslint-plugin-ava/rules/no-nested-tests' {
declare module.exports: any;
}
declare module 'eslint-plugin-ava/rules/no-only-test' {
declare module.exports: any;
}
declare module 'eslint-plugin-ava/rules/no-skip-assert' {
declare module.exports: any;
}
declare module 'eslint-plugin-ava/rules/no-skip-test' {
declare module.exports: any;
}
declare module 'eslint-plugin-ava/rules/no-statement-after-end' {
declare module.exports: any;
}
declare module 'eslint-plugin-ava/rules/no-todo-implementation' {
declare module.exports: any;
}
declare module 'eslint-plugin-ava/rules/no-todo-test' {
declare module.exports: any;
}
declare module 'eslint-plugin-ava/rules/no-unknown-modifiers' {
declare module.exports: any;
}
declare module 'eslint-plugin-ava/rules/prefer-async-await' {
declare module.exports: any;
}
declare module 'eslint-plugin-ava/rules/prefer-power-assert' {
declare module.exports: any;
}
declare module 'eslint-plugin-ava/rules/test-ended' {
declare module.exports: any;
}
declare module 'eslint-plugin-ava/rules/test-title' {
declare module.exports: any;
}
declare module 'eslint-plugin-ava/rules/use-t-well' {
declare module.exports: any;
}
declare module 'eslint-plugin-ava/rules/use-t' {
declare module.exports: any;
}
declare module 'eslint-plugin-ava/rules/use-test' {
declare module.exports: any;
}
declare module 'eslint-plugin-ava/rules/use-true-false' {
declare module.exports: any;
}
declare module 'eslint-plugin-ava/util' {
declare module.exports: any;
}
// Filename aliases
declare module 'eslint-plugin-ava/create-ava-rule.js' {
declare module.exports: $Exports<'eslint-plugin-ava/create-ava-rule'>;
}
declare module 'eslint-plugin-ava/index' {
declare module.exports: $Exports<'eslint-plugin-ava'>;
}
declare module 'eslint-plugin-ava/index.js' {
declare module.exports: $Exports<'eslint-plugin-ava'>;
}
declare module 'eslint-plugin-ava/rules/assertion-arguments.js' {
declare module.exports: $Exports<'eslint-plugin-ava/rules/assertion-arguments'>;
}
declare module 'eslint-plugin-ava/rules/assertion-message.js' {
declare module.exports: $Exports<'eslint-plugin-ava/rules/assertion-message'>;
}
declare module 'eslint-plugin-ava/rules/max-asserts.js' {
declare module.exports: $Exports<'eslint-plugin-ava/rules/max-asserts'>;
}
declare module 'eslint-plugin-ava/rules/no-async-fn-without-await.js' {
declare module.exports: $Exports<'eslint-plugin-ava/rules/no-async-fn-without-await'>;
}
declare module 'eslint-plugin-ava/rules/no-cb-test.js' {
declare module.exports: $Exports<'eslint-plugin-ava/rules/no-cb-test'>;
}
declare module 'eslint-plugin-ava/rules/no-duplicate-modifiers.js' {
declare module.exports: $Exports<'eslint-plugin-ava/rules/no-duplicate-modifiers'>;
}
declare module 'eslint-plugin-ava/rules/no-identical-title.js' {
declare module.exports: $Exports<'eslint-plugin-ava/rules/no-identical-title'>;
}
declare module 'eslint-plugin-ava/rules/no-ignored-test-files.js' {
declare module.exports: $Exports<'eslint-plugin-ava/rules/no-ignored-test-files'>;
}
declare module 'eslint-plugin-ava/rules/no-import-test-files.js' {
declare module.exports: $Exports<'eslint-plugin-ava/rules/no-import-test-files'>;
}
declare module 'eslint-plugin-ava/rules/no-invalid-end.js' {
declare module.exports: $Exports<'eslint-plugin-ava/rules/no-invalid-end'>;
}
declare module 'eslint-plugin-ava/rules/no-nested-tests.js' {
declare module.exports: $Exports<'eslint-plugin-ava/rules/no-nested-tests'>;
}
declare module 'eslint-plugin-ava/rules/no-only-test.js' {
declare module.exports: $Exports<'eslint-plugin-ava/rules/no-only-test'>;
}
declare module 'eslint-plugin-ava/rules/no-skip-assert.js' {
declare module.exports: $Exports<'eslint-plugin-ava/rules/no-skip-assert'>;
}
declare module 'eslint-plugin-ava/rules/no-skip-test.js' {
declare module.exports: $Exports<'eslint-plugin-ava/rules/no-skip-test'>;
}
declare module 'eslint-plugin-ava/rules/no-statement-after-end.js' {
declare module.exports: $Exports<'eslint-plugin-ava/rules/no-statement-after-end'>;
}
declare module 'eslint-plugin-ava/rules/no-todo-implementation.js' {
declare module.exports: $Exports<'eslint-plugin-ava/rules/no-todo-implementation'>;
}
declare module 'eslint-plugin-ava/rules/no-todo-test.js' {
declare module.exports: $Exports<'eslint-plugin-ava/rules/no-todo-test'>;
}
declare module 'eslint-plugin-ava/rules/no-unknown-modifiers.js' {
declare module.exports: $Exports<'eslint-plugin-ava/rules/no-unknown-modifiers'>;
}
declare module 'eslint-plugin-ava/rules/prefer-async-await.js' {
declare module.exports: $Exports<'eslint-plugin-ava/rules/prefer-async-await'>;
}
declare module 'eslint-plugin-ava/rules/prefer-power-assert.js' {
declare module.exports: $Exports<'eslint-plugin-ava/rules/prefer-power-assert'>;
}
declare module 'eslint-plugin-ava/rules/test-ended.js' {
declare module.exports: $Exports<'eslint-plugin-ava/rules/test-ended'>;
}
declare module 'eslint-plugin-ava/rules/test-title.js' {
declare module.exports: $Exports<'eslint-plugin-ava/rules/test-title'>;
}
declare module 'eslint-plugin-ava/rules/use-t-well.js' {
declare module.exports: $Exports<'eslint-plugin-ava/rules/use-t-well'>;
}
declare module 'eslint-plugin-ava/rules/use-t.js' {
declare module.exports: $Exports<'eslint-plugin-ava/rules/use-t'>;
}
declare module 'eslint-plugin-ava/rules/use-test.js' {
declare module.exports: $Exports<'eslint-plugin-ava/rules/use-test'>;
}
declare module 'eslint-plugin-ava/rules/use-true-false.js' {
declare module.exports: $Exports<'eslint-plugin-ava/rules/use-true-false'>;
}
declare module 'eslint-plugin-ava/util.js' {
declare module.exports: $Exports<'eslint-plugin-ava/util'>;
}
| matteocng/react-flag-icon-css | flow-typed/npm/eslint-plugin-ava_vx.x.x.js | JavaScript | mit | 7,463 |
/*
* This Java source file was generated by the Gradle 'init' task.
*/
package jp.dip.oyasirazu.study.yaml.jackson.anchorandalias;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Map;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.dataformat.yaml.YAMLFactory;
public class App {
public static void main(String[] args) throws IOException {
var mapper = new ObjectMapper(new YAMLFactory());
var config = mapper.readValue(new InputStreamReader(
ClassLoader.getSystemResourceAsStream("Config.yaml"),
"UTF-8"), Map.class);
System.out.println(config);
}
}
| mikoto2000/MiscellaneousStudy | java/Yaml/Jackson/AnchorAndAlias/src/main/java/jp/dip/oyasirazu/study/yaml/jackson/anchorandalias/App.java | Java | mit | 693 |
package com.smartcodeltd.jenkinsci.plugins.buildmonitor.viewmodel.features.headline;
import com.smartcodeltd.jenkinsci.plugins.buildmonitor.viewmodel.BuildViewModel;
import com.smartcodeltd.jenkinsci.plugins.buildmonitor.viewmodel.JobView;
import hudson.model.Result;
import hudson.model.User;
import jenkins.model.CauseOfInterruption;
import jenkins.model.InterruptedBuildAction;
import java.util.Optional;
import static java.lang.String.format;
/**
* @author Jan Molak
*/
public class HeadlineOfAborted implements CandidateHeadline {
private final JobView job;
private final HeadlineConfig config;
public HeadlineOfAborted(JobView job, HeadlineConfig config) {
this.job = job;
this.config = config;
}
@Override
public boolean isApplicableTo(JobView job) {
return Result.ABORTED.equals(job.lastBuild().result());
}
@Override
public Headline asJson() {
return new Headline(text(job.lastBuild()));
}
private String text(BuildViewModel build) {
Optional<InterruptedBuildAction> interruption = build.detailsOf(InterruptedBuildAction.class);
if (config.displayCommitters && interruption.isPresent()) {
Optional<String> username = userResponsibleFor(interruption.get());
if (username.isPresent()) {
return format("Execution aborted by %s", username.get());
}
}
return "Execution aborted";
}
private Optional<String> userResponsibleFor(InterruptedBuildAction details) {
if (details.getCauses().size() == 1) {
CauseOfInterruption cause = details.getCauses().get(0);
if (cause instanceof CauseOfInterruption.UserInterruption) {
User user = ((CauseOfInterruption.UserInterruption) cause).getUser();
return Optional.of(user.getFullName());
}
}
return Optional.empty();
}
}
| jan-molak/jenkins-build-monitor-plugin | build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/features/headline/HeadlineOfAborted.java | Java | mit | 1,946 |
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.fieldPropTypes = exports.fieldMetaPropTypes = exports.fieldInputPropTypes = exports.formPropTypes = undefined;
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var any = _propTypes2.default.any,
bool = _propTypes2.default.bool,
func = _propTypes2.default.func,
shape = _propTypes2.default.shape,
string = _propTypes2.default.string,
oneOfType = _propTypes2.default.oneOfType,
object = _propTypes2.default.object;
var formPropTypes = exports.formPropTypes = {
// State:
anyTouched: bool.isRequired, // true if any of the fields have been marked as touched
asyncValidating: oneOfType([bool, string]).isRequired, // true if async validation is running, a string if a field triggered async validation
dirty: bool.isRequired, // true if any values are different from initialValues
error: any, // form-wide error from '_error' key in validation result
form: string.isRequired, // the name of the form
invalid: bool.isRequired, // true if there are any validation errors
initialized: bool.isRequired, // true if the form has been initialized
initialValues: object, // the initialValues object passed to reduxForm
pristine: bool.isRequired, // true if the values are the same as initialValues
pure: bool.isRequired, // if true, implements shouldComponentUpdate
submitting: bool.isRequired, // true if the form is in the process of being submitted
submitFailed: bool.isRequired, // true if the form was submitted and failed for any reason
submitSucceeded: bool.isRequired, // true if the form was successfully submitted
valid: bool.isRequired, // true if there are no validation errors
warning: any, // form-wide warning from '_warning' key in validation result
// Actions:
array: shape({
insert: func.isRequired, // function to insert a value into an array field
move: func.isRequired, // function to move a value within an array field
pop: func.isRequired, // function to pop a value off of an array field
push: func.isRequired, // function to push a value onto an array field
remove: func.isRequired, // function to remove a value from an array field
removeAll: func.isRequired, // function to remove all the values from an array field
shift: func.isRequired, // function to shift a value out of an array field
splice: func.isRequired, // function to splice a value into an array field
swap: func.isRequired, // function to swap values in an array field
unshift: func.isRequired // function to unshift a value into an array field
}),
asyncValidate: func.isRequired, // function to trigger async validation
autofill: func.isRequired, // action to set a value of a field and mark it as autofilled
blur: func.isRequired, // action to mark a field as blurred
change: func.isRequired, // action to change the value of a field
clearAsyncError: func.isRequired, // action to clear the async error of a field
destroy: func.isRequired, // action to destroy the form's data in Redux
dispatch: func.isRequired, // the Redux dispatch action
handleSubmit: func.isRequired, // function to submit the form
initialize: func.isRequired, // action to initialize form data
reset: func.isRequired, // action to reset the form data to previously initialized values
touch: func.isRequired, // action to mark fields as touched
submit: func.isRequired, // action to trigger a submission of the specified form
untouch: func.isRequired, // action to mark fields as untouched
// triggerSubmit
triggerSubmit: bool, // if true, submits the form on componentWillReceiveProps
clearSubmit: func.isRequired // called before a triggered submit, by default clears triggerSubmit
};
var fieldInputPropTypes = exports.fieldInputPropTypes = {
checked: bool,
name: string.isRequired,
onBlur: func.isRequired,
onChange: func.isRequired,
onDragStart: func.isRequired,
onDrop: func.isRequired,
onFocus: func.isRequired,
value: any
};
var fieldMetaPropTypes = exports.fieldMetaPropTypes = {
active: bool.isRequired,
asyncValidating: bool.isRequired,
autofilled: bool.isRequired,
dirty: bool.isRequired,
dispatch: func.isRequired,
error: string,
form: string.isRequired,
invalid: bool.isRequired,
pristine: bool.isRequired,
submitting: bool.isRequired,
submitFailed: bool.isRequired,
touched: bool.isRequired,
valid: bool.isRequired,
visited: bool.isRequired,
warning: string
};
var fieldPropTypes = exports.fieldPropTypes = {
input: shape(fieldInputPropTypes).isRequired,
meta: shape(fieldMetaPropTypes).isRequired
};
exports.default = formPropTypes; | superKaigon/TheCave | node_modules/redux-form/lib/propTypes.js | JavaScript | mit | 4,822 |
/**
* Created by 3er on 12/8/14.
*/
//Set the node environment variable if not set before
var env = process.env.NODE_ENV = process.env.NODE_ENV || 'development';
/**
* Module dependencies.
*/
var express = require('express');
var bodyParser = require('body-parser');
var config = require('./config/config');
var op = require('./op');
// config
var app = express()
app.use(bodyParser.json()); // for parsing application/json
app.use(bodyParser.
urlencoded({ extended: true })); // for parsing application/x-www-form-urlencoded
var port = process.env.NODE_PORT || config.port;
var PRIVATE = require('./config/private')
var qiniu = require('qiniu')
qiniu.conf.ACCESS_KEY = PRIVATE.qiniu.ACCESS_KEY
qiniu.conf.SECRET_KEY = PRIVATE.qiniu.SECRET_KEY
var mongoose = require('mongoose');
var db = mongoose.connect(config.db, function (err) {
if (err) throw err;
// Operation
op(qiniu, mongoose, app);
// Demo
//qiniuOp(qiniu, 'ghxz');
//dbOp(mongoose);
//web(app, port);
});
// express demo
var web = function (app, port) {
app.get('/', function (req, res) {
res.send('Hello World!')
})
var server = app.listen(port, function () {
var host = server.address().address
var port = server.address().port
console.log('Example app listening at http://%s:%s', host, port)
})
}
// qiniu demo
var qiniuOp = function (qiniu, bucket) {
var client = new qiniu.rs.Client();
var marker = null;
qiniu.rsf.listPrefix(bucket, '', marker, 100, function (err, ret) {
if (err) throw err;
// process ret.marker & ret.items
console.log(ret.marker);
console.log(ret.items);
});
}
// mongoose demo
var dbOp = function (mongoose) {
var Chapter = mongoose.model('Chapter',{})
Chapter.find({}, function (err, docs) {
if (err) throw err
console.log(docs.toString())
})
} | stevennuo/yctool | tool.js | JavaScript | mit | 1,904 |
#include "vec4.h"
namespace mirage
{
std::string vec4::toString() const
{
char buffer[255];
snprintf(buffer, 255, "vec4[%+.2f %+.2f %+.2f %+.2f]", x, y, z, w);
return std::string(buffer);
}
}
| Harha/MirageRender | src/math/vec4.cpp | C++ | mit | 204 |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Ascon.Pilot.Core;
using Ascon.Pilot.WebClient.Extensions;
using Ascon.Pilot.WebClient.ViewModels;
using Microsoft.AspNet.Mvc;
namespace Ascon.Pilot.WebClient.ViewComponents
{
/// <summary>
/// Компонент - боковая панель.
/// </summary>
public class SidePanelViewComponent : ViewComponent
{
/// <summary>
/// Вызов боковой панели.
/// </summary>
/// <param name="id">Id папки.</param>
/// <returns>Боковая панель для папки с идентификатором Id.</returns>
public async Task<IViewComponentResult> InvokeAsync(Guid? id)
{
return await Task.Run(() => GetSidePanel(id)) ;
}
/// <summary>
/// Отображение боковой панели.
/// </summary>
/// <param name="id">Уникальный Id папки, для которой запрашивается представление.</param>
/// <returns>Представление боковой панели для папки с идентификатором Id.</returns>
public IViewComponentResult GetSidePanel(Guid? id)
{
id = id ?? DObject.RootId;
var serverApi = HttpContext.GetServerApi();
var rootObject = serverApi.GetObjects(new[] { id.Value }).First();
var mTypes = HttpContext.Session.GetMetatypes();
var model = new SidePanelViewModel
{
ObjectId = id.Value,
Types = mTypes,
Items = new List<SidePanelItem>()
};
var prevId = rootObject.Id;
var parentId = rootObject.Id;
do
{
var parentObject = serverApi.GetObjects(new[] {parentId}).First();
var parentChildsIds = parentObject.Children
.Where(x => mTypes[x.TypeId].Children.Any())
.Select(x => x.ObjectId).ToArray();
if (parentChildsIds.Length != 0)
{
var parentChilds = serverApi.GetObjects(parentChildsIds);
var subtree = model.Items;
model.Items = new List<SidePanelItem>(parentChilds.Count);
foreach (var parentChild in parentChilds)
{
model.Items.Add(new SidePanelItem
{
Type = mTypes[parentChild.TypeId],
DObject = parentChild,
SubItems = parentChild.Id == prevId ? subtree : null,
Selected = parentChild.Id == id
});
}
}
prevId = parentId;
parentId = parentObject.ParentId;
} while (parentId != Guid.Empty);
return View(model);
}
}
}
| perminov-aleksandr/askon-pilot-client-asp | src/Ascon.Pilot.WebClient/ViewComponents/SidePanelViewComponent.cs | C# | mit | 3,157 |
using UnityEngine;
using System.Collections;
using UnityStandardAssets.CrossPlatformInput;
public enum AttackType
{
mellee,
ranged
}
public class AttackController : MonoBehaviour
{
// Use this for initialization
void Start ()
{
}
// Update is called once per frame
void Update ()
{
if (CrossPlatformInputManager.GetButtonDown ("Melee")) {
//TODO perform animation
}
}
void OnCollisionEnter (Collision other)
{
}
}
| daverous/HockeyWW2Game | WW2 Hockey Game/Assets/Scripts/AttackController.cs | C# | mit | 447 |
namespace Bakery.Cqrs
{
using System.Threading.Tasks;
public interface ICommandHandler<TCommand>
: ICommandHandler
where TCommand : ICommand
{
Task HandleAsync(TCommand command);
}
}
| brendanjbaker/Bakery | src/Bakery.Cqrs/Bakery/Cqrs/ICommandHandler`.cs | C# | mit | 210 |
/*
* GetProperties.h
*
* Created on: Jul 5, 2019
* Author: paviot
*/
#ifndef SRC_PROPERTIES_H_
#define SRC_PROPERTIES_H_
#include <vector>
#include <string>
#include <utility>
#include <boost/variant.hpp>
typedef boost::make_recursive_variant<
int,
std::string,
std::vector<boost::recursive_variant_>
>::type Formula;
typedef std::pair<std::string,Formula> Property;
class Properties {
private:
std::vector<Property> prop;
public:
Properties(const char *f);
virtual ~Properties();
void print() const;
const std::string& getName(unsigned int id) {return prop[id].first;}
const Formula& getFormula(unsigned int id) {return prop[id].second;}
private:
void addTerminalFormula(std::vector<Formula> &f, const std::vector<Formula> &term);
};
#endif /* SRC_PROPERTIES_H_ */
| paviot/libCamiProdRead | src/Properties.h | C | mit | 799 |
<?php
/**
* Export to PHP Array plugin for PHPMyAdmin
* @version 4.8.5
*/
/**
* Database `bd_geo_code`
*/
/* `bd_geo_code`.`divisions` */
$divisions = array(
array('id' => '1','name' => 'Chattagram','bn_name' => 'চট্টগ্রাম','url' => 'www.chittagongdiv.gov.bd'),
array('id' => '2','name' => 'Rajshahi','bn_name' => 'রাজশাহী','url' => 'www.rajshahidiv.gov.bd'),
array('id' => '3','name' => 'Khulna','bn_name' => 'খুলনা','url' => 'www.khulnadiv.gov.bd'),
array('id' => '4','name' => 'Barisal','bn_name' => 'বরিশাল','url' => 'www.barisaldiv.gov.bd'),
array('id' => '5','name' => 'Sylhet','bn_name' => 'সিলেট','url' => 'www.sylhetdiv.gov.bd'),
array('id' => '6','name' => 'Dhaka','bn_name' => 'ঢাকা','url' => 'www.dhakadiv.gov.bd'),
array('id' => '7','name' => 'Rangpur','bn_name' => 'রংপুর','url' => 'www.rangpurdiv.gov.bd'),
array('id' => '8','name' => 'Mymensingh','bn_name' => 'ময়মনসিংহ','url' => 'www.mymensinghdiv.gov.bd')
);
| nuhil/bangladesh-geocode | divisions/divisions.php | PHP | mit | 1,048 |
Imports System
Imports System.Net
Imports System.Threading
Imports System.Threading.Tasks
Imports FluentFTP
Namespace Examples
Module GetChecksumExample
'-----------------------------------------------------------------------------------------
' NOTE! GetChecksum automatically uses the first available hash algorithm on the server,
' And it should be used as far as possible instead of GetHash, GetMD5, GetSHA256...
'-----------------------------------------------------------------------------------------
Sub GetChecksum()
Using conn = New FtpClient("127.0.0.1", "ftptest", "ftptest")
conn.Connect()
' Get a hash checksum for the file
Dim hash As FtpHash = conn.GetChecksum("/path/to/remote/file")
' Make sure it returned a valid hash object
If hash.IsValid Then
If hash.Verify("/some/local/file") Then
Console.WriteLine("The checksum's match!")
End If
End If
End Using
End Sub
Async Function GetChecksumAsync() As Task
Dim token = New CancellationToken()
Using conn = New FtpClient("127.0.0.1", "ftptest", "ftptest")
Await conn.ConnectAsync(token)
' Get a hash checksum for the file
Dim hash As FtpHash = Await conn.GetChecksumAsync("/path/to/remote/file", FtpHashAlgorithm.NONE, token)
' Make sure it returned a valid hash object
If hash.IsValid Then
If hash.Verify("/some/local/file") Then
Console.WriteLine("The checksum's match!")
End If
End If
End Using
End Function
End Module
End Namespace
| robinrodricks/FluentFTP | FluentFTP.VBExamples/GetChecksum.vb | Visual Basic | mit | 1,529 |
<?php
/*
* ###########
* #__________#
* __________#
* ________#
* _____###_____²xiT development
* _________#
* ___________#
* #__________#
* _#________#
* __#______#
* ____####
*
*/
/**
* @package MyOOF
* @version 2.00
* @author Joris Berthelot <[email protected]>
* @copyright Copyright (c) 2008, Joris Berthelot
* @license http://www.opensource.org/licenses/mit-license.php MIT Licence
*/
/**
* @package MyOOF
*/
class Select extends Element implements OptionHandler {
/**
* The final compiled opbject result will go in this var
* @var string
* @access protected
*/
protected $_output;
/**
* Select content (Option objects or Optgroup objects)
* @var array
* @access protected
*/
protected $_content = array();
/**
* List of available attributes
* @var array
* @access protected
*/
protected $_pattern = array(
'class' => null,
'dir' => 'ltr',
'disabled' => null,
'id' => null,
'lang' => null,
'multiple' => null,
'name' => null,
'size' => null,
'style' => null,
'tabindex' => null,
'title' => null,
'xml:lang' => null,
'xmlns' => null
);
/**
* List of default attribute values
* @var array
* @access protected
*/
protected $_defaultValues = array(
'dir' => array('ltr', 'rtl'),
'disabled' => 'disabled',
'multiple' => 'multiple'
);
/**
* Instanciates the self class if allowed in
* {@link Element::$_availableChilds}
* @final
* @access public
* @param [array $config = null Associative array of attributes]
*/
final public function __construct(array $config = null) {
if (parent::__construct($this)) {
if (!empty($config)) {
$this->setAttributes($config);
}
}
}
/**
* Clones all content objects
* @access public
*/
public function __clone() {
// Clones all content objects
if (!empty($this->_content)) {
foreach ($this->_content as $contentId => $contentObject) {
$this->_content[$contentId] = clone $contentObject;
}
}
}
/**
* Adds an Option object
* @access public
* @param mixed $option Option object |
* array $option Associative array of attributes
* @param [string $setType = 'append' The way to add objects]
* @return mixed object $this | bool false
*/
public function addOption($option, $setType = 'append') {
$setType = strtolower($setType);
// Tests if parameter is an Option object
if ($this->_isOption($option)) {
// Adds the object depending of the adding way
switch ($setType) {
case 'append' :
$this->_content[] = $option;
break;
case 'prepend' :
array_unshift($this->_content, $option);
break;
default :
$this->_content[] = $option;
}
return $this;
// Tests if the parameter is an Option recipy
} else if (is_array($option) && !empty($option)) {
// Adds the object depending of the adding way
switch ($setType) {
case 'append' :
$this->_content[] = new Option($option);
break;
case 'prepend' :
array_unshift($this->_content, new Option($option));
break;
default :
$this->_content[] = new Option($option);
}
return $this;
}
// Parameter is not recongnized
$this->_printError('Warning', 'Unable to add Option object.
Please, check your Option parameter');
return false;
}
/**
* Adds several Option objects
* @access public
* @param array $options Array of Option object |
* array $options Array of associative array of attributes
* @param [string $setType = 'append' The way to add objects]
* @return mixed object $this | bool false
*/
public function addOptions(array $options, $setType = 'append') {
// Array is not empty
if (!empty($options)) {
foreach ($options as $option) {
$this->addOption($option, $setType);
}
return $this;
}
// Parameter is empty
$this->_printError('Warning', 'There is not any Option objects
to add. Please, check your Option parameter');
return false;
}
/**
* Sets an Option object
* @access public
* @param mixed $option Option object |
* array $option Associative array of attributes
* @return mixed object $this | bool false
*/
public function setOption($option) {
// Removes content objects
$this->resetContent();
// Adds Option object
return $this->addOption($option);
}
/**
* Sets several Option objects
* @access public
* @param array $options An array of Option objects or option recipy
* @return mixed object $this | bool false
*/
public function setOptions(array $options) {
// Removes content objects
$this->resetContent();
// Adds Option objects
return $this->addOptions($options);
}
/**
* Gets an Option object
* @access public
* @param int $optionId Option array index (in order it was inserted)
* @return mixed object Option object | bool false
*/
public function getOption($optionId) {
$optionId = abs(intval($optionId));
// Tests if the requested option exists and if it's an Option object
if (
isset($this->_content[$optionId])
&& $this->_isOption($this->_content[$optionId])
) {
return $this->_content[$optionId];
}
// Option doesn't exist, throws a warning message
$this->_printError('Warning', 'Option ID #'
. $optionId
. ' does not exist or this is not an Option object');
return false;
}
/**
* Gets several Option objects. Array keys are object ID
* @access public
* @param array $optionIds Array of option index id
* @return mixed array $option Associative array of wanted Options
* | bool false
*/
public function getOptions(array $optionIds) {
// Checks the parameter is not empty
if (!empty($optionIds)) {
foreach ($optionIds as $optionId) {
// Gets Option object
$optionIds[$optionId] = $this->getOption($optionId);
}
return $optionIds;
}
// Parameter is empty
$this->_printError('Warning', 'There are not Option objects to get.
Please check your parameter content');
return false;
}
/**
* Gets all Option objects
* @access public
* @return array $_options All Option objects
*/
public function getAllOptions() {
// Gets debugState
$debugS = $this->debugState;
// Disables debug if enabled
if ($debugS) {
$this->setDebugState(!$debugS);
}
// Option stack to return
$options = array();
// Loops on Select content
if (!empty($this->_content)) {
foreach ($this->_content as $objectId => $object) {
if ($this->getOption($objectId)) {
$options[$objectId] = $object;
}
}
// Enables back debugState
if ($debugS) {
$this->setDebugState($debugS);
}
return $options;
}
// Enables back debugState
if ($debugS) {
$this->setDebugState($debugS);
}
// There is not any element in _content
$this->_printError('Warning', 'The Select object does not
contain any Option or Optgroup objects');
return false;
}
/**
* Unsets an Option object
* @access public
* @param int $optionId Option ID
* @param [ bool $reIndex = true ] Re-Indexes object stack after operation
* @return bool
*/
public function unsetOption($optionId, $reIndex = true) {
$optionId = abs(intval($optionId));
// Tests if the requested ID is an Option object
if (
isset($this->_content[$optionId])
&& $this->_isOption($this->_content[$optionId])
) {
unset($this->_content[$optionId]);
if ($reIndex) {
$this->reIndex();
}
return $this;
}
// Requested ID is not an Option or does not exist
$this->_printError('Warning', 'Option ID #'
. $optionId
. ' does not exist or is not an Option object');
return false;
}
/**
* Unsets several Option objects
* @access public
* @param array $optionIds Array of Option ID
* @return mixed object $this | bool false
*/
public function unsetOptions(array $optionIds) {
// Tests if the given parameter is not empty
if (!empty($optionIds)) {
// Launches unset Option proccess for each array entry
foreach ($optionIds as $optionId) {
$this->unsetOption($optionId, false);
}
$this->reIndex();
return $this;
}
// Parameter is empty
$this->_printError('Warning', 'There is not any Option objects
to unset. Please, check your Option parameter');
return false;
}
/**
* Unsets all Option objects
* @access public
* @return object $this
*/
public function resetOptions() {
// Checks that Select has entries
if (!empty($this->_content)) {
// Gets and unsets all Option objects
$this->unsetOptions(@array_keys($this->getAllOptions()));
return $this;
}
// Select is empty
$this->_printError('Warning', 'There are not Options in Select
content. Check there is a Select content');
return false;
}
/**
* Adds an Optgroup object
* @access public
* @param mixed $optgroup Optgroup object |
* array $optgroup Associative array of attributes
* @param [string $setType = 'append' The way to add objects]
* @return mixed object $this | bool false
*/
public function addOptgroup($optgroup, $setType = 'append') {
$setType = strtolower($setType);
// Tests if parameter is an Optgroup object
if ($this->_isOptgroup($optgroup)) {
// Adds the object depending of the adding way
switch ($setType) {
case 'append' :
$this->_content[] = $optgroup;
break;
case 'prepend' :
array_unshift($this->_content, $optgroup);
break;
default :
$this->_content[] = $optgroup;
}
return $this;
// Tests if the parameter is an Optgroup recipy
} else if (is_array($optgroup) && !empty($optgroup)) {
// Adds the object depending of the adding way
switch ($setType) {
case 'append' :
$this->_content[] = new Optgroup($optgroup);
break;
case 'prepend' :
array_unshift($this->_content, new Optgroup($optgroup));
break;
default :
$this->_content[] = new Optgroup($optgroup);
}
return $this;
}
// Parameter is not recongnized
$this->_printError('Fatal error', 'Unable to set Optgroup object.
Please, check your Optgroup parameter');
return false;
}
/**
* Adds several Optgroup objects
* @access public
* @param array $optgroups Array of Optgroup object |
* array $optgroups Array of associative array of attributes
* @param [string $setType = 'append' The way to add objects]
* @return mixed object $this | bool false
*/
public function addOptgroups(array $optgroups, $setType = 'append') {
// Array is not empty
if (!empty($optgroups)) {
foreach ($optgroups as $optgroup) {
$this->addOptgroup($optgroup, $setType);
}
return $this;
}
// Parameter is empty
$this->_printError('Warning', 'There is not any Optgroups
to add. Please, check your Optgroup parameter');
return false;
}
/**
* Sets an Optgroup object
* @access public
* @param mixed $option Optgroup object |
* array $option Associative array of attributes
* @return mixed object $this | bool false
*/
public function setOptgroup($optgroup) {
// Removes content objects
$this->resetContent();
// Adds the Optgroup
return $this->addOptgroup($optgroup);
}
/**
* Sets several Optgroup objects
* @access public
* @param array $optgroups An array of Optgroup objects or option recipy
* @return mixed object $this | bool false
*/
public function setOptgroups(array $optgroups) {
// Removes content objects
$this->resetContent();
// Adds Optgroup objects
return $this->addOptgroups($optgroups);
}
/**
* Gets an Optgroup object
* @access public
* @param int $optionId Optgroup array index (in order it was inserted)
* @return mixed object Optgroup object | bool false
*/
public function getOptgroup($optgroupId) {
$optgroupId = abs(intval($optgroupId));
// Tests if the requested Optgroup exists and if it's an Optgroup object
if (
isset($this->_content[$optgroupId])
&& $this->_isOptgroup($this->_content[$optgroupId])
) {
return $this->_content[$optgroupId];
}
// Option doesn't exist, throws a warning message
$this->_printError('Warning', 'Optgroup ID #'
. $optgroupId
. ' does not exist or this is not an Optgroup object');
return false;
}
/**
* Gets several Optgroup objects. Array keys are object ID
* @access public
* @param array $optgroups Array of option index id
* @return mixed array $optgroups Associative array of wanted Optgroups
* | bool false
*/
public function getOptgroups(array $optgroups) {
if (!empty($optgroups)) {
foreach ($optgroups as $optgroupId) {
// Gets Optgroup object
$optgroups[$optgroupId] = $this->getOptgroup($optgroupId);
}
return $optgroups;
}
// Parameter is empty
$this->_printError('Warning', 'There are not Optgroup objects to get.
Please check your parameter content');
return false;
}
/**
* Gets all Optgroup objects
* @access public
* @return mixed array $optgroups All Select optgroups | bool false
*/
public function getAllOptgroups() {
// Gets debugState
$debugS = $this->debugState;
// Disables debug if enabled
if ($debugS) {
$this->setDebugState(!$debugS);
}
// Optgroup stack to return
$optgroups = array();
// Loops on Select content
if (!empty($this->_content)) {
foreach ($this->_content as $objectId => $object) {
if ($this->getOptgroup($objectId)) {
$optgroups[$objectId] = $object;
}
}
// Enables back debugState
if ($debugS) {
$this->setDebugState($debugS);
}
return $optgroups;
}
// Enables back debugState
if ($debugS) {
$this->setDebugState($debugS);
}
// There is not any element in _content
$this->_printError('Warning', 'The Select object does not
contain any Option or Optgroup objects');
return false;
}
/**
* Unsets an Optgroup object
* @access public
* @param int $optgroupId The Optgroup ID to unset
* @param [ bool $reIndex = true ] Re-Indexes object stack after operation
* @return mixed object $this | bool false
*/
public function unsetOptgroup($optgroupId, $reIndex = true) {
$optgroupId = abs(intval($optgroupId));
// Tests if the requested ID is an Optgroup object
if (
isset($this->_content[$optgroupId])
&& $this->_isOptgroup($this->_content[$optgroupId])
) {
unset($this->_content[$optgroupId]);
if ($reIndex) {
$this->reIndex();
}
return $this;
}
// Requested ID is not an Optgroup or does not exist
$this->_printError('Warning', 'Optgroup ID #'
. $optgroupId
. ' does not exist or is not an Optgroup object');
return false;
}
/**
* Unsets several Optgroup objects
* @access public
* @param array $optgroups Array of Optgroups ID
* @return mixed object $this | bool false
*/
public function unsetOptgroups(array $optgroups) {
// Tests if the given parameter is not empty
if (!empty($optgroups)) {
// Launches unset Option proccess for each array entry
foreach ($optgroups as $optgroupId) {
$this->unsetOptgroup($optgroupId, false);
}
$this->reIndex();
return $this;
}
// Parameter is empty
$this->_printError('Warning', 'There is not any Optgroup objects
to unset. Please, check your Optgroup parameter');
return false;
}
/**
* Unsets all Optgroup objects
* @access public
* @return mixed object $this | bool false
*/
public function resetOptgroups() {
// Checks that Select has entries
if (!empty($this->_content)) {
// Gets and unsets all Optgroup objects
$this->unsetOptgroups(@array_keys($this->getAllOptgroups()));
return $this;
}
// Select is empty
$this->_printError('Warning', 'There are not Optgroups in Select
content. Check there is a Select content');
return false;
}
/**
* Gets Select content (objects)
* @access public
* @return array $_content
*/
public function getContent() {
return $this->_content;
}
/**
* Unsets Select content (objects)
* @access public
* @return object $this
*/
public function resetContent() {
$this->_content = array();
return $this;
}
/**
* Re-Indexes stack objects
* @access public
* @return object $this
*/
public function reIndex() {
$this->_content = @array_values($this->_content);
return $this;
}
/**
* Gets final source code. Also called by {@link Element::__toString()}
* @final
* @access public
* @return mixed string The generated object source code | bool false
*/
final public function getOutput() {
// Checks if there is a Select content
if (empty($this->_content)) {
$this->_printError('Fatal error', 'Unable to create a Select
object without at least one Option or Optgroup object');
return false;
}
if ($this->_buildSelect()) {
return $this->_output;
}
return false;
}
/**
* Tests if the given parameter is an instance of Option class
* @access private
* @param mixed $option
* @return bool
*/
private function _isOption($option) {
return is_object($option) && $option instanceof Option;
}
/**
* Tests if the given parameter is an instance of Optgroup class
* @access private
* @param mixed $optgroup
* @return bool
*/
private function _isOptgroup($optgroup) {
return is_object($optgroup) && $optgroup instanceof Optgroup;
}
/**
* Generates final source code. Called by {@link Select::getOutput()}
* @access private
* @return bool true
*/
private function _buildSelect() {
$this->_output = '<select ';
foreach ($this->_pattern as $attr => $value) {
if (!is_null($value)) {
$this->_output .= $attr . '="' . $value . '" ';
}
}
// Removes the last space
$this->_output = substr($this->_output, 0, -1) . '>';
// Adds indent if enabled
if ($this->indentState) {
$this->_output .= "\n" . $this->indentChar;
}
// Generates and appends Select content
foreach ($this->_content as $object) {
// Adds indent if enabled
if ($this->indentState) {
$this->_output .= $object->setIndentChar($this->indentChar)
->getOutput()
. "\n"
. $this->indentChar;
} else {
$this->_output .= $object->setIndentState(false)->getOutput();
}
}
// Adds indent if enabled
if ($this->indentState) {
$this->_output = substr(
$this->_output,
0,
- strlen($this->indentChar)
);
}
$this->_output .= '</select>';
return true;
}
}
?> | eexit/myoof | Select.php | PHP | mit | 23,184 |
# META-INF
> Controllers Java
## License
MIT © [Diego Lima](https://github.com/dfslima/portalCliente)
| dfslima/portalCliente | src/main/java/br/com/portalCliente/controller/README.md | Markdown | mit | 107 |
package localization;
import lejos.robotics.SampleProvider;
import lejos.robotics.geometry.Point;
import lejos.robotics.localization.PoseProvider;
import lejos.robotics.navigation.Move;
import lejos.robotics.navigation.MoveListener;
import lejos.robotics.navigation.MoveProvider;
import lejos.robotics.navigation.Pose;
import lejos.utility.Matrix;
/**
* PoseProvider class which allows the robot to keep track of it's position and
* heading. This is the main localization engine of the robot, and makes use of
* the custom Kalman Filter implementation.
*/
public class DirectionKalmanPoseProvider implements PoseProvider, MoveListener, SampleProvider
{
private SampleProvider direction_finder;
private AngleKalmanFilter kalman_filter;
// The current estimate of the state
private float x = 0, y = 0, heading = 0;
// The values at the last measurement
private float odo_angle0, distance0;
// The heading and sensor reading at the start of the move
private float start_heading;
private float start_sensor_angle;
// Whether or not the gyro is reversed relative to the pilot
private boolean reversed;
MoveProvider mp;
boolean current = true;
/** Default constructor, assumes robot is aligned with the gyro */
public DirectionKalmanPoseProvider(MoveProvider mp, SampleProvider direction_finder)
{
this(mp, direction_finder, false);
}
/**
* Allows user to specify whether or not the robot is reversed relative to
* the gyro
*/
public DirectionKalmanPoseProvider(MoveProvider mp, SampleProvider direction_finder, boolean reversed)
{
this.mp = mp;
mp.addMoveListener(this);
// Setup gyro for readings
this.direction_finder = direction_finder;
// Do a quick reading to work out the kinks
get_direction_reading();
// Setup the Kalman filter
double A = 1;
// Roll the angles into the control input
double B = 1;
double Q = 0.1;
// 2 Sensors
Matrix C = new Matrix(new double[][] { { 1 }, { 1 } });
Matrix R = new Matrix(new double[][] { { 1, 0 }, { 0, 10 } });
kalman_filter = new AngleKalmanFilter(A, B, C, Q, R);
kalman_filter.setState(0, 0);
this.reversed = reversed;
}
private float get_direction_reading()
{
float[] sample = new float[direction_finder.sampleSize()];
direction_finder.fetchSample(sample, 0);
return (reversed) ? -sample[0] : sample[0];
}
public synchronized Pose getPose()
{
if (!current)
{
updatePose(mp.getMovement());
}
return new Pose(x, y, heading);
}
public synchronized void moveStarted(Move move, MoveProvider mp)
{
// Initialize the starting heading
start_heading = heading;
start_sensor_angle = get_direction_reading();
odo_angle0 = 0;
distance0 = 0;
current = false;
this.mp = mp;
}
public void moveStopped(Move move, MoveProvider mp)
{
updatePose(move);
}
private synchronized void updatePose(Move event)
{
// ODOMETRY
float odo_angle_delta = event.getAngleTurned() - odo_angle0;
// DIRECTION SENSOR
// Calculate angle relative to the start of the move in order to provide
// consistent readings
float sensor_angle = get_direction_reading();
float sensor_relative_angle = sensor_angle - start_sensor_angle;
// From OdometryPoseProvider
// ------------------------------------------------------------
float distance = event.getDistanceTraveled() - distance0;
double dx = 0, dy = 0;
double headingRad = (Math.toRadians(heading));
if (event.getMoveType() == Move.MoveType.TRAVEL || Math.abs(odo_angle_delta) < 0.2f)
{
dx = (distance) * (float) Math.cos(headingRad);
dy = (distance) * (float) Math.sin(headingRad);
}
else if (event.getMoveType() == Move.MoveType.ARC)
{
double turnRad = Math.toRadians(odo_angle_delta);
double radius = distance / turnRad;
dy = radius * (Math.cos(headingRad) - Math.cos(headingRad + turnRad));
dx = radius * (Math.sin(headingRad + turnRad) - Math.sin(headingRad));
}
// ------------------------------------------------------------
// Update the Kalman filter
Matrix measurement = new Matrix(
new double[][] { { heading + odo_angle_delta }, { start_heading + sensor_relative_angle } });
kalman_filter.update(odo_angle_delta, measurement);
x += dx;
y += dy;
// Update our local cache of the current Kalman filter estimate
double estimate = kalman_filter.getMean();
heading = (float) estimate;
odo_angle0 = event.getAngleTurned();
distance0 = event.getDistanceTraveled();
current = !event.isMoving();
}
private float normalize(float angle)
{
float a = angle;
while (a > 180)
a -= 360;
while (a < -180)
a += 360;
return a;
}
private void setPosition(Point p)
{
x = p.x;
y = p.y;
current = true;
}
private void setHeading(float heading)
{
this.heading = heading;
kalman_filter.setState(heading, 0);
current = true;
}
@Override
public int sampleSize()
{
return 3;
}
@Override
public void fetchSample(float[] sample, int offset)
{
if (!current)
{
updatePose(mp.getMovement());
}
sample[offset + 0] = x;
sample[offset + 1] = y;
sample[offset + 2] = heading;
}
@Override
public void setPose(Pose aPose)
{
setPosition(aPose.getLocation());
setHeading(aPose.getHeading());
}
}
| A-Malone/rob301_labs | final_project/src/localization/DirectionKalmanPoseProvider.java | Java | mit | 5,993 |
class CreateSwattrSettings < ActiveRecord::Migration
def change
create_table :swattr_settings do |t|
t.string :title
t.string :logo
t.integer :per_page
t.timestamps null: false
end
end
end
| swattr/swattr | db/migrate/20151101200131_create_swattr_settings.rb | Ruby | mit | 226 |
<?php
return array (
'id' => 'goopad_mini_3g_ver1',
'fallback' => 'generic_android_ver4_2_tablet',
'capabilities' =>
array (
'model_name' => 'Mini 3G',
'brand_name' => 'Goopad',
'can_assign_phone_number' => 'true',
'physical_screen_height' => '151',
'physical_screen_width' => '95',
'resolution_width' => '800',
'resolution_height' => '1280',
),
);
| cuckata23/wurfl-data | data/goopad_mini_3g_ver1.php | PHP | mit | 388 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------
from msrest.serialization import Model
class ImageStoreContent(Model):
"""Information about the image store content.
:param store_files: The list of image store file info objects represents
files found under the given image store relative path.
:type store_files: list of :class:`FileInfo
<azure.servicefabric.models.FileInfo>`
:param store_folders: The list of image store folder info objectes
represents subfolders found under the given image store relative path.
:type store_folders: list of :class:`FolderInfo
<azure.servicefabric.models.FolderInfo>`
"""
_attribute_map = {
'store_files': {'key': 'StoreFiles', 'type': '[FileInfo]'},
'store_folders': {'key': 'StoreFolders', 'type': '[FolderInfo]'},
}
def __init__(self, store_files=None, store_folders=None):
self.store_files = store_files
self.store_folders = store_folders
| AutorestCI/azure-sdk-for-python | azure-servicefabric/azure/servicefabric/models/image_store_content.py | Python | mit | 1,397 |
<html>
<head>
<title>
Bush's torture chambers
</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<?php include "../../legacy-includes/Script.htmlf" ?>
</head>
<body bgcolor="#FFFFCC" text="000000" link="990000" vlink="660000" alink="003366" leftmargin="0" topmargin="0">
<table width="744" cellspacing="0" cellpadding="0" border="0">
<tr><td width="474"><a name="Top"></a><?php include "../../legacy-includes/TopLogo.htmlf" ?></td>
<td width="270"><?php include "../../legacy-includes/TopAd.htmlf" ?>
</td></tr></table>
<table width="744" cellspacing="0" cellpadding="0" border="0">
<tr><td width="18" bgcolor="FFCC66"></td>
<td width="108" bgcolor="FFCC66" valign=top><?php include "../../legacy-includes/LeftButtons.htmlf" ?></td>
<td width="18"></td>
<td width="480" valign="top">
<?php include "../../legacy-includes/BodyInsert.htmlf" ?>
<font face="Times New Roman, Times, serif" size="4">String of new revelations exposes...</font><br>
<font face="Times New Roman, Times, serif" size="5"><b>Bush's torture chambers</b></font><p>
<font face="Arial, Helvetica, sans-serif" size="2">December 16, 2005 | Page 5</font><p>
<font face="Times New Roman, Times, serif" size="3"><b>NICOLE COLSON reports on the latest revelations about U.S. policies of torture.</b><p>
"THE U.S. does not permit, tolerate or condone torture under any circumstances." So said Secretary of State Condoleezza Rice during her visit to Europe.<p>
Yet in the same breath, she chided European leaders for criticizing U.S. intelligence gathering--which, she said, "has helped protect European countries from attack, helping save European lives." Overall, Rice said, "[t]he captured terrorists of the 21st century do not fit easily into traditional systems of criminal or military justice." Therefore, "more extraordinary measures must be taken."<p>
Khaled El-Masri knows exactly what those "extraordinary measures" amount to, and he calls it torture. Earlier this month, El-Masri, a German citizen of Lebanese descent, explained to reporters how, in 2004, he spent months in the custody of the CIA.<p>
El-Masri says he was detained on December 31, 2003, while on a vacation to Macedonia--apparently because his name was similar to that of a suspected terrorist. After more than 20 days of questioning by Macedonian security forces, El-Masri says he was handcuffed, beaten and blindfolded--and flown to what he later learned was a CIA-run prison in Afghanistan.<p>
"I was dragged out of the car, pushed roughly into a building, thrown to the floor, and kicked and beaten on the head, the soles of my feet, and the small of my back," he told reporters. "I was left in a small, dirty, cold concrete cell. There was no bed and one dirty, military-style blanket and some old, torn clothes bundled into a thin pillow. I was extremely thirsty, but there was only a bottle of putrid water in cell. I was refused fresh water."<p>
El-Masri faced daily interrogations. When he went on hunger strike to protest his detention, he says that he was force-fed. He was finally released in May. In all, the father of five spent more five months suffering brutality at the hands of the U.S.--for a case of mistaken identity.<p>
Since last year, when the abuse of detainees at the Abu Ghraib prison in Iraq became known to the world, the Bush administration has brushed aside concerns about torture.<p>
The administration repeatedly claimed that the U.S. soldiers at Abu Ghraib who humiliated, beat and abused prisoners were simply "bad apples." But with each passing week bringing more embarrassing revelations--of hunger-striking detainees violently force-fed at Guantánamo Bay, of members of the 82nd Airborne admitting to Human Rights Watch that the beating of prisoners was seen as "sport" by some soldiers--it's clear that prisoner abuse and torture are a routine part of the Bush administration's "war on terror."<p>
The additional fact, revealed last month, that the U.S. has detained more than 83,000 foreigners over the past four years--enough to fill the NFL's largest football stadium--leaves no doubt that the cases we know of so far are only the tip of the iceberg. <p>
Even the military's own records provide a glimpse of what detainees face at the hands of U.S. interrogators.<p>
Autopsy reports of 44 prisoners who have died while in U.S. custody, obtained by the ACLU under a Freedom of Information Act request and made public in late October, show that at least 21 of the deaths were homicides--eight of which seem to have resulted from abusive techniques.<p>
The conclusion of one autopsy report of an Iraqi man who died under interrogation at Abu Ghraib, reads: "Ligature injuries are present on the wrists and ankles. Fractures of the ribs and a contusion of the left lung imply significant blunt force injuries of the thorax and likely resulted in impaired respiration. According to investigating agents, interviews taken from individuals present at the prison during the interrogation indicate that a hood made of synthetic material was placed over the head and neck of the detainee...The manner of death is homicide." <p>
Another report--about a 47-year-old male detainee killed while in U.S. custody in Al Asad--revealed that he "died of blunt force injuries and asphyxia...According to the investigative report provided by U.S. Army [Criminal Investigation Command], the decedent was shackled to the top of a doorframe with a gag in his mouth at the time he lost consciousness and became pulseless...The manner of death is homicide." <p>
But according to the Bush administration, beating, hooding, smothering, being gagged and shackled to a doorframe--none of this qualifies as "torture." Neither does allowing the CIA to fly prisoners like El-Masri to other countries for secret interrogations.<p>
Cases like El-Masri's have been known about for months, but renewed allegations of prisoner abuse emerged in November when the <i>Washington Post</i> reported that the CIA has "disappeared" large numbers of detainees--and that as many as 30 may currently be held in so-called "black site" prisons located in countries like Poland and Afghanistan.<p>
CIA Director Porter Goss vehemently denied that torture could be involved. "This agency does not do torture," Goss told <i>USA Today</i>. "We use lawful capabilities to collect vital information and we do it in a variety of unique and innovative ways, all of which are legal, and none of which are torture." <p>
The "unique and innovative" methods that Goss referred to are what the CIA calls "enhanced interrogation techniques." These methods include, as described by Britain's <i>Independent</i>: the "attention slap," which is "aimed at causing pain and triggering fear"; "cold treatment," in which a prisoner is left naked in a cell kept at about 50 degrees and regularly doused with cold water; and "waterboarding," where prisoners are bound to a board, plastic is wrapped over their face and either water is poured over them or their head is lowered into a tub.<p>
While the CIA may claim that these techniques don't amount to torture, according to the <i>Independent</i>, CIA officers who subjected <i>themselves </i>to waterboarding lasted an average of just 14 seconds before asking to have the procedure stopped.<p>
As Human Rights Watch's Tom Malinowski told the <i>Guardian</i>, "The reason [Condoleezza Rice] is able to say that the United States does not engage in torture is that the administration has redefined torture to exclude any technique that they use." <p>
<p><font face="Arial, Helvetica, sans-serif" size="1">- - - - - - - - - - - - - - - -</font></p>
<font face="Times New Roman, Times, serif" size="4"><b>Source of the White House war lies</b></font><p>
<font face="Times New Roman, Times, serif" size="3">THE LOGIC of the Bush administration's defense of torture rests on the idea extracting information in a "ticking-bomb terrorist case" by any means can save lives.<p>
But as the <i>New York Times</i> revealed last week, torture tacitly approved of by the U.S. government is partly responsible for the deaths of more than 100,000 Iraqis since the U.S. invasion in March 2003. How? It turns out that torture provided the Bush administration with one of its main justifications for war.<p>
Throughout the run-up to the invasion, the White House claimed that Saddam Hussein's regime had well-established ties to al-Qaeda that included training in chemical weapons and explosives. The evidence for this allegation was largely based on statements of Ibn al-Shaykh al-Libi--a high-ranking al-Qaeda captive who was "rendered" from U.S. custody into the hands of Egyptian security forces by the CIA.<p>
As early as February 2002, a Defense Intelligence Agency report expressed skepticism about Libi's credibility--based in part on the knowledge that he was no longer in American custody when he made the detailed statements, and that he might have been tortured.<p>
Despite this, months later, the Bush administration would use al-Libi's statements as the foundation for its claims about ties between Iraq and Al Qaeda. According to the <i>Times</i>, "During his time in Egyptian custody, Mr. Libi was among a group of what American officials have described as about 150 prisoners sent by the United States from one foreign country to another since the September 11, 2001 attacks for the purposes of interrogation."<p>
<?php include "../../legacy-includes/BottomNavLinks.htmlf" ?>
<td width="12"></td>
<td width="108" valign="top">
<?php include "../../legacy-includes/RightAdFolder.htmlf" ?>
</td>
</tr>
</table>
</body>
</html>
| ISO-tech/sw-d8 | web/2005-2/569/569_05_Torture.php | PHP | mit | 9,636 |
try:
from django.contrib.auth import get_user_model
except ImportError: # Django < 1.5
from django.contrib.auth.models import User
else:
User = get_user_model()
USER_MODEL = {
'orm_label': '%s.%s' % (User._meta.app_label, User._meta.object_name),
'model_label': '%s.%s' % (User._meta.app_label, User._meta.model_name),
'object_name': User.__name__,
}
| bitmazk/django-user-media | user_media/compat.py | Python | mit | 378 |
#!/bin/bash
set -e
# script dir
DAEMON_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
BIN_DIR="$( dirname "$DAEMON_DIR" )"
APP_DIR="$( dirname "$BIN_DIR" )"
# pid file path
PID_FILE="$APP_DIR"/.pid
# get java
JAVA="$( "$DAEMON_DIR"/find-java.sh )"
# check pid file
if [ ! -f "$PID_FILE" ] ; then
echo "Pid file doesn't exist, path: $PID_FILE"
exit 1
fi
# shutdown
PID="$( cat "$PID_FILE" )"
kill "$PID"
rm "$PID_FILE"
echo "TERM signal sent, pid: $PID" | ltg-uic/wc-java-notifier-bot | src/main/java-daemon/bin/java-daemon/stop-daemon.sh | Shell | mit | 469 |
<!DOCTYPE html>
<html lang="fr" class="js csstransforms3d">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<meta name="generator" content="Hugo 0.27" />
<meta name="description" content="Documentation for Hugo Learn Theme">
<meta name="author" content="Mathieu Cornic">
<link rel="shortcut icon" href="/images/favicon.png" type="image/x-icon" />
<link rel="icon" href="/images/favicon.png" type="image/x-icon" />
<title>Raccourcis du menu :: Documentation du thème Hugo Learn</title>
<link href="/css/nucleus.css?1505274170" rel="stylesheet">
<link href="/css/font-awesome.min.css?1505274170" rel="stylesheet">
<link href="/css/hybrid.css?1505274170" rel="stylesheet">
<link href="/css/featherlight.min.css?1505274170" rel="stylesheet">
<link href="/css/perfect-scrollbar.min.css?1505274170" rel="stylesheet">
<link href="/css/horsey.css?1505274170" rel="stylesheet">
<link href="/css/theme.css?1505274170" rel="stylesheet">
<link href="/css/hugo-theme.css?1505274170" rel="stylesheet">
<script src="/js/jquery-2.x.min.js?1505274170"></script>
<style type="text/css">
:root #header + #content > #left > #rlblock_left{
display:none !important;
}
</style>
</head>
<body class="" data-url="/fr/cont/menushortcuts/">
<nav id="sidebar" class="showVisitedLinks">
<div id="header-wrapper">
<div id="header">
<a id="logo" href="/">
<svg id="grav-logo" version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
width="100%" height="100%" viewBox="0 0 285.1 69.9" xml:space="preserve">
<g>
<path d="M35,0c9.6,0,17.9,3.4,24.7,10.3c6.8,6.8,10.3,15,10.3,24.7c0,9.7-3.4,17.9-10.3,24.7c-6.8,6.8-15,10.3-24.7,10.3
c-9.7,0-17.9-3.4-24.7-10.3C3.4,52.8,0,44.6,0,34.9c0-9.6,3.4-17.9,10.3-24.7C17.1,3.4,25.3,0,35,0z M22.3,63.7
c0.3-7.4,0.3-14.7,0-22.1c-2.1-0.4-4-0.4-5.9,0c-0.2,0.8-0.2,2.5-0.1,4.9c0.1,2.3,0,3.9-0.3,4.8c-1.7-0.6-2.7-2.1-3.1-4.6
c-0.1-0.7-0.1-3.3-0.1-8c0-14.5-0.1-23-0.3-25.6c-3.6,4.1-5.6,7-5.9,8.5v10.9c0,4.5,0.1,8.1,0.2,10.9c0,0.4,0,1.3-0.1,2.8
c-0.1,1.2,0,2.1,0.1,2.6c0.1,0.6,1.1,2.1,2.8,4.7C13.2,58.7,17.5,62.2,22.3,63.7z M44.6,65.4c0.3-5,0.2-12.9-0.1-23.6
c-2.1-0.3-4.1-0.3-5.9,0c-0.2,2-0.2,5.1-0.1,9.5c0.1,4.3,0,7.5-0.1,9.5c-2.9,0.4-5,0.3-6.2-0.1c-0.2-5.6-0.2-15.2-0.1-28.7
c0.1-12.4,0-21.8-0.3-28.3c-2.4,0.1-4.3,0.6-5.7,1.3c-0.1,7.7-0.2,17.7-0.1,30.1c0,16.5,0,26.6,0,30.3c2.3,1.1,5.4,1.7,9.4,1.7
C38.9,66.9,42.1,66.4,44.6,65.4z M48.1,64.1c9.7-4.6,15.7-12,18-22.2c-1.8-0.2-3.8-0.3-6.1-0.3c-1.6,3.9-2.6,6.3-3.2,7.2
c-1.1,1.7-2,2.5-2.7,2.5C54,46,54,39.1,54,30.5c0-11.5,0-18.4,0-20.9c-1.4-1.4-3.3-2.5-5.7-3.4C48.1,6.3,48,6.4,48,6.7
c0,3.5,0,13.1,0,28.8C47.9,47.2,48,56.8,48.1,64.1z"/>
</g>
<g>
<path d="M116.6,51.3h-29c-0.5,0-0.9-0.1-1.3-0.2c-0.4-0.2-0.7-0.4-1-0.7c-0.3-0.3-0.5-0.6-0.7-1c-0.2-0.4-0.2-0.8-0.2-1.3V16.3h6.3
V45h25.8V51.3z"/>
<path d="M154.8,51.3h-22.9c-0.9,0-1.8-0.2-2.9-0.5c-1-0.3-2-0.8-2.9-1.5c-0.9-0.7-1.6-1.6-2.2-2.8c-0.6-1.1-0.9-2.5-0.9-4.2V19.5
c0-0.4,0.1-0.9,0.2-1.2c0.2-0.4,0.4-0.7,0.7-1c0.3-0.3,0.6-0.5,1-0.7c0.4-0.2,0.8-0.2,1.3-0.2h28.6v6.3h-25.4v19.8
c0,0.8,0.2,1.5,0.7,1.9s1.1,0.7,1.9,0.7h22.9V51.3z M151.9,37h-20v-6.4h20V37z"/>
<path d="M197.3,51.3H191v-8.6h-22.3v8.6h-6.3V33.8c0-2.6,0.4-4.9,1.3-7.1s2.1-4,3.7-5.5c1.6-1.5,3.4-2.8,5.5-3.6
c2.1-0.9,4.5-1.3,7-1.3h14.3c0.4,0,0.9,0.1,1.2,0.2c0.4,0.2,0.7,0.4,1,0.7s0.5,0.6,0.7,1c0.2,0.4,0.2,0.8,0.2,1.2V51.3z
M168.7,36.4H191V22.6h-11.2c-0.2,0-0.6,0-1.2,0.1c-0.6,0.1-1.4,0.2-2.2,0.4c-0.8,0.2-1.7,0.6-2.6,1c-0.9,0.5-1.8,1.1-2.5,2
c-0.8,0.8-1.4,1.9-1.9,3.1c-0.5,1.2-0.7,2.8-0.7,4.5V36.4z"/>
<path d="M241.7,28.1c0,1.4-0.2,2.7-0.5,3.9c-0.4,1.1-0.8,2.1-1.5,3c-0.6,0.9-1.3,1.6-2.1,2.2c-0.8,0.6-1.6,1.1-2.5,1.5
c-0.9,0.4-1.8,0.7-2.6,0.9c-0.9,0.2-1.7,0.3-2.5,0.3l13.3,11.5h-9.8l-13.2-11.5h-4.6v-6.3H230c0.8-0.1,1.5-0.2,2.2-0.5
c0.7-0.3,1.2-0.6,1.7-1.1c0.5-0.5,0.9-1,1.1-1.6c0.3-0.6,0.4-1.4,0.4-2.2v-4c0-0.4,0-0.6-0.1-0.8c-0.1-0.2-0.2-0.3-0.3-0.4
c-0.1-0.1-0.3-0.1-0.4-0.2c-0.2,0-0.3,0-0.4,0h-20.9v28.7h-6.3V19.5c0-0.4,0.1-0.9,0.2-1.2c0.2-0.4,0.4-0.7,0.7-1
c0.3-0.3,0.6-0.5,1-0.7c0.4-0.2,0.8-0.2,1.3-0.2H234c1.4,0,2.6,0.3,3.6,0.8s1.8,1.2,2.4,1.9c0.6,0.8,1,1.6,1.3,2.5
c0.3,0.9,0.4,1.7,0.4,2.5V28.1z"/>
<path d="M285.1,48.6c0,0.5-0.1,0.9-0.3,1.3c-0.2,0.4-0.4,0.7-0.7,1c-0.3,0.3-0.6,0.5-1,0.7c-0.4,0.2-0.8,0.2-1.2,0.2
c-0.4,0-0.8-0.1-1.2-0.2c-0.4-0.1-0.8-0.4-1.1-0.7l-23.2-24.2v24.7h-6.3V19c0-0.7,0.2-1.2,0.5-1.8c0.4-0.5,0.8-0.9,1.4-1.2
c0.6-0.2,1.2-0.3,1.9-0.2s1.2,0.4,1.6,0.9l23.2,24.2V16.3h6.3V48.6z"/>
</g>
</svg>
</a>
</div>
<div class="searchbox">
<label for="search-by"><i class="fa fa-search"></i></label>
<input data-search-input id="search-by" type="text" placeholder="Rechercher...">
<span data-search-clear=""><i class="fa fa-close"></i></span>
</div>
<script type="text/javascript" src="/js/lunr.min.js?1505274170"></script>
<script type="text/javascript" src="/js/horsey.js?1505274170"></script>
<script type="text/javascript">
var baseurl = "\/\/fr";
</script>
<script type="text/javascript" src="/js/search.js?1505274170"></script>
</div>
<div class="highlightable">
<ul class="topics">
<li data-nav-id="/fr/basics/" title="Démarrage" class="dd-item
">
<a href="/fr/basics/">
<b>1. </b>Démarrage
<i class="fa fa-check read-icon"></i>
</a>
<ul>
<li data-nav-id="/fr/basics/requirements/" title="Prérequis" class="dd-item
">
<a href="/fr/basics/requirements/">
Prérequis
<i class="fa fa-check read-icon"></i>
</a>
</li>
<li data-nav-id="/fr/basics/installation/" title="Installation" class="dd-item
">
<a href="/fr/basics/installation/">
Installation
<i class="fa fa-check read-icon"></i>
</a>
</li>
<li data-nav-id="/fr/basics/configuration/" title="Configuration" class="dd-item
">
<a href="/fr/basics/configuration/">
Configuration
<i class="fa fa-check read-icon"></i>
</a>
</li>
<li data-nav-id="/fr/basics/style-customization/" title="Personnalisation du style" class="dd-item
">
<a href="/fr/basics/style-customization/">
Personnalisation du style
<i class="fa fa-check read-icon"></i>
</a>
</li>
</ul>
</li>
<li data-nav-id="/fr/cont/" title="Contenu" class="dd-item
parent
">
<a href="/fr/cont/">
<b>2. </b>Contenu
<i class="fa fa-check read-icon"></i>
</a>
<ul>
<li data-nav-id="/fr/cont/pages/" title="Organisation des pages" class="dd-item
">
<a href="/fr/cont/pages/">
Organisation des pages
<i class="fa fa-check read-icon"></i>
</a>
</li>
<li data-nav-id="/fr/cont/archetypes/" title="Archétypes" class="dd-item ">
<a href="/fr/cont/archetypes/">
Archétypes
<i class="fa fa-check read-icon"></i>
</a>
</li>
<li data-nav-id="/fr/cont/markdown/" title="Syntaxe Markdown" class="dd-item ">
<a href="/fr/cont/markdown/">
Syntaxe Markdown
<i class="fa fa-check read-icon"></i>
</a>
</li>
<li data-nav-id="/fr/cont/menushortcuts/" title="Raccourcis du menu" class="dd-item active">
<a href="/fr/cont/menushortcuts/">
Raccourcis du menu
<i class="fa fa-check read-icon"></i>
</a>
</li>
<li data-nav-id="/fr/cont/i18n/" title="Multi-langue et i18n" class="dd-item
">
<a href="/fr/cont/i18n/">
Multi-langue et i18n
<i class="fa fa-check read-icon"></i>
</a>
</li>
</ul>
</li>
<li data-nav-id="/fr/shortcodes/" title="Shortcodes" class="dd-item
">
<a href="/fr/shortcodes/">
<b>3. </b>Shortcodes
<i class="fa fa-check read-icon"></i>
</a>
<ul>
<li data-nav-id="/fr/shortcodes/attachments/" title="Attachments (Pièces jointes)" class="dd-item ">
<a href="/fr/shortcodes/attachments/">
Attachments (Pièces jointes)
<i class="fa fa-check read-icon"></i>
</a>
</li>
<li data-nav-id="/fr/shortcodes/button/" title="Button (Bouton)" class="dd-item ">
<a href="/fr/shortcodes/button/">
Button (Bouton)
<i class="fa fa-check read-icon"></i>
</a>
</li>
<li data-nav-id="/fr/shortcodes/expand/" title="Expand" class="dd-item ">
<a href="/fr/shortcodes/expand/">
Expand
<i class="fa fa-check read-icon"></i>
</a>
</li>
<li data-nav-id="/fr/shortcodes/mermaid/" title="Mermaid" class="dd-item ">
<a href="/fr/shortcodes/mermaid/">
Mermaid
<i class="fa fa-check read-icon"></i>
</a>
</li>
<li data-nav-id="/fr/shortcodes/notice/" title="Notice" class="dd-item ">
<a href="/fr/shortcodes/notice/">
Notice
<i class="fa fa-check read-icon"></i>
</a>
</li>
<li data-nav-id="/fr/shortcodes/siteparam/" title="Site param" class="dd-item ">
<a href="/fr/shortcodes/siteparam/">
Site param
<i class="fa fa-check read-icon"></i>
</a>
</li>
</ul>
</li>
</ul>
<section id="shortcuts">
<h3>Aller plus loin</h3>
<ul>
<li class="" role="">
<a class="padding" href="https://github.com/matcornic/hugo-theme-learn"><i class='fa fa-github'></i> Repo Github</a>
</li>
<li class="" role="">
<a class="padding" href="fr/showcase"><i class='fa fa-camera'></i> Vitrine</a>
</li>
<li class="" role="">
<a class="padding" href="https://gohugo.io/"><i class='fa fa-bookmark'></i> Documentation Hugo</a>
</li>
<li class="" role="">
<a class="padding" href="fr/credits"><i class='fa fa-bullhorn'></i> Crédits</a>
</li>
</ul>
</section>
<section id="prefooter">
<hr/>
<ul>
<li>
<a class="padding">
<i class="fa fa-fw fa-language"></i>
<div class="select-style">
<select id="select-language" onchange="location = this.value;">
<option id="en" value="/en/cont/menushortcuts/">English</option>
<option id="fr" value="/fr/cont/menushortcuts/" selected>Français</option>
</select>
<svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
width="255px" height="255px" viewBox="0 0 255 255" style="enable-background:new 0 0 255 255;" xml:space="preserve">
<g>
<g id="arrow-drop-down">
<polygon points="0,63.75 127.5,191.25 255,63.75 " />
</g>
</g>
</svg>
</div>
</a>
</li>
<li><a class="padding" href="#" data-clear-history-toggle=""><i class="fa fa-fw fa-history"></i> Supprimer l'historique</a></li>
</ul>
</section>
<section id="footer">
<center>
<a class="github-button" href="https://github.com/matcornic/hugo-theme-learn/archive/master.zip" data-icon="octicon-cloud-download" aria-label="Download matcornic/hugo-theme-learn on GitHub">Download</a>
<a class="github-button" href="https://github.com/matcornic/hugo-theme-learn" data-icon="octicon-star" data-show-count="true" aria-label="Star matcornic/hugo-theme-learn on GitHub">Star</a>
<a class="github-button" href="https://github.com/matcornic/hugo-theme-learn/fork" data-icon="octicon-repo-forked" data-show-count="true" aria-label="Fork matcornic/hugo-theme-learn on GitHub">Fork</a>
<p>Built with <a href="https://github.com/matcornic/hugo-theme-learn"><i class="fa fa-heart"></i></a> from <a href="http://getgrav.org">Grav</a> and <a href="http://gohugo.io/">Hugo</a></p>
</center>
<script async defer src="https://buttons.github.io/buttons.js"></script>
</section>
</div>
</nav>
<section id="body">
<div id="overlay"></div>
<div class="padding highlightable sticky-parent">
<div class="sticky-spacer">
<div id="top-bar">
<div id="top-github-link">
<a class="github-link" href="https://github.com/matcornic/hugo-theme-learn/edit/master/exampleSite/content/cont/menushortcuts.fr.md" target="blank">
<i class="fa fa-code-fork"></i>
Modifier la page
</a>
</div>
<div id="breadcrumbs" itemscope="" itemtype="http://data-vocabulary.org/Breadcrumb">
<span id="sidebar-toggle-span">
<a href="#" id="sidebar-toggle" data-sidebar-toggle="">
<i class="fa fa-bars"></i>
</a>
</span>
<span id="toc-menu"><i class="fa fa-list-alt"></i></span>
<span class="links">
<a href='/fr/'>Learn Theme for Hugo</a> > <a href='/fr/cont/'>Contenu</a> > Raccourcis du menu
</span>
</div>
<div class="progress">
<div class="wrapper">
<nav id="TableOfContents">
<ul>
<li>
<ul>
<li><a href="#configuration-simple">Configuration simple</a></li>
<li><a href="#i18n">Configuration pour le mode multi-langue</a></li>
</ul></li>
</ul>
</nav>
</div>
</div>
</div>
</div>
<div id="body-inner">
<h1>Raccourcis du menu</h1>
<p>Vous pouvez définir des entrées ou raccourcis supplémentaires dans le menu sans avoir besoin d’être lié à un contenu du site.</p>
<h2 id="configuration-simple">Configuration simple</h2>
<p>Editez le fichier de configuration <code>config.toml</code> et ajoutez une entrée <code>[[menu.shortcuts]]</code> pour chaque lien que vous voulez ajouter.</p>
<p>Exemple pour ce site:</p>
<pre><code>[[menu.shortcuts]]
name = "<i class='fa fa-github'></i> Github repo"
identifier = "ds"
url = "https://github.com/matcornic/hugo-theme-learn"
weight = 10
[[menu.shortcuts]]
name = "<i class='fa fa-camera'></i> Showcases"
url = "/showcase"
weight = 11
[[menu.shortcuts]]
name = "<i class='fa fa-bookmark'></i> Hugo Documentation"
identifier = "hugodoc"
url = "https://gohugo.io/"
weight = 20
[[menu.shortcuts]]
name = "<i class='fa fa-bullhorn'></i> Credits"
url = "/credits"
weight = 30
</code></pre>
<p>Par défaut, les raccourcis sont précédés par un titre. Ce titre peut être désactivé en ajouter le paramètre <code>disableShortcutsTitle=true</code> dans la section <code>params</code> de votre <code>config.toml</code>.
Cependant, si vous voulez garder le titre mais changer sa valeur, vous pouvez modifier votre configuration multilangue locale en changeant les <em>translation string</em>.</p>
<p>Par exemple, dans votre fichier local <code>i18n/en.toml</code>, ajouter le contenu</p>
<pre><code>[Shortcuts-Title]
other = "<Votre valeur>"
</code></pre>
<p>Plus d’infos sur <a href="https://gohugo.io/extras/menus/">les menus Hugo</a> et sur <a href="https://gohugo.io/content-management/multilingual/#translation-of-strings">les translations strings</a></p>
<h2 id="i18n">Configuration pour le mode multi-langue</h2>
<p>Quand vous utilisez un site multi-langue, vous pouvez avoir des menus différents pour chaque langage. Dans le fichier de configuration <code>config.toml</code>, préfixez votre configuration par <code>Languages.<language-id></code>.</p>
<p>Par exemple, avec ce site :</p>
<pre><code>[Languages]
[Languages.en]
title = "Documentation for Hugo Learn Theme"
weight = 1
languageName = "English"
[[Languages.en.menu.shortcuts]]
name = "<i class='fa fa-github'></i> Github repo"
identifier = "ds"
url = "https://github.com/matcornic/hugo-theme-learn"
weight = 10
[[Languages.en.menu.shortcuts]]
name = "<i class='fa fa-camera'></i> Showcases"
url = "/showcase"
weight = 11
[[Languages.en.menu.shortcuts]]
name = "<i class='fa fa-bookmark'></i> Hugo Documentation"
identifier = "hugodoc"
url = "https://gohugo.io/"
weight = 20
[[Languages.en.menu.shortcuts]]
name = "<i class='fa fa-bullhorn'></i> Credits"
url = "/credits"
weight = 30
[Languages.fr]
title = "Documentation du thème Hugo Learn"
weight = 2
languageName = "Français"
[[Languages.fr.menu.shortcuts]]
name = "<i class='fa fa-github'></i> Repo Github"
identifier = "ds"
url = "https://github.com/matcornic/hugo-theme-learn"
weight = 10
[[Languages.fr.menu.shortcuts]]
name = "<i class='fa fa-camera'></i> Vitrine"
url = "/showcase"
weight = 11
[[Languages.fr.menu.shortcuts]]
name = "<i class='fa fa-bookmark'></i> Documentation Hugo"
identifier = "hugodoc"
url = "https://gohugo.io/"
weight = 20
[[Languages.fr.menu.shortcuts]]
name = "<i class='fa fa-bullhorn'></i> Crédits"
url = "/credits"
weight = 30
</code></pre>
<p>Plus d’infos sur <a href="https://gohugo.io/extras/menus/">les menus Hugo</a> et les <a href="https://gohugo.io/content-management/multilingual/#menus">menus multi-langue Hugo</a></p>
<footer class=" footline" >
</footer>
</div>
</div>
<div id="navigation">
<a class="nav nav-prev" href="/fr/cont/markdown/" title="Syntaxe Markdown"> <i class="fa fa-chevron-left"></i></a>
<a class="nav nav-next" href="/fr/cont/i18n/" title="Multi-langue et i18n" style="margin-right: 0px;"><i class="fa fa-chevron-right"></i></a>
</div>
</section>
<div style="left: -1000px; overflow: scroll; position: absolute; top: -1000px; border: none; box-sizing: content-box; height: 200px; margin: 0px; padding: 0px; width: 200px;">
<div style="border: none; box-sizing: content-box; height: 200px; margin: 0px; padding: 0px; width: 200px;"></div>
</div>
<script src="/js/clipboard.min.js?1505274170"></script>
<script src="/js/perfect-scrollbar.min.js?1505274170"></script>
<script src="/js/perfect-scrollbar.jquery.min.js?1505274170"></script>
<script src="/js/jquery.sticky-kit.min.js?1505274170"></script>
<script src="/js/featherlight.min.js?1505274170"></script>
<script src="/js/html5shiv-printshiv.min.js?1505274170"></script>
<script src="/js/highlight.pack.js?1505274170"></script>
<script>hljs.initHighlightingOnLoad();</script>
<script src="/js/modernizr.custom.71422.js?1505274170"></script>
<script src="/js/learn.js?1505274170"></script>
<script src="/js/hugo-learn.js?1505274170"></script>
<link href="/mermaid/mermaid.css?1505274170" type="text/css" rel="stylesheet" />
<script src="/mermaid/mermaid.js?1505274170"></script>
<script>
mermaid.initialize({ startOnLoad: true });
</script>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-105947713-1', 'auto');
ga('send', 'pageview');
</script>
</body>
</html>
| Ashishtechnaut/HugoTest | docs/fr/cont/menushortcuts/index.html | HTML | mit | 31,404 |
Title: Helping at the Software Carpentry course Oslo June 2--3rd
Date: 2015-06-05 08:12
Category: Post
Slug: swc_oslo_2015
Tags: Software Carpentry, Teaching
Author: Benjamin Laken
Email: [email protected]
Summary: First experience with Software Carpentry in Oslo

Helping at the [Software Carpentry](http://software-carpentry.org)
course, June 2--3rd Oslo run by [Lex
Nederbragt](https://twitter.com/lexnederbragt)[](), certainly gave me a
lot to consider. The two-day course taught novice users Bash, Git, and
Python ([Jupyter Notebook](https://jupyter.org)). Three invaluable and
complimentary tools which are the centre of my own work-flow. I was
excited to see how people were introduced to these tools and the
Software Carpentry teaching methods. The collaborative [Git-based lesson
materials](http://software-carpentry.org/lessons.html) are especially
nice, and I can only hope this teaching model spreads far and wide. I
certainty appreciated running through the course material, and in
particular I don't remember seeing a clearer introduction to Git and
Bash.
Myself, I stumbled into the use of Bash, Git and Python one-by-one over
time and learned alone through a lot of trial-and-error (and Youtube)
over a relatively long period of time. So I was quite curious to see how
the students would absorb so much information so quickly, and if it
would really change the way they intend to work in the future. The
students were very competent, and I got the feeling that they quickly
realized the possibilities for these tools. In fact there was very
little for the helpers to do, as the students (and even their computers)
were all operating excellently!
The Software Carpentry Information for helpers and teaching instructions
was superb, and certainly gave me a few things to consider. I had seen
[Greg Wilson](https://twitter.com/gvwilson), the creator of Software
Carpentry talk about some of the ideas underpinning the group on Youtube
([for example see here](https://www.youtube.com/watch?v=Q7wyA2lbPaU)),
and had been meaning to follow his suggested readings on the subject of
teaching (such as [How learning Works by Susan Ambrose et
al](http://www.amazon.com/How-Learning-Works-Research-Based-Principles/dp/0470484101)).
Following the course recommendations about the use of language and
computer etiquette to students was a valuable experience: for example,
not using the word 'just' (as they consider that it immediately sets a
tone of inaccessibility), and not taking-over keyboards when students
run into trouble or using short-cuts to fix problems. These were quite
an adjustment at first, as without being aware of it, these actions were
definitely my default setting ("Ah, a problem? You should just do thing
x! \*\*while I type a blur of short-cut keys\*\*" - I can see how that
might be sub-optimal for student-learning...). So I immediately felt
making the small changes the course suggested forced me into a much more
user-friendly state for the students!
To improve the course though, I think that I would have tried to
emphasise some real-world use cases from the Jupyter Notebook. As, even
if the students can't understand yet how they were built, they would at
least see what is be possible. For me at least, seeing people working at
a high-level in these tools was a big motivation for self-improvement,
as I realised that these were the tools that could take your work to a
new level and were the tools worth investing time in learning. By only
presenting a simplified use cases I got the feeling that although
everyone probably left with a good handle on what was covered, perhaps
they were still largely unaware of the possibilities in Python and the
Jupyter Notebook for Open Science, which for me is the most interesting
and exciting part.
| benlaken/blogsite | content/content/swc2015.md | Markdown | mit | 3,810 |
# frozen_string_literal: true
require 'spec_helper'
require 'vagrant/ansible_auto/host'
describe VagrantPlugins::AnsibleAuto::Host do
include_context 'host'
let(:hostvars) do
{
ansible_ssh_user: 'me',
ansible_ssh_host: 'foo.bar.net',
ansible_ssh_port: 2222,
ansible_ssh_private_key_file: '/path/to/private_key'
}
end
describe '#name' do
it 'corresponds to the first parameter of the constructor' do
expect(host.name).to eq machine_name
end
end
describe '#inventory_hostname' do
it 'corresponds to the first parameter of the constructor, stringified' do
expect(host.inventory_hostname).to eq machine_name.to_s
end
end
describe '#ssh_user' do
it 'corresponds to hostvars[:ansible_ssh_user]' do
expect(host.ansible_ssh_user).to eq 'me'
end
end
describe '#ssh_host' do
it 'corresponds to hostvars[:ansible_ssh_host]' do
expect(host.ansible_ssh_host).to eq 'foo.bar.net'
end
end
describe '#ssh_port' do
it 'corresponds to hostvars[:ansible_ssh_port]' do
expect(host.ansible_ssh_port).to eq 2222
end
end
describe '#ssh_private_key_file' do
it 'corresponds to hostvars[:ansible_ssh_private_key_file]' do
expect(host.ansible_ssh_private_key_file).to eq '/path/to/private_key'
end
end
describe '#hostvars' do
it 'stringifies its keys' do
expect(host.hostvars).to eq(
'ansible_ssh_user' => 'me',
'ansible_ssh_host' => 'foo.bar.net',
'ansible_ssh_port' => 2222,
'ansible_ssh_private_key_file' => '/path/to/private_key'
)
end
end
describe '#to_h' do
it 'returns #hostvars keyed to #inventory_hostname' do
expect(host.to_h).to eq(host.inventory_hostname => {
'ansible_ssh_user' => 'me',
'ansible_ssh_host' => 'foo.bar.net',
'ansible_ssh_port' => 2222,
'ansible_ssh_private_key_file' => '/path/to/private_key'
})
end
end
describe "a method starting with `ansible_'" do
it 'dispatches to hostvars' do
host.ansible_python_interpreter = '/usr/bin/python2.7'
expect(host.ansible_python_interpreter).to eq '/usr/bin/python2.7'
expect(host.hostvars[:ansible_python_interpreter]).to eq '/usr/bin/python2.7'
end
end
describe '#to_ini' do
it 'returns #to_h as INI-style lines' do
expect(host.to_ini).to eq(unindent(<<-HOST).chomp)
#{inventory_hostname} ansible_ssh_host=foo.bar.net ansible_ssh_port=2222 ansible_ssh_private_key_file=/path/to/private_key ansible_ssh_user=me
HOST
end
end
end
describe VagrantPlugins::AnsibleAuto::HostMachine do
include_context 'host'
describe '#ansible_ssh_user' do
it 'corresponds to machine.ssh_info[:username]' do
expect(ssh_info).to receive(:[]).with(:username).and_return('me')
expect(host_machine.ansible_ssh_user).to eq 'me'
end
end
describe '#ansible_ssh_host' do
it 'corresponds to machine.ssh_info[:host]' do
expect(ssh_info).to receive(:[]).with(:host).and_return('foo.bar.net')
expect(host_machine.ansible_ssh_host).to eq 'foo.bar.net'
end
end
describe '#ansible_ssh_port' do
it 'corresponds to machine.ssh_info[:port]' do
expect(ssh_info).to receive(:[]).with(:port).and_return(2222)
expect(host_machine.ansible_ssh_port).to eq 2222
end
end
describe '#ansible_ssh_private_key_file' do
it 'corresponds to machine.ssh_info[:private_key_path]' do
expect(machine.config.ssh).to receive(:insert_key).and_return(true)
expect(ssh_info).to receive(:fetch).with(:private_key_path, anything).and_return(['/path/to/private_key'])
expect(host_machine.ansible_ssh_private_key_file).to eq '/path/to/private_key'
end
it 'has no default' do
expect(machine.config.ssh).to receive(:insert_key).and_return(true)
expect(ssh_info).to receive(:fetch).with(:private_key_path, anything).and_return([])
expect(host_machine.ansible_ssh_private_key_file).to be_nil
end
end
end
| BaxterStockman/vagrant-ansible_auto | spec/unit/vagrant/ansible_auto/host_spec.rb | Ruby | mit | 4,243 |
#include "splashscreen.h"
#include "clientversion.h"
#include "util.h"
#include <QPainter>
#undef loop /* ugh, remove this when the #define loop is gone from util.h */
#include <QApplication>
SplashScreen::SplashScreen(const QPixmap &pixmap, Qt::WindowFlags f) :
QSplashScreen(pixmap, f)
{
// set reference point, paddings
int paddingRight = 20;
int paddingTop = 50;
int titleVersionVSpace = 17;
int titleCopyrightVSpace = 40;
int titleCopyrightVSpace2 = 53;
float fontFactor = 1.0;
// define text to place
QString titleText = QString(QApplication::applicationName()).replace(QString("-testnet"), QString(""), Qt::CaseSensitive); // cut of testnet, place it as single object further down
QString versionText = QString("Version %1").arg(QString::fromStdString(FormatFullVersion()));
QString copyrightText = QChar(0xA9)+QString(" 2009-%1 ").arg(COPYRIGHT_YEAR) + QString(tr("The Bitcoin Developers"));
QString copyrightText2 = QChar(0xA9)+QString(" 2013 ") + QString(tr("The OMGCoin Team"));
QString testnetAddText = QString(tr("[testnet]")); // define text to place as single text object
QString font = "Arial";
// load the bitmap for writing some text over it
QPixmap newPixmap;
if(GetBoolArg("-testnet", false)) {
newPixmap = QPixmap(":/images/splash_testnet");
}
else {
newPixmap = QPixmap(":/images/splash");
}
QPainter pixPaint(&newPixmap);
pixPaint.setPen(QColor(100,100,100));
// check font size and drawing with
pixPaint.setFont(QFont(font, 33*fontFactor));
QFontMetrics fm = pixPaint.fontMetrics();
int titleTextWidth = fm.width(titleText);
if(titleTextWidth > 160) {
// strange font rendering, Arial probably not found
fontFactor = 0.75;
}
pixPaint.setFont(QFont(font, 33*fontFactor));
fm = pixPaint.fontMetrics();
titleTextWidth = fm.width(titleText);
pixPaint.drawText(newPixmap.width()-titleTextWidth-paddingRight,paddingTop,titleText);
pixPaint.setFont(QFont(font, 15*fontFactor));
// if the version string is to long, reduce size
fm = pixPaint.fontMetrics();
int versionTextWidth = fm.width(versionText);
if(versionTextWidth > titleTextWidth+paddingRight-10) {
pixPaint.setFont(QFont(font, 10*fontFactor));
titleVersionVSpace -= 5;
}
pixPaint.drawText(newPixmap.width()-titleTextWidth-paddingRight+2,paddingTop+titleVersionVSpace,versionText);
// draw copyright stuff
pixPaint.setFont(QFont(font, 10*fontFactor));
pixPaint.drawText(newPixmap.width()-titleTextWidth-paddingRight,paddingTop+titleCopyrightVSpace,copyrightText);
pixPaint.drawText(newPixmap.width()-titleTextWidth-paddingRight,paddingTop+titleCopyrightVSpace2,copyrightText2);
// draw testnet string if -testnet is on
if(QApplication::applicationName().contains(QString("-testnet"))) {
// draw copyright stuff
QFont boldFont = QFont(font, 10*fontFactor);
boldFont.setWeight(QFont::Bold);
pixPaint.setFont(boldFont);
fm = pixPaint.fontMetrics();
int testnetAddTextWidth = fm.width(testnetAddText);
pixPaint.drawText(newPixmap.width()-testnetAddTextWidth-10,15,testnetAddText);
}
pixPaint.end();
this->setPixmap(newPixmap);
}
| knumchoke/omgcoin | src/qt/splashscreen.cpp | C++ | mit | 3,398 |
<?php
/**
* SectionTypeTranslation filter form base class.
*
* @package sf_sandbox
* @subpackage filter
* @author Your name here
* @version SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php 29570 2010-05-21 14:49:47Z Kris.Wallsmith $
*/
abstract class BaseSectionTypeTranslationFormFilter extends BaseFormFilterDoctrine
{
public function setup()
{
$this->setWidgets(array(
'name' => new sfWidgetFormFilterInput(array('with_empty' => false)),
'description' => new sfWidgetFormFilterInput(),
));
$this->setValidators(array(
'name' => new sfValidatorPass(array('required' => false)),
'description' => new sfValidatorPass(array('required' => false)),
));
$this->widgetSchema->setNameFormat('section_type_translation_filters[%s]');
$this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);
$this->setupInheritance();
parent::setup();
}
public function getModelName()
{
return 'SectionTypeTranslation';
}
public function getFields()
{
return array(
'id' => 'Number',
'name' => 'Text',
'description' => 'Text',
'lang' => 'Text',
);
}
}
| nlkhagva/educenter.mn | lib/filter/doctrine/base/BaseSectionTypeTranslationFormFilter.class.php | PHP | mit | 1,218 |
/**
* Created by abel on 30/08/16.
*/
const BillNumber = require("../model/model-bill-number.js");
const common = require("../common/response.decorator.js");
exports.initBillId = (req, res) => {
console.log('_________ Post init Bill Id ________');
var billNumber = new BillNumber({
billNumber: req.params.number
});
billNumber.save((err, response) => common.responseDecorator(err, res, response, 'Init bill Number'))
};
exports.setBillNumber = (req, res) => {
console.log('_________ set Bill Number ________');
BillNumber.find({}, function (err, obj) {
console.log('number bill ', obj[0].billNumber);
obj[0].billNumber = obj[0].billNumber + 1;
obj[0].save();
});
};
| abel-salas/app_thai | api_rest/src/controller/controller-bill-id.js | JavaScript | mit | 736 |
<?php
/* aymanBlogBundle:Blog:index.html.twig */
class __TwigTemplate_0a0b5a6e414c568f4598bfed2b13be54e7162c606efbeb331f8ce588e57a276f extends Twig_Template
{
public function __construct(Twig_Environment $env)
{
parent::__construct($env);
$this->parent = $this->env->loadTemplate("aymanBlogBundle::layout.html.twig");
$this->blocks = array(
'title' => array($this, 'block_title'),
'articelsBlog_body' => array($this, 'block_articelsBlog_body'),
);
}
protected function doGetParent(array $context)
{
return "aymanBlogBundle::layout.html.twig";
}
protected function doDisplay(array $context, array $blocks = array())
{
$this->parent->display($context, array_merge($this->blocks, $blocks));
}
// line 4
public function block_title($context, array $blocks = array())
{
// line 5
echo "Accueil - ";
$this->displayParentBlock("title", $context, $blocks);
echo "
";
}
// line 8
public function block_articelsBlog_body($context, array $blocks = array())
{
// line 9
echo "\t<h2>Liste des articles</h2>
\t<ul>
\t
\t<ul>
\t\t";
// line 13
$context['_parent'] = (array) $context;
$context['_seq'] = twig_ensure_traversable((isset($context["articles"]) ? $context["articles"] : $this->getContext($context, "articles")));
$context['_iterated'] = false;
$context['loop'] = array(
'parent' => $context['_parent'],
'index0' => 0,
'index' => 1,
'first' => true,
);
if (is_array($context['_seq']) || (is_object($context['_seq']) && $context['_seq'] instanceof Countable)) {
$length = count($context['_seq']);
$context['loop']['revindex0'] = $length - 1;
$context['loop']['revindex'] = $length;
$context['loop']['length'] = $length;
$context['loop']['last'] = 1 === $length;
}
foreach ($context['_seq'] as $context["_key"] => $context["article"]) {
// line 14
echo "\t\t";
// line 15
echo "\t\t";
$this->env->loadTemplate("aymanBlogBundle:Blog:article.html.twig")->display(array_merge($context, array("accueil" => true)));
// line 17
echo "\t\t<hr />
\t\t";
$context['_iterated'] = true;
++$context['loop']['index0'];
++$context['loop']['index'];
$context['loop']['first'] = false;
if (isset($context['loop']['length'])) {
--$context['loop']['revindex0'];
--$context['loop']['revindex'];
$context['loop']['last'] = 0 === $context['loop']['revindex0'];
}
}
if (!$context['_iterated']) {
// line 19
echo "\t\t<p>Pas (encore !) d'articles</p>
\t\t";
}
$_parent = $context['_parent'];
unset($context['_seq'], $context['_iterated'], $context['_key'], $context['article'], $context['_parent'], $context['loop']);
$context = array_intersect_key($context, $_parent) + $_parent;
// line 21
echo "\t</ul>
\t
\t
\t<div class=\"pagination\">
\t\t<ul>
\t\t";
// line 28
echo "\t\t";
$context['_parent'] = (array) $context;
$context['_seq'] = twig_ensure_traversable(range(1, (isset($context["nombrePage"]) ? $context["nombrePage"] : $this->getContext($context, "nombrePage"))));
foreach ($context['_seq'] as $context["_key"] => $context["p"]) {
// line 29
echo "\t\t\t<li";
if (((isset($context["p"]) ? $context["p"] : $this->getContext($context, "p")) == (isset($context["page"]) ? $context["page"] : $this->getContext($context, "page")))) {
echo " class=\"active\"";
}
echo ">
\t\t\t<a href=\"";
// line 30
echo twig_escape_filter($this->env, $this->env->getExtension('routing')->getPath("blog_accueil", array("page" => (isset($context["p"]) ? $context["p"] : $this->getContext($context, "p")))), "html", null, true);
echo "\">";
echo twig_escape_filter($this->env, (isset($context["p"]) ? $context["p"] : $this->getContext($context, "p")), "html", null, true);
echo "</a>
\t\t\t</li>
\t\t";
}
$_parent = $context['_parent'];
unset($context['_seq'], $context['_iterated'], $context['_key'], $context['p'], $context['_parent'], $context['loop']);
$context = array_intersect_key($context, $_parent) + $_parent;
// line 33
echo "\t\t</ul>
\t</div>
\t</ul>
";
}
public function getTemplateName()
{
return "aymanBlogBundle:Blog:index.html.twig";
}
public function isTraitable()
{
return false;
}
public function getDebugInfo()
{
return array ( 122 => 33, 111 => 30, 104 => 29, 99 => 28, 92 => 21, 85 => 19, 71 => 17, 68 => 15, 66 => 14, 48 => 13, 42 => 9, 39 => 8, 32 => 5, 29 => 4,);
}
}
| itkg-aawad/test | app/cache/dev/twig/0a/0b/5a6e414c568f4598bfed2b13be54e7162c606efbeb331f8ce588e57a276f.php | PHP | mit | 5,116 |
//
// GLProjectiveImage.h
// PanoPlayer
//
// Created by qiruisun on 15/8/18.
// Copyright (c) 2015年 apple. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <AVKit/AVKit.h>
#import "GLDistortiondata.h"
@interface GLProjectiveImage : NSObject
- (UIImage*) imageFromBytes:(unsigned char *)bytes width:(int)width height:(int)height;
-(UIImage*)convertFisheyeToRect:(UIImage*)fisheyeimage deviceid:(int)deviceid;
-(UIImage*)convertDistortUIImage:(UIImage *)fisheyeimage deviceid:(int)deviceid;
-(UIImage*)convertPanoUIImageByRotaion:(UIImage*)fisheyeimage imgdata:(Image*)imgdata;
-(UIImage*)convertPanoUIImage:(UIImage*)fisheyeimage deviceid:(int)deviceid;
-(UIImage*)convertPanoUIImage:(UIImage*)fisheyeimage deviceid:(int)deviceid iscrop:(bool)iscrop;
-(UIImage*)convertPanoUIImage:(UIImage*)fisheyeimage imgdata:(Image*)imgdata iscrop:(bool)iscrop;
//只找一次圆
-(UIImage*)convertPanoUIImage2:(UIImage*)fisheyeimage imgdata:(Image*)imgdata iscrop:(bool)iscrop;
@end
| hzdetu/panoplayer_ios_static | lib/include/GLProjectiveImage.h | C | mit | 1,003 |
# EmailValidator
This gem is a simple email validator, and it has the following rules:
- an @ character must separate the local and domain parts
- only one @ is allowed
- none of the special characters in this local part is allowed
- quoted strings must be dot separated or the only element making up the local-part
- does not accept spaces, quotes, and backslashes
- does not accept even if escaped (preceded by a backslash), spaces, quotes, and backslashes
- does not accept double dot before @
- does not accept double dot after @
- does not accept accent marks
Regex to validate email: /\A\w(\w|[.-]\w)*@\w((\w|[-]\w)*\.\w+)+\z/i
## Installation
Add this line to your application's Gemfile:
```ruby
gem 'email_validator'
```
And then execute:
$ bundle
Or install it yourself as:
$ gem install email_validator
## Using it
This gem is a simple `ActiveModel::EachValidator` and you can use it like:
`validates <field-to-be-validated>, email: true`
Ex.
```ruby
validates :spouse_email, email: true
```
## Contributing
1. Fork it ( https://github.com/[my-github-username]/email_validator/fork )
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create a new Pull Request
| BankFacil/email_validator | README.md | Markdown | mit | 1,329 |
package org.prototype.primecount.view.handler;
import java.util.Locale;
import org.prototype.primecount.foundation.ProtoInvalidValueException;
import org.prototype.primecount.view.base.SimplePrototypeRegistry;
import com.vaadin.data.Validator;
import com.vaadin.data.util.converter.AbstractStringToNumberConverter;
import com.vaadin.data.util.converter.Converter.ConversionException;
import com.vaadin.ui.Notification;
import com.vaadin.ui.Notification.Type;
@SuppressWarnings("serial")
public abstract class AbstractValidator<T> implements Validator
{
private static final String DEF_MSG = "Unexpected value";
private final AbstractStringToNumberConverter<T> string2NumCnvrtr;
private final String vldtMessage;
protected AbstractValidator(final String validateMessage, final AbstractStringToNumberConverter<T> converterPassed)
{
assert null != converterPassed : "Parameter 'converterPassed' of 'AbstractValidator''s ctor must not be null";
this.string2NumCnvrtr = converterPassed;
if (null == validateMessage || validateMessage.isEmpty())
{
this.vldtMessage = DEF_MSG;
}
else
{
this.vldtMessage = validateMessage;
}
}
@Override
public void validate(final Object value) throws InvalidValueException
{
assert null != value : "Parameter 'value' of method 'validate' must not be null";
if (value instanceof String)
{
try
{
SimplePrototypeRegistry.getInstance().getController().clearCurrentInputData(); //NOPMD
final Class<? extends T> targetType = this.string2NumCnvrtr.getModelType();
final Locale locale = Locale.UK;
final Integer sourceValue = (Integer) this.string2NumCnvrtr.convertToModel((String) value, targetType, locale);
SimplePrototypeRegistry.getInstance().getController().consumeUpperBound(sourceValue); //NOPMD
}
catch (ConversionException e)
{
//TODO consider moving this notification invokation to a better place
Notification.show("Validation", this.vldtMessage, Type.ERROR_MESSAGE); //NOPMD
throw new ProtoInvalidValueException(this.vldtMessage, e);
}
}
}
}
| tonight-halfmoon/Vaadin-Prime-Count | org.prototype.primecount/src/main/java/org/prototype/primecount/view/handler/AbstractValidator.java | Java | mit | 2,343 |
/*
* canvg.js - Javascript SVG parser and renderer on Canvas
* MIT Licensed
* Gabe Lerner ([email protected])
* http://code.google.com/p/canvg/
*
* Requires: rgbcolor.js - http://www.phpied.com/rgb-color-parser-in-javascript/
*/
(function() {
// canvg(target, s)
// empty parameters: replace all 'svg' elements on page with 'canvas' elements
// target: canvas element or the id of a canvas element
// s: svg string, url to svg file, or xml document
// opts: optional hash of options
// ignoreMouse: true => ignore mouse events
// ignoreAnimation: true => ignore animations
// ignoreDimensions: true => does not try to resize canvas
// ignoreClear: true => does not clear canvas
// offsetX: int => draws at a x offset
// offsetY: int => draws at a y offset
// scaleWidth: int => scales horizontally to width
// scaleHeight: int => scales vertically to height
// renderCallback: function => will call the function after the first render is completed
// forceRedraw: function => will call the function on every frame, if it returns true, will redraw
this.canvg = function(target, s, opts) {
// no parameters
if (target == null && s == null && opts == null) {
var svgTags = document.querySelectorAll('svg');
for (var i = 0; i < svgTags.length; i++) {
var svgTag = svgTags[i];
var c = document.createElement('canvas');
c.width = svgTag.clientWidth;
c.height = svgTag.clientHeight;
svgTag.parentNode.insertBefore(c, svgTag);
svgTag.parentNode.removeChild(svgTag);
var div = document.createElement('div');
div.appendChild(svgTag);
canvg(c, div.innerHTML);
}
return;
}
if (typeof target == 'string') {
target = document.getElementById(target);
}
// store class on canvas
if (target.svg != null) target.svg.stop();
var svg = build(opts || {});
// on i.e. 8 for flash canvas, we can't assign the property so check for it
if (!(target.childNodes.length == 1 && target.childNodes[0].nodeName == 'OBJECT')) target.svg = svg;
var ctx = target.getContext('2d');
if (typeof(s.documentElement) != 'undefined') {
// load from xml doc
svg.loadXmlDoc(ctx, s);
} else if (s.substr(0, 1) == '<') {
// load from xml string
svg.loadXml(ctx, s);
} else {
// load from url
svg.load(ctx, s);
}
}
// see https://developer.mozilla.org/en-US/docs/Web/API/Element.matches
var matchesSelector;
if (typeof(Element.prototype.matches) != 'undefined') {
matchesSelector = function(node, selector) {
return node.matches(selector);
};
} else if (typeof(Element.prototype.webkitMatchesSelector) != 'undefined') {
matchesSelector = function(node, selector) {
return node.webkitMatchesSelector(selector);
};
} else if (typeof(Element.prototype.mozMatchesSelector) != 'undefined') {
matchesSelector = function(node, selector) {
return node.mozMatchesSelector(selector);
};
} else if (typeof(Element.prototype.msMatchesSelector) != 'undefined') {
matchesSelector = function(node, selector) {
return node.msMatchesSelector(selector);
};
} else if (typeof(Element.prototype.oMatchesSelector) != 'undefined') {
matchesSelector = function(node, selector) {
return node.oMatchesSelector(selector);
};
} else {
// requires Sizzle: https://github.com/jquery/sizzle/wiki/Sizzle-Documentation
// or jQuery: http://jquery.com/download/
// or Zepto: http://zeptojs.com/#
// without it, this is a ReferenceError
if (typeof jQuery === 'function' || typeof Zepto === 'function') {
matchesSelector = function(node, selector) {
return $(node).is(selector);
};
}
if (typeof matchesSelector === 'undefined') {
matchesSelector = Sizzle.matchesSelector;
}
}
// slightly modified version of https://github.com/keeganstreet/specificity/blob/master/specificity.js
var attributeRegex = /(\[[^\]]+\])/g;
var idRegex = /(#[^\s\+>~\.\[:]+)/g;
var classRegex = /(\.[^\s\+>~\.\[:]+)/g;
var pseudoElementRegex = /(::[^\s\+>~\.\[:]+|:first-line|:first-letter|:before|:after)/gi;
var pseudoClassWithBracketsRegex = /(:[\w-]+\([^\)]*\))/gi;
var pseudoClassRegex = /(:[^\s\+>~\.\[:]+)/g;
var elementRegex = /([^\s\+>~\.\[:]+)/g;
function getSelectorSpecificity(selector) {
var typeCount = [0, 0, 0];
var findMatch = function(regex, type) {
var matches = selector.match(regex);
if (matches == null) {
return;
}
typeCount[type] += matches.length;
selector = selector.replace(regex, ' ');
};
selector = selector.replace(/:not\(([^\)]*)\)/g, ' $1 ');
selector = selector.replace(/{[^]*/gm, ' ');
findMatch(attributeRegex, 1);
findMatch(idRegex, 0);
findMatch(classRegex, 1);
findMatch(pseudoElementRegex, 2);
findMatch(pseudoClassWithBracketsRegex, 1);
findMatch(pseudoClassRegex, 1);
selector = selector.replace(/[\*\s\+>~]/g, ' ');
selector = selector.replace(/[#\.]/g, ' ');
findMatch(elementRegex, 2);
return typeCount.join('');
}
function build(opts) {
var svg = {
opts: opts
};
svg.FRAMERATE = 30;
svg.MAX_VIRTUAL_PIXELS = 30000;
svg.log = function(msg) {};
if (svg.opts['log'] == true && typeof(console) != 'undefined') {
svg.log = function(msg) {
console.log(msg);
};
};
// globals
svg.init = function(ctx) {
var uniqueId = 0;
svg.UniqueId = function() {
uniqueId++;
return 'canvg' + uniqueId;
};
svg.Definitions = {};
svg.Styles = {};
svg.StylesSpecificity = {};
svg.Animations = [];
svg.Images = [];
svg.ctx = ctx;
svg.ViewPort = new(function() {
this.viewPorts = [];
this.Clear = function() {
this.viewPorts = [];
}
this.SetCurrent = function(width, height) {
this.viewPorts.push({
width: width,
height: height
});
}
this.RemoveCurrent = function() {
this.viewPorts.pop();
}
this.Current = function() {
return this.viewPorts[this.viewPorts.length - 1];
}
this.width = function() {
return this.Current().width;
}
this.height = function() {
return this.Current().height;
}
this.ComputeSize = function(d) {
if (d != null && typeof(d) == 'number') return d;
if (d == 'x') return this.width();
if (d == 'y') return this.height();
return Math.sqrt(Math.pow(this.width(), 2) + Math.pow(this.height(), 2)) / Math.sqrt(2);
}
});
}
svg.init();
// images loaded
svg.ImagesLoaded = function() {
for (var i = 0; i < svg.Images.length; i++) {
if (!svg.Images[i].loaded) return false;
}
return true;
}
// trim
svg.trim = function(s) {
return s.replace(/^\s+|\s+$/g, '');
}
// compress spaces
svg.compressSpaces = function(s) {
return s.replace(/[\s\r\t\n]+/gm, ' ');
}
// ajax
svg.ajax = function(url) {
var AJAX;
if (window.XMLHttpRequest) {
AJAX = new XMLHttpRequest();
} else {
AJAX = new ActiveXObject('Microsoft.XMLHTTP');
}
if (AJAX) {
AJAX.open('GET', url, false);
AJAX.send(null);
return AJAX.responseText;
}
return null;
}
// parse xml
svg.parseXml = function(xml) {
if (typeof(Windows) != 'undefined' && typeof(Windows.Data) != 'undefined' && typeof(Windows.Data.Xml) != 'undefined') {
var xmlDoc = new Windows.Data.Xml.Dom.XmlDocument();
var settings = new Windows.Data.Xml.Dom.XmlLoadSettings();
settings.prohibitDtd = false;
xmlDoc.loadXml(xml, settings);
return xmlDoc;
} else if (window.DOMParser) {
var parser = new DOMParser();
return parser.parseFromString(xml, 'text/xml');
} else {
xml = xml.replace(/<!DOCTYPE svg[^>]*>/, '');
var xmlDoc = new ActiveXObject('Microsoft.XMLDOM');
xmlDoc.async = 'false';
xmlDoc.loadXML(xml);
return xmlDoc;
}
}
svg.Property = function(name, value) {
this.name = name;
this.value = value;
}
svg.Property.prototype.getValue = function() {
return this.value;
}
svg.Property.prototype.hasValue = function() {
return (this.value != null && this.value !== '');
}
// return the numerical value of the property
svg.Property.prototype.numValue = function() {
if (!this.hasValue()) return 0;
var n = parseFloat(this.value);
if ((this.value + '').match(/%$/)) {
n = n / 100.0;
}
return n;
}
svg.Property.prototype.valueOrDefault = function(def) {
if (this.hasValue()) return this.value;
return def;
}
svg.Property.prototype.numValueOrDefault = function(def) {
if (this.hasValue()) return this.numValue();
return def;
}
// color extensions
// augment the current color value with the opacity
svg.Property.prototype.addOpacity = function(opacityProp) {
var newValue = this.value;
if (opacityProp.value != null && opacityProp.value != '' && typeof(this.value) == 'string') { // can only add opacity to colors, not patterns
var color = new RGBColor(this.value);
if (color.ok) {
newValue = 'rgba(' + color.r + ', ' + color.g + ', ' + color.b + ', ' + opacityProp.numValue() + ')';
}
}
return new svg.Property(this.name, newValue);
}
// definition extensions
// get the definition from the definitions table
svg.Property.prototype.getDefinition = function() {
var name = this.value.match(/#([^\)'"]+)/);
if (name) {
name = name[1];
}
if (!name) {
name = this.value;
}
return svg.Definitions[name];
}
svg.Property.prototype.isUrlDefinition = function() {
return this.value.indexOf('url(') == 0
}
svg.Property.prototype.getFillStyleDefinition = function(e, opacityProp) {
var def = this.getDefinition();
// gradient
if (def != null && def.createGradient) {
return def.createGradient(svg.ctx, e, opacityProp);
}
// pattern
if (def != null && def.createPattern) {
if (def.getHrefAttribute().hasValue()) {
var pt = def.attribute('patternTransform');
def = def.getHrefAttribute().getDefinition();
if (pt.hasValue()) {
def.attribute('patternTransform', true).value = pt.value;
}
}
return def.createPattern(svg.ctx, e);
}
return null;
}
// length extensions
svg.Property.prototype.getDPI = function(viewPort) {
return 96.0; // TODO: compute?
}
svg.Property.prototype.getEM = function(viewPort) {
var em = 12;
var fontSize = new svg.Property('fontSize', svg.Font.Parse(svg.ctx.font).fontSize);
if (fontSize.hasValue()) em = fontSize.toPixels(viewPort);
return em;
}
svg.Property.prototype.getUnits = function() {
var s = this.value + '';
return s.replace(/[0-9\.\-]/g, '');
}
// get the length as pixels
svg.Property.prototype.toPixels = function(viewPort, processPercent) {
if (!this.hasValue()) return 0;
var s = this.value + '';
if (s.match(/em$/)) return this.numValue() * this.getEM(viewPort);
if (s.match(/ex$/)) return this.numValue() * this.getEM(viewPort) / 2.0;
if (s.match(/px$/)) return this.numValue();
if (s.match(/pt$/)) return this.numValue() * this.getDPI(viewPort) * (1.0 / 72.0);
if (s.match(/pc$/)) return this.numValue() * 15;
if (s.match(/cm$/)) return this.numValue() * this.getDPI(viewPort) / 2.54;
if (s.match(/mm$/)) return this.numValue() * this.getDPI(viewPort) / 25.4;
if (s.match(/in$/)) return this.numValue() * this.getDPI(viewPort);
if (s.match(/%$/)) return this.numValue() * svg.ViewPort.ComputeSize(viewPort);
var n = this.numValue();
if (processPercent && n < 1.0) return n * svg.ViewPort.ComputeSize(viewPort);
return n;
}
// time extensions
// get the time as milliseconds
svg.Property.prototype.toMilliseconds = function() {
if (!this.hasValue()) return 0;
var s = this.value + '';
if (s.match(/s$/)) return this.numValue() * 1000;
if (s.match(/ms$/)) return this.numValue();
return this.numValue();
}
// angle extensions
// get the angle as radians
svg.Property.prototype.toRadians = function() {
if (!this.hasValue()) return 0;
var s = this.value + '';
if (s.match(/deg$/)) return this.numValue() * (Math.PI / 180.0);
if (s.match(/grad$/)) return this.numValue() * (Math.PI / 200.0);
if (s.match(/rad$/)) return this.numValue();
return this.numValue() * (Math.PI / 180.0);
}
// text extensions
// get the text baseline
var textBaselineMapping = {
'baseline': 'alphabetic',
'before-edge': 'top',
'text-before-edge': 'top',
'middle': 'middle',
'central': 'middle',
'after-edge': 'bottom',
'text-after-edge': 'bottom',
'ideographic': 'ideographic',
'alphabetic': 'alphabetic',
'hanging': 'hanging',
'mathematical': 'alphabetic'
};
svg.Property.prototype.toTextBaseline = function() {
if (!this.hasValue()) return null;
return textBaselineMapping[this.value];
}
// fonts
svg.Font = new(function() {
this.Styles = 'normal|italic|oblique|inherit';
this.Variants = 'normal|small-caps|inherit';
this.Weights = 'normal|bold|bolder|lighter|100|200|300|400|500|600|700|800|900|inherit';
this.CreateFont = function(fontStyle, fontVariant, fontWeight, fontSize, fontFamily, inherit) {
var f = inherit != null ? this.Parse(inherit) : this.CreateFont('', '', '', '', '', svg.ctx.font);
return {
fontFamily: fontFamily || f.fontFamily,
fontSize: fontSize || f.fontSize,
fontStyle: fontStyle || f.fontStyle,
fontWeight: fontWeight || f.fontWeight,
fontVariant: fontVariant || f.fontVariant,
toString: function() {
return [this.fontStyle, this.fontVariant, this.fontWeight, this.fontSize, this.fontFamily].join(' ')
}
}
}
var that = this;
this.Parse = function(s) {
var f = {};
var d = svg.trim(svg.compressSpaces(s || '')).split(' ');
var set = {
fontSize: false,
fontStyle: false,
fontWeight: false,
fontVariant: false
}
var ff = '';
for (var i = 0; i < d.length; i++) {
if (!set.fontStyle && that.Styles.indexOf(d[i]) != -1) {
if (d[i] != 'inherit') f.fontStyle = d[i];
set.fontStyle = true;
} else if (!set.fontVariant && that.Variants.indexOf(d[i]) != -1) {
if (d[i] != 'inherit') f.fontVariant = d[i];
set.fontStyle = set.fontVariant = true;
} else if (!set.fontWeight && that.Weights.indexOf(d[i]) != -1) {
if (d[i] != 'inherit') f.fontWeight = d[i];
set.fontStyle = set.fontVariant = set.fontWeight = true;
} else if (!set.fontSize) {
if (d[i] != 'inherit') f.fontSize = d[i].split('/')[0];
set.fontStyle = set.fontVariant = set.fontWeight = set.fontSize = true;
} else {
if (d[i] != 'inherit') ff += d[i];
}
}
if (ff != '') f.fontFamily = ff;
return f;
}
});
// points and paths
svg.ToNumberArray = function(s) {
var a = svg.trim(svg.compressSpaces((s || '').replace(/,/g, ' '))).split(' ');
for (var i = 0; i < a.length; i++) {
a[i] = parseFloat(a[i]);
}
return a;
}
svg.Point = function(x, y) {
this.x = x;
this.y = y;
}
svg.Point.prototype.angleTo = function(p) {
return Math.atan2(p.y - this.y, p.x - this.x);
}
svg.Point.prototype.applyTransform = function(v) {
var xp = this.x * v[0] + this.y * v[2] + v[4];
var yp = this.x * v[1] + this.y * v[3] + v[5];
this.x = xp;
this.y = yp;
}
svg.CreatePoint = function(s) {
var a = svg.ToNumberArray(s);
return new svg.Point(a[0], a[1]);
}
svg.CreatePath = function(s) {
var a = svg.ToNumberArray(s);
var path = [];
for (var i = 0; i < a.length; i += 2) {
path.push(new svg.Point(a[i], a[i + 1]));
}
return path;
}
// bounding box
svg.BoundingBox = function(x1, y1, x2, y2) { // pass in initial points if you want
this.x1 = Number.NaN;
this.y1 = Number.NaN;
this.x2 = Number.NaN;
this.y2 = Number.NaN;
this.x = function() {
return this.x1;
}
this.y = function() {
return this.y1;
}
this.width = function() {
return this.x2 - this.x1;
}
this.height = function() {
return this.y2 - this.y1;
}
this.addPoint = function(x, y) {
if (x != null) {
if (isNaN(this.x1) || isNaN(this.x2)) {
this.x1 = x;
this.x2 = x;
}
if (x < this.x1) this.x1 = x;
if (x > this.x2) this.x2 = x;
}
if (y != null) {
if (isNaN(this.y1) || isNaN(this.y2)) {
this.y1 = y;
this.y2 = y;
}
if (y < this.y1) this.y1 = y;
if (y > this.y2) this.y2 = y;
}
}
this.addX = function(x) {
this.addPoint(x, null);
}
this.addY = function(y) {
this.addPoint(null, y);
}
this.addBoundingBox = function(bb) {
this.addPoint(bb.x1, bb.y1);
this.addPoint(bb.x2, bb.y2);
}
this.addQuadraticCurve = function(p0x, p0y, p1x, p1y, p2x, p2y) {
var cp1x = p0x + 2 / 3 * (p1x - p0x); // CP1 = QP0 + 2/3 *(QP1-QP0)
var cp1y = p0y + 2 / 3 * (p1y - p0y); // CP1 = QP0 + 2/3 *(QP1-QP0)
var cp2x = cp1x + 1 / 3 * (p2x - p0x); // CP2 = CP1 + 1/3 *(QP2-QP0)
var cp2y = cp1y + 1 / 3 * (p2y - p0y); // CP2 = CP1 + 1/3 *(QP2-QP0)
this.addBezierCurve(p0x, p0y, cp1x, cp2x, cp1y, cp2y, p2x, p2y);
}
this.addBezierCurve = function(p0x, p0y, p1x, p1y, p2x, p2y, p3x, p3y) {
// from http://blog.hackers-cafe.net/2009/06/how-to-calculate-bezier-curves-bounding.html
var p0 = [p0x, p0y],
p1 = [p1x, p1y],
p2 = [p2x, p2y],
p3 = [p3x, p3y];
this.addPoint(p0[0], p0[1]);
this.addPoint(p3[0], p3[1]);
for (i = 0; i <= 1; i++) {
var f = function(t) {
return Math.pow(1 - t, 3) * p0[i] + 3 * Math.pow(1 - t, 2) * t * p1[i] + 3 * (1 - t) * Math.pow(t, 2) * p2[i] + Math.pow(t, 3) * p3[i];
}
var b = 6 * p0[i] - 12 * p1[i] + 6 * p2[i];
var a = -3 * p0[i] + 9 * p1[i] - 9 * p2[i] + 3 * p3[i];
var c = 3 * p1[i] - 3 * p0[i];
if (a == 0) {
if (b == 0) continue;
var t = -c / b;
if (0 < t && t < 1) {
if (i == 0) this.addX(f(t));
if (i == 1) this.addY(f(t));
}
continue;
}
var b2ac = Math.pow(b, 2) - 4 * c * a;
if (b2ac < 0) continue;
var t1 = (-b + Math.sqrt(b2ac)) / (2 * a);
if (0 < t1 && t1 < 1) {
if (i == 0) this.addX(f(t1));
if (i == 1) this.addY(f(t1));
}
var t2 = (-b - Math.sqrt(b2ac)) / (2 * a);
if (0 < t2 && t2 < 1) {
if (i == 0) this.addX(f(t2));
if (i == 1) this.addY(f(t2));
}
}
}
this.isPointInBox = function(x, y) {
return (this.x1 <= x && x <= this.x2 && this.y1 <= y && y <= this.y2);
}
this.addPoint(x1, y1);
this.addPoint(x2, y2);
}
// transforms
svg.Transform = function(v) {
var that = this;
this.Type = {}
// translate
this.Type.translate = function(s) {
this.p = svg.CreatePoint(s);
this.apply = function(ctx) {
ctx.translate(this.p.x || 0.0, this.p.y || 0.0);
}
this.unapply = function(ctx) {
ctx.translate(-1.0 * this.p.x || 0.0, -1.0 * this.p.y || 0.0);
}
this.applyToPoint = function(p) {
p.applyTransform([1, 0, 0, 1, this.p.x || 0.0, this.p.y || 0.0]);
}
}
// rotate
this.Type.rotate = function(s) {
var a = svg.ToNumberArray(s);
this.angle = new svg.Property('angle', a[0]);
this.cx = a[1] || 0;
this.cy = a[2] || 0;
this.apply = function(ctx) {
ctx.translate(this.cx, this.cy);
ctx.rotate(this.angle.toRadians());
ctx.translate(-this.cx, -this.cy);
}
this.unapply = function(ctx) {
ctx.translate(this.cx, this.cy);
ctx.rotate(-1.0 * this.angle.toRadians());
ctx.translate(-this.cx, -this.cy);
}
this.applyToPoint = function(p) {
var a = this.angle.toRadians();
p.applyTransform([1, 0, 0, 1, this.p.x || 0.0, this.p.y || 0.0]);
p.applyTransform([Math.cos(a), Math.sin(a), -Math.sin(a), Math.cos(a), 0, 0]);
p.applyTransform([1, 0, 0, 1, -this.p.x || 0.0, -this.p.y || 0.0]);
}
}
this.Type.scale = function(s) {
this.p = svg.CreatePoint(s);
this.apply = function(ctx) {
ctx.scale(this.p.x || 1.0, this.p.y || this.p.x || 1.0);
}
this.unapply = function(ctx) {
ctx.scale(1.0 / this.p.x || 1.0, 1.0 / this.p.y || this.p.x || 1.0);
}
this.applyToPoint = function(p) {
p.applyTransform([this.p.x || 0.0, 0, 0, this.p.y || 0.0, 0, 0]);
}
}
this.Type.matrix = function(s) {
this.m = svg.ToNumberArray(s);
this.apply = function(ctx) {
ctx.transform(this.m[0], this.m[1], this.m[2], this.m[3], this.m[4], this.m[5]);
}
this.unapply = function(ctx) {
var a = this.m[0];
var b = this.m[2];
var c = this.m[4];
var d = this.m[1];
var e = this.m[3];
var f = this.m[5];
var g = 0.0;
var h = 0.0;
var i = 1.0;
var det = 1 / (a * (e * i - f * h) - b * (d * i - f * g) + c * (d * h - e * g));
ctx.transform(
det * (e * i - f * h),
det * (f * g - d * i),
det * (c * h - b * i),
det * (a * i - c * g),
det * (b * f - c * e),
det * (c * d - a * f)
);
}
this.applyToPoint = function(p) {
p.applyTransform(this.m);
}
}
this.Type.SkewBase = function(s) {
this.base = that.Type.matrix;
this.base(s);
this.angle = new svg.Property('angle', s);
}
this.Type.SkewBase.prototype = new this.Type.matrix;
this.Type.skewX = function(s) {
this.base = that.Type.SkewBase;
this.base(s);
this.m = [1, 0, Math.tan(this.angle.toRadians()), 1, 0, 0];
}
this.Type.skewX.prototype = new this.Type.SkewBase;
this.Type.skewY = function(s) {
this.base = that.Type.SkewBase;
this.base(s);
this.m = [1, Math.tan(this.angle.toRadians()), 0, 1, 0, 0];
}
this.Type.skewY.prototype = new this.Type.SkewBase;
this.transforms = [];
this.apply = function(ctx) {
for (var i = 0; i < this.transforms.length; i++) {
this.transforms[i].apply(ctx);
}
}
this.unapply = function(ctx) {
for (var i = this.transforms.length - 1; i >= 0; i--) {
this.transforms[i].unapply(ctx);
}
}
this.applyToPoint = function(p) {
for (var i = 0; i < this.transforms.length; i++) {
this.transforms[i].applyToPoint(p);
}
}
var data = svg.trim(svg.compressSpaces(v)).replace(/\)([a-zA-Z])/g, ') $1').replace(/\)(\s?,\s?)/g, ') ').split(/\s(?=[a-z])/);
for (var i = 0; i < data.length; i++) {
var type = svg.trim(data[i].split('(')[0]);
var s = data[i].split('(')[1].replace(')', '');
var transform = new this.Type[type](s);
transform.type = type;
this.transforms.push(transform);
}
}
// aspect ratio
svg.AspectRatio = function(ctx, aspectRatio, width, desiredWidth, height, desiredHeight, minX, minY, refX, refY) {
// aspect ratio - http://www.w3.org/TR/SVG/coords.html#PreserveAspectRatioAttribute
aspectRatio = svg.compressSpaces(aspectRatio);
aspectRatio = aspectRatio.replace(/^defer\s/, ''); // ignore defer
var align = aspectRatio.split(' ')[0] || 'xMidYMid';
var meetOrSlice = aspectRatio.split(' ')[1] || 'meet';
// calculate scale
var scaleX = width / desiredWidth;
var scaleY = height / desiredHeight;
var scaleMin = Math.min(scaleX, scaleY);
var scaleMax = Math.max(scaleX, scaleY);
if (meetOrSlice == 'meet') {
desiredWidth *= scaleMin;
desiredHeight *= scaleMin;
}
if (meetOrSlice == 'slice') {
desiredWidth *= scaleMax;
desiredHeight *= scaleMax;
}
refX = new svg.Property('refX', refX);
refY = new svg.Property('refY', refY);
if (refX.hasValue() && refY.hasValue()) {
ctx.translate(-scaleMin * refX.toPixels('x'), -scaleMin * refY.toPixels('y'));
} else {
// align
if (align.match(/^xMid/) && ((meetOrSlice == 'meet' && scaleMin == scaleY) || (meetOrSlice == 'slice' && scaleMax == scaleY))) ctx.translate(width / 2.0 - desiredWidth / 2.0, 0);
if (align.match(/YMid$/) && ((meetOrSlice == 'meet' && scaleMin == scaleX) || (meetOrSlice == 'slice' && scaleMax == scaleX))) ctx.translate(0, height / 2.0 - desiredHeight / 2.0);
if (align.match(/^xMax/) && ((meetOrSlice == 'meet' && scaleMin == scaleY) || (meetOrSlice == 'slice' && scaleMax == scaleY))) ctx.translate(width - desiredWidth, 0);
if (align.match(/YMax$/) && ((meetOrSlice == 'meet' && scaleMin == scaleX) || (meetOrSlice == 'slice' && scaleMax == scaleX))) ctx.translate(0, height - desiredHeight);
}
// scale
if (align == 'none') ctx.scale(scaleX, scaleY);
else if (meetOrSlice == 'meet') ctx.scale(scaleMin, scaleMin);
else if (meetOrSlice == 'slice') ctx.scale(scaleMax, scaleMax);
// translate
ctx.translate(minX == null ? 0 : -minX, minY == null ? 0 : -minY);
}
// elements
svg.Element = {}
svg.EmptyProperty = new svg.Property('EMPTY', '');
svg.Element.ElementBase = function(node) {
this.attributes = {};
this.styles = {};
this.stylesSpecificity = {};
this.children = [];
// get or create attribute
this.attribute = function(name, createIfNotExists) {
var a = this.attributes[name];
if (a != null) return a;
if (createIfNotExists == true) {
a = new svg.Property(name, '');
this.attributes[name] = a;
}
return a || svg.EmptyProperty;
}
this.getHrefAttribute = function() {
for (var a in this.attributes) {
if (a == 'href' || a.match(/:href$/)) {
return this.attributes[a];
}
}
return svg.EmptyProperty;
}
// get or create style, crawls up node tree
this.style = function(name, createIfNotExists, skipAncestors) {
var s = this.styles[name];
if (s != null) return s;
var a = this.attribute(name);
if (a != null && a.hasValue()) {
this.styles[name] = a; // move up to me to cache
return a;
}
if (skipAncestors != true) {
var p = this.parent;
if (p != null) {
var ps = p.style(name);
if (ps != null && ps.hasValue()) {
return ps;
}
}
}
if (createIfNotExists == true) {
s = new svg.Property(name, '');
this.styles[name] = s;
}
return s || svg.EmptyProperty;
}
// base render
this.render = function(ctx) {
// don't render display=none
if (this.style('display').value == 'none') return;
// don't render visibility=hidden
if (this.style('visibility').value == 'hidden') return;
ctx.save();
if (this.attribute('mask').hasValue()) { // mask
var mask = this.attribute('mask').getDefinition();
if (mask != null) mask.apply(ctx, this);
} else if (this.style('filter').hasValue()) { // filter
var filter = this.style('filter').getDefinition();
if (filter != null) filter.apply(ctx, this);
} else {
this.setContext(ctx);
this.renderChildren(ctx);
this.clearContext(ctx);
}
ctx.restore();
}
// base set context
this.setContext = function(ctx) {
// OVERRIDE ME!
}
// base clear context
this.clearContext = function(ctx) {
// OVERRIDE ME!
}
// base render children
this.renderChildren = function(ctx) {
for (var i = 0; i < this.children.length; i++) {
this.children[i].render(ctx);
}
}
this.addChild = function(childNode, create) {
var child = childNode;
if (create) child = svg.CreateElement(childNode);
child.parent = this;
if (child.type != 'title') {
this.children.push(child);
}
}
this.addStylesFromStyleDefinition = function() {
// add styles
for (var selector in svg.Styles) {
if (selector[0] != '@' && matchesSelector(node, selector)) {
var styles = svg.Styles[selector];
var specificity = svg.StylesSpecificity[selector];
if (styles != null) {
for (var name in styles) {
var existingSpecificity = this.stylesSpecificity[name];
if (typeof(existingSpecificity) == 'undefined') {
existingSpecificity = '000';
}
if (specificity > existingSpecificity) {
this.styles[name] = styles[name];
this.stylesSpecificity[name] = specificity;
}
}
}
}
}
};
if (node != null && node.nodeType == 1) { //ELEMENT_NODE
// add attributes
for (var i = 0; i < node.attributes.length; i++) {
var attribute = node.attributes[i];
this.attributes[attribute.nodeName] = new svg.Property(attribute.nodeName, attribute.value);
}
this.addStylesFromStyleDefinition();
// add inline styles
if (this.attribute('style').hasValue()) {
var styles = this.attribute('style').value.split(';');
for (var i = 0; i < styles.length; i++) {
if (svg.trim(styles[i]) != '') {
var style = styles[i].split(':');
var name = svg.trim(style[0]);
var value = svg.trim(style[1]);
this.styles[name] = new svg.Property(name, value);
}
}
}
// add id
if (this.attribute('id').hasValue()) {
if (svg.Definitions[this.attribute('id').value] == null) {
svg.Definitions[this.attribute('id').value] = this;
}
}
// add children
for (var i = 0; i < node.childNodes.length; i++) {
var childNode = node.childNodes[i];
if (childNode.nodeType == 1) this.addChild(childNode, true); //ELEMENT_NODE
if (this.captureTextNodes && (childNode.nodeType == 3 || childNode.nodeType == 4)) {
var text = childNode.value || childNode.text || childNode.textContent || '';
if (svg.compressSpaces(text) != '') {
this.addChild(new svg.Element.tspan(childNode), false); // TEXT_NODE
}
}
}
}
}
svg.Element.RenderedElementBase = function(node) {
this.base = svg.Element.ElementBase;
this.base(node);
this.setContext = function(ctx) {
// fill
if (this.style('fill').isUrlDefinition()) {
var fs = this.style('fill').getFillStyleDefinition(this, this.style('fill-opacity'));
if (fs != null) ctx.fillStyle = fs;
} else if (this.style('fill').hasValue()) {
var fillStyle = this.style('fill');
if (fillStyle.value == 'currentColor') fillStyle.value = this.style('color').value;
if (fillStyle.value != 'inherit') ctx.fillStyle = (fillStyle.value == 'none' ? 'rgba(0,0,0,0)' : fillStyle.value);
}
if (this.style('fill-opacity').hasValue()) {
var fillStyle = new svg.Property('fill', ctx.fillStyle);
fillStyle = fillStyle.addOpacity(this.style('fill-opacity'));
ctx.fillStyle = fillStyle.value;
}
// stroke
if (this.style('stroke').isUrlDefinition()) {
var fs = this.style('stroke').getFillStyleDefinition(this, this.style('stroke-opacity'));
if (fs != null) ctx.strokeStyle = fs;
} else if (this.style('stroke').hasValue()) {
var strokeStyle = this.style('stroke');
if (strokeStyle.value == 'currentColor') strokeStyle.value = this.style('color').value;
if (strokeStyle.value != 'inherit') ctx.strokeStyle = (strokeStyle.value == 'none' ? 'rgba(0,0,0,0)' : strokeStyle.value);
}
if (this.style('stroke-opacity').hasValue()) {
var strokeStyle = new svg.Property('stroke', ctx.strokeStyle);
strokeStyle = strokeStyle.addOpacity(this.style('stroke-opacity'));
ctx.strokeStyle = strokeStyle.value;
}
if (this.style('stroke-width').hasValue()) {
var newLineWidth = this.style('stroke-width').toPixels();
ctx.lineWidth = newLineWidth == 0 ? 0.001 : newLineWidth; // browsers don't respect 0
}
if (this.style('stroke-linecap').hasValue()) ctx.lineCap = this.style('stroke-linecap').value;
if (this.style('stroke-linejoin').hasValue()) ctx.lineJoin = this.style('stroke-linejoin').value;
if (this.style('stroke-miterlimit').hasValue()) ctx.miterLimit = this.style('stroke-miterlimit').value;
if (this.style('stroke-dasharray').hasValue() && this.style('stroke-dasharray').value != 'none') {
var gaps = svg.ToNumberArray(this.style('stroke-dasharray').value);
if (typeof(ctx.setLineDash) != 'undefined') {
ctx.setLineDash(gaps);
} else if (typeof(ctx.webkitLineDash) != 'undefined') {
ctx.webkitLineDash = gaps;
} else if (typeof(ctx.mozDash) != 'undefined' && !(gaps.length == 1 && gaps[0] == 0)) {
ctx.mozDash = gaps;
}
var offset = this.style('stroke-dashoffset').numValueOrDefault(1);
if (typeof(ctx.lineDashOffset) != 'undefined') {
ctx.lineDashOffset = offset;
} else if (typeof(ctx.webkitLineDashOffset) != 'undefined') {
ctx.webkitLineDashOffset = offset;
} else if (typeof(ctx.mozDashOffset) != 'undefined') {
ctx.mozDashOffset = offset;
}
}
// font
if (typeof(ctx.font) != 'undefined') {
ctx.font = svg.Font.CreateFont(
this.style('font-style').value,
this.style('font-variant').value,
this.style('font-weight').value,
this.style('font-size').hasValue() ? this.style('font-size').toPixels() + 'px' : '',
this.style('font-family').value).toString();
}
// transform
if (this.style('transform', false, true).hasValue()) {
var transform = new svg.Transform(this.style('transform', false, true).value);
transform.apply(ctx);
}
// clip
if (this.attribute('clip-path', false, true).hasValue()) {
var clip = this.attribute('clip-path', false, true).getDefinition();
if (clip != null) clip.apply(ctx);
}
// opacity
if (this.style('opacity').hasValue()) {
ctx.globalAlpha = this.style('opacity').numValue();
}
}
}
svg.Element.RenderedElementBase.prototype = new svg.Element.ElementBase;
svg.Element.PathElementBase = function(node) {
this.base = svg.Element.RenderedElementBase;
this.base(node);
this.path = function(ctx) {
if (ctx != null) ctx.beginPath();
return new svg.BoundingBox();
}
this.renderChildren = function(ctx) {
this.path(ctx);
svg.Mouse.checkPath(this, ctx);
if (ctx.fillStyle != '') {
if (this.style('fill-rule').valueOrDefault('inherit') != 'inherit') {
ctx.fill(this.style('fill-rule').value);
} else {
ctx.fill();
}
}
if (ctx.strokeStyle != '') ctx.stroke();
var markers = this.getMarkers();
if (markers != null) {
if (this.style('marker-start').isUrlDefinition()) {
var marker = this.style('marker-start').getDefinition();
marker.render(ctx, markers[0][0], markers[0][1]);
}
if (this.style('marker-mid').isUrlDefinition()) {
var marker = this.style('marker-mid').getDefinition();
for (var i = 1; i < markers.length - 1; i++) {
marker.render(ctx, markers[i][0], markers[i][1]);
}
}
if (this.style('marker-end').isUrlDefinition()) {
var marker = this.style('marker-end').getDefinition();
marker.render(ctx, markers[markers.length - 1][0], markers[markers.length - 1][1]);
}
}
}
this.getBoundingBox = function() {
return this.path();
}
this.getMarkers = function() {
return null;
}
}
svg.Element.PathElementBase.prototype = new svg.Element.RenderedElementBase;
// svg element
svg.Element.svg = function(node) {
this.base = svg.Element.RenderedElementBase;
this.base(node);
this.baseClearContext = this.clearContext;
this.clearContext = function(ctx) {
this.baseClearContext(ctx);
svg.ViewPort.RemoveCurrent();
}
this.baseSetContext = this.setContext;
this.setContext = function(ctx) {
// initial values and defaults
ctx.strokeStyle = 'rgba(0,0,0,0)';
ctx.lineCap = 'butt';
ctx.lineJoin = 'miter';
ctx.miterLimit = 4;
if (typeof(ctx.font) != 'undefined' && typeof(window.getComputedStyle) != 'undefined') {
ctx.font = window.getComputedStyle(ctx.canvas).getPropertyValue('font');
}
this.baseSetContext(ctx);
// create new view port
if (!this.attribute('x').hasValue()) this.attribute('x', true).value = 0;
if (!this.attribute('y').hasValue()) this.attribute('y', true).value = 0;
ctx.translate(this.attribute('x').toPixels('x'), this.attribute('y').toPixels('y'));
var width = svg.ViewPort.width();
var height = svg.ViewPort.height();
if (!this.attribute('width').hasValue()) this.attribute('width', true).value = '100%';
if (!this.attribute('height').hasValue()) this.attribute('height', true).value = '100%';
if (typeof(this.root) == 'undefined') {
width = this.attribute('width').toPixels('x');
height = this.attribute('height').toPixels('y');
var x = 0;
var y = 0;
if (this.attribute('refX').hasValue() && this.attribute('refY').hasValue()) {
x = -this.attribute('refX').toPixels('x');
y = -this.attribute('refY').toPixels('y');
}
if (this.attribute('overflow').valueOrDefault('hidden') != 'visible') {
ctx.beginPath();
ctx.moveTo(x, y);
ctx.lineTo(width, y);
ctx.lineTo(width, height);
ctx.lineTo(x, height);
ctx.closePath();
ctx.clip();
}
}
svg.ViewPort.SetCurrent(width, height);
// viewbox
if (this.attribute('viewBox').hasValue()) {
var viewBox = svg.ToNumberArray(this.attribute('viewBox').value);
var minX = viewBox[0];
var minY = viewBox[1];
width = viewBox[2];
height = viewBox[3];
svg.AspectRatio(ctx,
this.attribute('preserveAspectRatio').value,
svg.ViewPort.width(),
width,
svg.ViewPort.height(),
height,
minX,
minY,
this.attribute('refX').value,
this.attribute('refY').value);
svg.ViewPort.RemoveCurrent();
svg.ViewPort.SetCurrent(viewBox[2], viewBox[3]);
}
}
}
svg.Element.svg.prototype = new svg.Element.RenderedElementBase;
// rect element
svg.Element.rect = function(node) {
this.base = svg.Element.PathElementBase;
this.base(node);
this.path = function(ctx) {
var x = this.attribute('x').toPixels('x');
var y = this.attribute('y').toPixels('y');
var width = this.attribute('width').toPixels('x');
var height = this.attribute('height').toPixels('y');
var rx = this.attribute('rx').toPixels('x');
var ry = this.attribute('ry').toPixels('y');
if (this.attribute('rx').hasValue() && !this.attribute('ry').hasValue()) ry = rx;
if (this.attribute('ry').hasValue() && !this.attribute('rx').hasValue()) rx = ry;
rx = Math.min(rx, width / 2.0);
ry = Math.min(ry, height / 2.0);
if (ctx != null) {
ctx.beginPath();
ctx.moveTo(x + rx, y);
ctx.lineTo(x + width - rx, y);
ctx.quadraticCurveTo(x + width, y, x + width, y + ry)
ctx.lineTo(x + width, y + height - ry);
ctx.quadraticCurveTo(x + width, y + height, x + width - rx, y + height)
ctx.lineTo(x + rx, y + height);
ctx.quadraticCurveTo(x, y + height, x, y + height - ry)
ctx.lineTo(x, y + ry);
ctx.quadraticCurveTo(x, y, x + rx, y)
ctx.closePath();
}
return new svg.BoundingBox(x, y, x + width, y + height);
}
}
svg.Element.rect.prototype = new svg.Element.PathElementBase;
// circle element
svg.Element.circle = function(node) {
this.base = svg.Element.PathElementBase;
this.base(node);
this.path = function(ctx) {
var cx = this.attribute('cx').toPixels('x');
var cy = this.attribute('cy').toPixels('y');
var r = this.attribute('r').toPixels();
if (ctx != null) {
ctx.beginPath();
ctx.arc(cx, cy, r, 0, Math.PI * 2, true);
ctx.closePath();
}
return new svg.BoundingBox(cx - r, cy - r, cx + r, cy + r);
}
}
svg.Element.circle.prototype = new svg.Element.PathElementBase;
// ellipse element
svg.Element.ellipse = function(node) {
this.base = svg.Element.PathElementBase;
this.base(node);
this.path = function(ctx) {
var KAPPA = 4 * ((Math.sqrt(2) - 1) / 3);
var rx = this.attribute('rx').toPixels('x');
var ry = this.attribute('ry').toPixels('y');
var cx = this.attribute('cx').toPixels('x');
var cy = this.attribute('cy').toPixels('y');
if (ctx != null) {
ctx.beginPath();
ctx.moveTo(cx, cy - ry);
ctx.bezierCurveTo(cx + (KAPPA * rx), cy - ry, cx + rx, cy - (KAPPA * ry), cx + rx, cy);
ctx.bezierCurveTo(cx + rx, cy + (KAPPA * ry), cx + (KAPPA * rx), cy + ry, cx, cy + ry);
ctx.bezierCurveTo(cx - (KAPPA * rx), cy + ry, cx - rx, cy + (KAPPA * ry), cx - rx, cy);
ctx.bezierCurveTo(cx - rx, cy - (KAPPA * ry), cx - (KAPPA * rx), cy - ry, cx, cy - ry);
ctx.closePath();
}
return new svg.BoundingBox(cx - rx, cy - ry, cx + rx, cy + ry);
}
}
svg.Element.ellipse.prototype = new svg.Element.PathElementBase;
// line element
svg.Element.line = function(node) {
this.base = svg.Element.PathElementBase;
this.base(node);
this.getPoints = function() {
return [
new svg.Point(this.attribute('x1').toPixels('x'), this.attribute('y1').toPixels('y')),
new svg.Point(this.attribute('x2').toPixels('x'), this.attribute('y2').toPixels('y'))
];
}
this.path = function(ctx) {
var points = this.getPoints();
if (ctx != null) {
ctx.beginPath();
ctx.moveTo(points[0].x, points[0].y);
ctx.lineTo(points[1].x, points[1].y);
}
return new svg.BoundingBox(points[0].x, points[0].y, points[1].x, points[1].y);
}
this.getMarkers = function() {
var points = this.getPoints();
var a = points[0].angleTo(points[1]);
return [
[points[0], a],
[points[1], a]
];
}
}
svg.Element.line.prototype = new svg.Element.PathElementBase;
// polyline element
svg.Element.polyline = function(node) {
this.base = svg.Element.PathElementBase;
this.base(node);
this.points = svg.CreatePath(this.attribute('points').value);
this.path = function(ctx) {
var bb = new svg.BoundingBox(this.points[0].x, this.points[0].y);
if (ctx != null) {
ctx.beginPath();
ctx.moveTo(this.points[0].x, this.points[0].y);
}
for (var i = 1; i < this.points.length; i++) {
bb.addPoint(this.points[i].x, this.points[i].y);
if (ctx != null) ctx.lineTo(this.points[i].x, this.points[i].y);
}
return bb;
}
this.getMarkers = function() {
var markers = [];
for (var i = 0; i < this.points.length - 1; i++) {
markers.push([this.points[i], this.points[i].angleTo(this.points[i + 1])]);
}
markers.push([this.points[this.points.length - 1], markers[markers.length - 1][1]]);
return markers;
}
}
svg.Element.polyline.prototype = new svg.Element.PathElementBase;
// polygon element
svg.Element.polygon = function(node) {
this.base = svg.Element.polyline;
this.base(node);
this.basePath = this.path;
this.path = function(ctx) {
var bb = this.basePath(ctx);
if (ctx != null) {
ctx.lineTo(this.points[0].x, this.points[0].y);
ctx.closePath();
}
return bb;
}
}
svg.Element.polygon.prototype = new svg.Element.polyline;
// path element
svg.Element.path = function(node) {
this.base = svg.Element.PathElementBase;
this.base(node);
var d = this.attribute('d').value;
// TODO: convert to real lexer based on http://www.w3.org/TR/SVG11/paths.html#PathDataBNF
d = d.replace(/,/gm, ' '); // get rid of all commas
// As the end of a match can also be the start of the next match, we need to run this replace twice.
for (var i = 0; i < 2; i++)
d = d.replace(/([MmZzLlHhVvCcSsQqTtAa])([^\s])/gm, '$1 $2'); // suffix commands with spaces
d = d.replace(/([^\s])([MmZzLlHhVvCcSsQqTtAa])/gm, '$1 $2'); // prefix commands with spaces
d = d.replace(/([0-9])([+\-])/gm, '$1 $2'); // separate digits on +- signs
// Again, we need to run this twice to find all occurances
for (var i = 0; i < 2; i++)
d = d.replace(/(\.[0-9]*)(\.)/gm, '$1 $2'); // separate digits when they start with a comma
d = d.replace(/([Aa](\s+[0-9]+){3})\s+([01])\s*([01])/gm, '$1 $3 $4 '); // shorthand elliptical arc path syntax
d = svg.compressSpaces(d); // compress multiple spaces
d = svg.trim(d);
this.PathParser = new(function(d) {
this.tokens = d.split(' ');
this.reset = function() {
this.i = -1;
this.command = '';
this.previousCommand = '';
this.start = new svg.Point(0, 0);
this.control = new svg.Point(0, 0);
this.current = new svg.Point(0, 0);
this.points = [];
this.angles = [];
}
this.isEnd = function() {
return this.i >= this.tokens.length - 1;
}
this.isCommandOrEnd = function() {
if (this.isEnd()) return true;
return this.tokens[this.i + 1].match(/^[A-Za-z]$/) != null;
}
this.isRelativeCommand = function() {
switch (this.command) {
case 'm':
case 'l':
case 'h':
case 'v':
case 'c':
case 's':
case 'q':
case 't':
case 'a':
case 'z':
return true;
break;
}
return false;
}
this.getToken = function() {
this.i++;
return this.tokens[this.i];
}
this.getScalar = function() {
return parseFloat(this.getToken());
}
this.nextCommand = function() {
this.previousCommand = this.command;
this.command = this.getToken();
}
this.getPoint = function() {
var p = new svg.Point(this.getScalar(), this.getScalar());
return this.makeAbsolute(p);
}
this.getAsControlPoint = function() {
var p = this.getPoint();
this.control = p;
return p;
}
this.getAsCurrentPoint = function() {
var p = this.getPoint();
this.current = p;
return p;
}
this.getReflectedControlPoint = function() {
if (this.previousCommand.toLowerCase() != 'c' &&
this.previousCommand.toLowerCase() != 's' &&
this.previousCommand.toLowerCase() != 'q' &&
this.previousCommand.toLowerCase() != 't') {
return this.current;
}
// reflect point
var p = new svg.Point(2 * this.current.x - this.control.x, 2 * this.current.y - this.control.y);
return p;
}
this.makeAbsolute = function(p) {
if (this.isRelativeCommand()) {
p.x += this.current.x;
p.y += this.current.y;
}
return p;
}
this.addMarker = function(p, from, priorTo) {
// if the last angle isn't filled in because we didn't have this point yet ...
if (priorTo != null && this.angles.length > 0 && this.angles[this.angles.length - 1] == null) {
this.angles[this.angles.length - 1] = this.points[this.points.length - 1].angleTo(priorTo);
}
this.addMarkerAngle(p, from == null ? null : from.angleTo(p));
}
this.addMarkerAngle = function(p, a) {
this.points.push(p);
this.angles.push(a);
}
this.getMarkerPoints = function() {
return this.points;
}
this.getMarkerAngles = function() {
for (var i = 0; i < this.angles.length; i++) {
if (this.angles[i] == null) {
for (var j = i + 1; j < this.angles.length; j++) {
if (this.angles[j] != null) {
this.angles[i] = this.angles[j];
break;
}
}
}
}
return this.angles;
}
})(d);
this.path = function(ctx) {
var pp = this.PathParser;
pp.reset();
var bb = new svg.BoundingBox();
if (ctx != null) ctx.beginPath();
while (!pp.isEnd()) {
pp.nextCommand();
switch (pp.command) {
case 'M':
case 'm':
var p = pp.getAsCurrentPoint();
pp.addMarker(p);
bb.addPoint(p.x, p.y);
if (ctx != null) ctx.moveTo(p.x, p.y);
pp.start = pp.current;
while (!pp.isCommandOrEnd()) {
var p = pp.getAsCurrentPoint();
pp.addMarker(p, pp.start);
bb.addPoint(p.x, p.y);
if (ctx != null) ctx.lineTo(p.x, p.y);
}
break;
case 'L':
case 'l':
while (!pp.isCommandOrEnd()) {
var c = pp.current;
var p = pp.getAsCurrentPoint();
pp.addMarker(p, c);
bb.addPoint(p.x, p.y);
if (ctx != null) ctx.lineTo(p.x, p.y);
}
break;
case 'H':
case 'h':
while (!pp.isCommandOrEnd()) {
var newP = new svg.Point((pp.isRelativeCommand() ? pp.current.x : 0) + pp.getScalar(), pp.current.y);
pp.addMarker(newP, pp.current);
pp.current = newP;
bb.addPoint(pp.current.x, pp.current.y);
if (ctx != null) ctx.lineTo(pp.current.x, pp.current.y);
}
break;
case 'V':
case 'v':
while (!pp.isCommandOrEnd()) {
var newP = new svg.Point(pp.current.x, (pp.isRelativeCommand() ? pp.current.y : 0) + pp.getScalar());
pp.addMarker(newP, pp.current);
pp.current = newP;
bb.addPoint(pp.current.x, pp.current.y);
if (ctx != null) ctx.lineTo(pp.current.x, pp.current.y);
}
break;
case 'C':
case 'c':
while (!pp.isCommandOrEnd()) {
var curr = pp.current;
var p1 = pp.getPoint();
var cntrl = pp.getAsControlPoint();
var cp = pp.getAsCurrentPoint();
pp.addMarker(cp, cntrl, p1);
bb.addBezierCurve(curr.x, curr.y, p1.x, p1.y, cntrl.x, cntrl.y, cp.x, cp.y);
if (ctx != null) ctx.bezierCurveTo(p1.x, p1.y, cntrl.x, cntrl.y, cp.x, cp.y);
}
break;
case 'S':
case 's':
while (!pp.isCommandOrEnd()) {
var curr = pp.current;
var p1 = pp.getReflectedControlPoint();
var cntrl = pp.getAsControlPoint();
var cp = pp.getAsCurrentPoint();
pp.addMarker(cp, cntrl, p1);
bb.addBezierCurve(curr.x, curr.y, p1.x, p1.y, cntrl.x, cntrl.y, cp.x, cp.y);
if (ctx != null) ctx.bezierCurveTo(p1.x, p1.y, cntrl.x, cntrl.y, cp.x, cp.y);
}
break;
case 'Q':
case 'q':
while (!pp.isCommandOrEnd()) {
var curr = pp.current;
var cntrl = pp.getAsControlPoint();
var cp = pp.getAsCurrentPoint();
pp.addMarker(cp, cntrl, cntrl);
bb.addQuadraticCurve(curr.x, curr.y, cntrl.x, cntrl.y, cp.x, cp.y);
if (ctx != null) ctx.quadraticCurveTo(cntrl.x, cntrl.y, cp.x, cp.y);
}
break;
case 'T':
case 't':
while (!pp.isCommandOrEnd()) {
var curr = pp.current;
var cntrl = pp.getReflectedControlPoint();
pp.control = cntrl;
var cp = pp.getAsCurrentPoint();
pp.addMarker(cp, cntrl, cntrl);
bb.addQuadraticCurve(curr.x, curr.y, cntrl.x, cntrl.y, cp.x, cp.y);
if (ctx != null) ctx.quadraticCurveTo(cntrl.x, cntrl.y, cp.x, cp.y);
}
break;
case 'A':
case 'a':
while (!pp.isCommandOrEnd()) {
var curr = pp.current;
var rx = pp.getScalar();
var ry = pp.getScalar();
var xAxisRotation = pp.getScalar() * (Math.PI / 180.0);
var largeArcFlag = pp.getScalar();
var sweepFlag = pp.getScalar();
var cp = pp.getAsCurrentPoint();
// Conversion from endpoint to center parameterization
// http://www.w3.org/TR/SVG11/implnote.html#ArcImplementationNotes
// x1', y1'
var currp = new svg.Point(
Math.cos(xAxisRotation) * (curr.x - cp.x) / 2.0 + Math.sin(xAxisRotation) * (curr.y - cp.y) / 2.0, -Math.sin(xAxisRotation) * (curr.x - cp.x) / 2.0 + Math.cos(xAxisRotation) * (curr.y - cp.y) / 2.0
);
// adjust radii
var l = Math.pow(currp.x, 2) / Math.pow(rx, 2) + Math.pow(currp.y, 2) / Math.pow(ry, 2);
if (l > 1) {
rx *= Math.sqrt(l);
ry *= Math.sqrt(l);
}
// cx', cy'
var s = (largeArcFlag == sweepFlag ? -1 : 1) * Math.sqrt(
((Math.pow(rx, 2) * Math.pow(ry, 2)) - (Math.pow(rx, 2) * Math.pow(currp.y, 2)) - (Math.pow(ry, 2) * Math.pow(currp.x, 2))) /
(Math.pow(rx, 2) * Math.pow(currp.y, 2) + Math.pow(ry, 2) * Math.pow(currp.x, 2))
);
if (isNaN(s)) s = 0;
var cpp = new svg.Point(s * rx * currp.y / ry, s * -ry * currp.x / rx);
// cx, cy
var centp = new svg.Point(
(curr.x + cp.x) / 2.0 + Math.cos(xAxisRotation) * cpp.x - Math.sin(xAxisRotation) * cpp.y, (curr.y + cp.y) / 2.0 + Math.sin(xAxisRotation) * cpp.x + Math.cos(xAxisRotation) * cpp.y
);
// vector magnitude
var m = function(v) {
return Math.sqrt(Math.pow(v[0], 2) + Math.pow(v[1], 2));
}
// ratio between two vectors
var r = function(u, v) {
return (u[0] * v[0] + u[1] * v[1]) / (m(u) * m(v))
}
// angle between two vectors
var a = function(u, v) {
return (u[0] * v[1] < u[1] * v[0] ? -1 : 1) * Math.acos(r(u, v));
}
// initial angle
var a1 = a([1, 0], [(currp.x - cpp.x) / rx, (currp.y - cpp.y) / ry]);
// angle delta
var u = [(currp.x - cpp.x) / rx, (currp.y - cpp.y) / ry];
var v = [(-currp.x - cpp.x) / rx, (-currp.y - cpp.y) / ry];
var ad = a(u, v);
if (r(u, v) <= -1) ad = Math.PI;
if (r(u, v) >= 1) ad = 0;
// for markers
var dir = 1 - sweepFlag ? 1.0 : -1.0;
var ah = a1 + dir * (ad / 2.0);
var halfWay = new svg.Point(
centp.x + rx * Math.cos(ah),
centp.y + ry * Math.sin(ah)
);
pp.addMarkerAngle(halfWay, ah - dir * Math.PI / 2);
pp.addMarkerAngle(cp, ah - dir * Math.PI);
bb.addPoint(cp.x, cp.y); // TODO: this is too naive, make it better
if (ctx != null) {
var r = rx > ry ? rx : ry;
var sx = rx > ry ? 1 : rx / ry;
var sy = rx > ry ? ry / rx : 1;
ctx.translate(centp.x, centp.y);
ctx.rotate(xAxisRotation);
ctx.scale(sx, sy);
ctx.arc(0, 0, r, a1, a1 + ad, 1 - sweepFlag);
ctx.scale(1 / sx, 1 / sy);
ctx.rotate(-xAxisRotation);
ctx.translate(-centp.x, -centp.y);
}
}
break;
case 'Z':
case 'z':
if (ctx != null) ctx.closePath();
pp.current = pp.start;
}
}
return bb;
}
this.getMarkers = function() {
var points = this.PathParser.getMarkerPoints();
var angles = this.PathParser.getMarkerAngles();
var markers = [];
for (var i = 0; i < points.length; i++) {
markers.push([points[i], angles[i]]);
}
return markers;
}
}
svg.Element.path.prototype = new svg.Element.PathElementBase;
// pattern element
svg.Element.pattern = function(node) {
this.base = svg.Element.ElementBase;
this.base(node);
this.createPattern = function(ctx, element) {
var width = this.attribute('width').toPixels('x', true);
var height = this.attribute('height').toPixels('y', true);
// render me using a temporary svg element
var tempSvg = new svg.Element.svg();
tempSvg.attributes['viewBox'] = new svg.Property('viewBox', this.attribute('viewBox').value);
tempSvg.attributes['width'] = new svg.Property('width', width + 'px');
tempSvg.attributes['height'] = new svg.Property('height', height + 'px');
tempSvg.attributes['transform'] = new svg.Property('transform', this.attribute('patternTransform').value);
tempSvg.children = this.children;
var c = document.createElement('canvas');
c.width = width;
c.height = height;
var cctx = c.getContext('2d');
if (this.attribute('x').hasValue() && this.attribute('y').hasValue()) {
cctx.translate(this.attribute('x').toPixels('x', true), this.attribute('y').toPixels('y', true));
}
// render 3x3 grid so when we transform there's no white space on edges
for (var x = -1; x <= 1; x++) {
for (var y = -1; y <= 1; y++) {
cctx.save();
tempSvg.attributes['x'] = new svg.Property('x', x * c.width);
tempSvg.attributes['y'] = new svg.Property('y', y * c.height);
tempSvg.render(cctx);
cctx.restore();
}
}
var pattern = ctx.createPattern(c, 'repeat');
return pattern;
}
}
svg.Element.pattern.prototype = new svg.Element.ElementBase;
// marker element
svg.Element.marker = function(node) {
this.base = svg.Element.ElementBase;
this.base(node);
this.baseRender = this.render;
this.render = function(ctx, point, angle) {
ctx.translate(point.x, point.y);
if (this.attribute('orient').valueOrDefault('auto') == 'auto') ctx.rotate(angle);
if (this.attribute('markerUnits').valueOrDefault('strokeWidth') == 'strokeWidth') ctx.scale(ctx.lineWidth, ctx.lineWidth);
ctx.save();
// render me using a temporary svg element
var tempSvg = new svg.Element.svg();
tempSvg.attributes['viewBox'] = new svg.Property('viewBox', this.attribute('viewBox').value);
tempSvg.attributes['refX'] = new svg.Property('refX', this.attribute('refX').value);
tempSvg.attributes['refY'] = new svg.Property('refY', this.attribute('refY').value);
tempSvg.attributes['width'] = new svg.Property('width', this.attribute('markerWidth').value);
tempSvg.attributes['height'] = new svg.Property('height', this.attribute('markerHeight').value);
tempSvg.attributes['fill'] = new svg.Property('fill', this.attribute('fill').valueOrDefault('black'));
tempSvg.attributes['stroke'] = new svg.Property('stroke', this.attribute('stroke').valueOrDefault('none'));
tempSvg.children = this.children;
tempSvg.render(ctx);
ctx.restore();
if (this.attribute('markerUnits').valueOrDefault('strokeWidth') == 'strokeWidth') ctx.scale(1 / ctx.lineWidth, 1 / ctx.lineWidth);
if (this.attribute('orient').valueOrDefault('auto') == 'auto') ctx.rotate(-angle);
ctx.translate(-point.x, -point.y);
}
}
svg.Element.marker.prototype = new svg.Element.ElementBase;
// definitions element
svg.Element.defs = function(node) {
this.base = svg.Element.ElementBase;
this.base(node);
this.render = function(ctx) {
// NOOP
}
}
svg.Element.defs.prototype = new svg.Element.ElementBase;
// base for gradients
svg.Element.GradientBase = function(node) {
this.base = svg.Element.ElementBase;
this.base(node);
this.stops = [];
for (var i = 0; i < this.children.length; i++) {
var child = this.children[i];
if (child.type == 'stop') this.stops.push(child);
}
this.getGradient = function() {
// OVERRIDE ME!
}
this.gradientUnits = function() {
return this.attribute('gradientUnits').valueOrDefault('objectBoundingBox');
}
this.attributesToInherit = ['gradientUnits'];
this.inheritStopContainer = function(stopsContainer) {
for (var i = 0; i < this.attributesToInherit.length; i++) {
var attributeToInherit = this.attributesToInherit[i];
if (!this.attribute(attributeToInherit).hasValue() && stopsContainer.attribute(attributeToInherit).hasValue()) {
this.attribute(attributeToInherit, true).value = stopsContainer.attribute(attributeToInherit).value;
}
}
}
this.createGradient = function(ctx, element, parentOpacityProp) {
var stopsContainer = this;
if (this.getHrefAttribute().hasValue()) {
stopsContainer = this.getHrefAttribute().getDefinition();
this.inheritStopContainer(stopsContainer);
}
var addParentOpacity = function(color) {
if (parentOpacityProp.hasValue()) {
var p = new svg.Property('color', color);
return p.addOpacity(parentOpacityProp).value;
}
return color;
};
var g = this.getGradient(ctx, element);
if (g == null) return addParentOpacity(stopsContainer.stops[stopsContainer.stops.length - 1].color);
for (var i = 0; i < stopsContainer.stops.length; i++) {
g.addColorStop(stopsContainer.stops[i].offset, addParentOpacity(stopsContainer.stops[i].color));
}
if (this.attribute('gradientTransform').hasValue()) {
// render as transformed pattern on temporary canvas
var rootView = svg.ViewPort.viewPorts[0];
var rect = new svg.Element.rect();
rect.attributes['x'] = new svg.Property('x', -svg.MAX_VIRTUAL_PIXELS / 3.0);
rect.attributes['y'] = new svg.Property('y', -svg.MAX_VIRTUAL_PIXELS / 3.0);
rect.attributes['width'] = new svg.Property('width', svg.MAX_VIRTUAL_PIXELS);
rect.attributes['height'] = new svg.Property('height', svg.MAX_VIRTUAL_PIXELS);
var group = new svg.Element.g();
group.attributes['transform'] = new svg.Property('transform', this.attribute('gradientTransform').value);
group.children = [rect];
var tempSvg = new svg.Element.svg();
tempSvg.attributes['x'] = new svg.Property('x', 0);
tempSvg.attributes['y'] = new svg.Property('y', 0);
tempSvg.attributes['width'] = new svg.Property('width', rootView.width);
tempSvg.attributes['height'] = new svg.Property('height', rootView.height);
tempSvg.children = [group];
var c = document.createElement('canvas');
c.width = rootView.width;
c.height = rootView.height;
var tempCtx = c.getContext('2d');
tempCtx.fillStyle = g;
tempSvg.render(tempCtx);
return tempCtx.createPattern(c, 'no-repeat');
}
return g;
}
}
svg.Element.GradientBase.prototype = new svg.Element.ElementBase;
// linear gradient element
svg.Element.linearGradient = function(node) {
this.base = svg.Element.GradientBase;
this.base(node);
this.attributesToInherit.push('x1');
this.attributesToInherit.push('y1');
this.attributesToInherit.push('x2');
this.attributesToInherit.push('y2');
this.getGradient = function(ctx, element) {
var bb = this.gradientUnits() == 'objectBoundingBox' ? element.getBoundingBox() : null;
if (!this.attribute('x1').hasValue() && !this.attribute('y1').hasValue() && !this.attribute('x2').hasValue() && !this.attribute('y2').hasValue()) {
this.attribute('x1', true).value = 0;
this.attribute('y1', true).value = 0;
this.attribute('x2', true).value = 1;
this.attribute('y2', true).value = 0;
}
var x1 = (this.gradientUnits() == 'objectBoundingBox' ? bb.x() + bb.width() * this.attribute('x1').numValue() : this.attribute('x1').toPixels('x'));
var y1 = (this.gradientUnits() == 'objectBoundingBox' ? bb.y() + bb.height() * this.attribute('y1').numValue() : this.attribute('y1').toPixels('y'));
var x2 = (this.gradientUnits() == 'objectBoundingBox' ? bb.x() + bb.width() * this.attribute('x2').numValue() : this.attribute('x2').toPixels('x'));
var y2 = (this.gradientUnits() == 'objectBoundingBox' ? bb.y() + bb.height() * this.attribute('y2').numValue() : this.attribute('y2').toPixels('y'));
if (x1 == x2 && y1 == y2) return null;
return ctx.createLinearGradient(x1, y1, x2, y2);
}
}
svg.Element.linearGradient.prototype = new svg.Element.GradientBase;
// radial gradient element
svg.Element.radialGradient = function(node) {
this.base = svg.Element.GradientBase;
this.base(node);
this.attributesToInherit.push('cx');
this.attributesToInherit.push('cy');
this.attributesToInherit.push('r');
this.attributesToInherit.push('fx');
this.attributesToInherit.push('fy');
this.getGradient = function(ctx, element) {
var bb = element.getBoundingBox();
if (!this.attribute('cx').hasValue()) this.attribute('cx', true).value = '50%';
if (!this.attribute('cy').hasValue()) this.attribute('cy', true).value = '50%';
if (!this.attribute('r').hasValue()) this.attribute('r', true).value = '50%';
var cx = (this.gradientUnits() == 'objectBoundingBox' ? bb.x() + bb.width() * this.attribute('cx').numValue() : this.attribute('cx').toPixels('x'));
var cy = (this.gradientUnits() == 'objectBoundingBox' ? bb.y() + bb.height() * this.attribute('cy').numValue() : this.attribute('cy').toPixels('y'));
var fx = cx;
var fy = cy;
if (this.attribute('fx').hasValue()) {
fx = (this.gradientUnits() == 'objectBoundingBox' ? bb.x() + bb.width() * this.attribute('fx').numValue() : this.attribute('fx').toPixels('x'));
}
if (this.attribute('fy').hasValue()) {
fy = (this.gradientUnits() == 'objectBoundingBox' ? bb.y() + bb.height() * this.attribute('fy').numValue() : this.attribute('fy').toPixels('y'));
}
var r = (this.gradientUnits() == 'objectBoundingBox' ? (bb.width() + bb.height()) / 2.0 * this.attribute('r').numValue() : this.attribute('r').toPixels());
return ctx.createRadialGradient(fx, fy, 0, cx, cy, r);
}
}
svg.Element.radialGradient.prototype = new svg.Element.GradientBase;
// gradient stop element
svg.Element.stop = function(node) {
this.base = svg.Element.ElementBase;
this.base(node);
this.offset = this.attribute('offset').numValue();
if (this.offset < 0) this.offset = 0;
if (this.offset > 1) this.offset = 1;
var stopColor = this.style('stop-color', true);
if (stopColor.value === '') stopColor.value = '#000';
if (this.style('stop-opacity').hasValue()) stopColor = stopColor.addOpacity(this.style('stop-opacity'));
this.color = stopColor.value;
}
svg.Element.stop.prototype = new svg.Element.ElementBase;
// animation base element
svg.Element.AnimateBase = function(node) {
this.base = svg.Element.ElementBase;
this.base(node);
svg.Animations.push(this);
this.duration = 0.0;
this.begin = this.attribute('begin').toMilliseconds();
this.maxDuration = this.begin + this.attribute('dur').toMilliseconds();
this.getProperty = function() {
var attributeType = this.attribute('attributeType').value;
var attributeName = this.attribute('attributeName').value;
if (attributeType == 'CSS') {
return this.parent.style(attributeName, true);
}
return this.parent.attribute(attributeName, true);
};
this.initialValue = null;
this.initialUnits = '';
this.removed = false;
this.calcValue = function() {
// OVERRIDE ME!
return '';
}
this.update = function(delta) {
// set initial value
if (this.initialValue == null) {
this.initialValue = this.getProperty().value;
this.initialUnits = this.getProperty().getUnits();
}
// if we're past the end time
if (this.duration > this.maxDuration) {
// loop for indefinitely repeating animations
if (this.attribute('repeatCount').value == 'indefinite' || this.attribute('repeatDur').value == 'indefinite') {
this.duration = 0.0
} else if (this.attribute('fill').valueOrDefault('remove') == 'freeze' && !this.frozen) {
this.frozen = true;
this.parent.animationFrozen = true;
this.parent.animationFrozenValue = this.getProperty().value;
} else if (this.attribute('fill').valueOrDefault('remove') == 'remove' && !this.removed) {
this.removed = true;
this.getProperty().value = this.parent.animationFrozen ? this.parent.animationFrozenValue : this.initialValue;
return true;
}
return false;
}
this.duration = this.duration + delta;
// if we're past the begin time
var updated = false;
if (this.begin < this.duration) {
var newValue = this.calcValue(); // tween
if (this.attribute('type').hasValue()) {
// for transform, etc.
var type = this.attribute('type').value;
newValue = type + '(' + newValue + ')';
}
this.getProperty().value = newValue;
updated = true;
}
return updated;
}
this.from = this.attribute('from');
this.to = this.attribute('to');
this.values = this.attribute('values');
if (this.values.hasValue()) this.values.value = this.values.value.split(';');
// fraction of duration we've covered
this.progress = function() {
var ret = {
progress: (this.duration - this.begin) / (this.maxDuration - this.begin)
};
if (this.values.hasValue()) {
var p = ret.progress * (this.values.value.length - 1);
var lb = Math.floor(p),
ub = Math.ceil(p);
ret.from = new svg.Property('from', parseFloat(this.values.value[lb]));
ret.to = new svg.Property('to', parseFloat(this.values.value[ub]));
ret.progress = (p - lb) / (ub - lb);
} else {
ret.from = this.from;
ret.to = this.to;
}
return ret;
}
}
svg.Element.AnimateBase.prototype = new svg.Element.ElementBase;
// animate element
svg.Element.animate = function(node) {
this.base = svg.Element.AnimateBase;
this.base(node);
this.calcValue = function() {
var p = this.progress();
// tween value linearly
var newValue = p.from.numValue() + (p.to.numValue() - p.from.numValue()) * p.progress;
return newValue + this.initialUnits;
};
}
svg.Element.animate.prototype = new svg.Element.AnimateBase;
// animate color element
svg.Element.animateColor = function(node) {
this.base = svg.Element.AnimateBase;
this.base(node);
this.calcValue = function() {
var p = this.progress();
var from = new RGBColor(p.from.value);
var to = new RGBColor(p.to.value);
if (from.ok && to.ok) {
// tween color linearly
var r = from.r + (to.r - from.r) * p.progress;
var g = from.g + (to.g - from.g) * p.progress;
var b = from.b + (to.b - from.b) * p.progress;
return 'rgb(' + parseInt(r, 10) + ',' + parseInt(g, 10) + ',' + parseInt(b, 10) + ')';
}
return this.attribute('from').value;
};
}
svg.Element.animateColor.prototype = new svg.Element.AnimateBase;
// animate transform element
svg.Element.animateTransform = function(node) {
this.base = svg.Element.AnimateBase;
this.base(node);
this.calcValue = function() {
var p = this.progress();
// tween value linearly
var from = svg.ToNumberArray(p.from.value);
var to = svg.ToNumberArray(p.to.value);
var newValue = '';
for (var i = 0; i < from.length; i++) {
newValue += from[i] + (to[i] - from[i]) * p.progress + ' ';
}
return newValue;
};
}
svg.Element.animateTransform.prototype = new svg.Element.animate;
// font element
svg.Element.font = function(node) {
this.base = svg.Element.ElementBase;
this.base(node);
this.horizAdvX = this.attribute('horiz-adv-x').numValue();
this.isRTL = false;
this.isArabic = false;
this.fontFace = null;
this.missingGlyph = null;
this.glyphs = [];
for (var i = 0; i < this.children.length; i++) {
var child = this.children[i];
if (child.type == 'font-face') {
this.fontFace = child;
if (child.style('font-family').hasValue()) {
svg.Definitions[child.style('font-family').value] = this;
}
} else if (child.type == 'missing-glyph') this.missingGlyph = child;
else if (child.type == 'glyph') {
if (child.arabicForm != '') {
this.isRTL = true;
this.isArabic = true;
if (typeof(this.glyphs[child.unicode]) == 'undefined') this.glyphs[child.unicode] = [];
this.glyphs[child.unicode][child.arabicForm] = child;
} else {
this.glyphs[child.unicode] = child;
}
}
}
}
svg.Element.font.prototype = new svg.Element.ElementBase;
// font-face element
svg.Element.fontface = function(node) {
this.base = svg.Element.ElementBase;
this.base(node);
this.ascent = this.attribute('ascent').value;
this.descent = this.attribute('descent').value;
this.unitsPerEm = this.attribute('units-per-em').numValue();
}
svg.Element.fontface.prototype = new svg.Element.ElementBase;
// missing-glyph element
svg.Element.missingglyph = function(node) {
this.base = svg.Element.path;
this.base(node);
this.horizAdvX = 0;
}
svg.Element.missingglyph.prototype = new svg.Element.path;
// glyph element
svg.Element.glyph = function(node) {
this.base = svg.Element.path;
this.base(node);
this.horizAdvX = this.attribute('horiz-adv-x').numValue();
this.unicode = this.attribute('unicode').value;
this.arabicForm = this.attribute('arabic-form').value;
}
svg.Element.glyph.prototype = new svg.Element.path;
// text element
svg.Element.text = function(node) {
this.captureTextNodes = true;
this.base = svg.Element.RenderedElementBase;
this.base(node);
this.baseSetContext = this.setContext;
this.setContext = function(ctx) {
this.baseSetContext(ctx);
var textBaseline = this.style('dominant-baseline').toTextBaseline();
if (textBaseline == null) textBaseline = this.style('alignment-baseline').toTextBaseline();
if (textBaseline != null) ctx.textBaseline = textBaseline;
}
this.getBoundingBox = function() {
var x = this.attribute('x').toPixels('x');
var y = this.attribute('y').toPixels('y');
var fontSize = this.parent.style('font-size').numValueOrDefault(svg.Font.Parse(svg.ctx.font).fontSize);
return new svg.BoundingBox(x, y - fontSize, x + Math.floor(fontSize * 2.0 / 3.0) * this.children[0].getText().length, y);
}
this.renderChildren = function(ctx) {
this.x = this.attribute('x').toPixels('x');
this.y = this.attribute('y').toPixels('y');
if (this.attribute('dx').hasValue()) this.x += this.attribute('dx').toPixels('x');
if (this.attribute('dy').hasValue()) this.y += this.attribute('dy').toPixels('y');
this.x += this.getAnchorDelta(ctx, this, 0);
for (var i = 0; i < this.children.length; i++) {
this.renderChild(ctx, this, i);
}
}
this.getAnchorDelta = function(ctx, parent, startI) {
var textAnchor = this.style('text-anchor').valueOrDefault('start');
if (textAnchor != 'start') {
var width = 0;
for (var i = startI; i < parent.children.length; i++) {
var child = parent.children[i];
if (i > startI && child.attribute('x').hasValue()) break; // new group
width += child.measureTextRecursive(ctx);
}
return -1 * (textAnchor == 'end' ? width : width / 2.0);
}
return 0;
}
this.renderChild = function(ctx, parent, i) {
var child = parent.children[i];
if (child.attribute('x').hasValue()) {
child.x = child.attribute('x').toPixels('x') + parent.getAnchorDelta(ctx, parent, i);
if (child.attribute('dx').hasValue()) child.x += child.attribute('dx').toPixels('x');
} else {
if (child.attribute('dx').hasValue()) parent.x += child.attribute('dx').toPixels('x');
child.x = parent.x;
}
parent.x = child.x + child.measureText(ctx);
if (child.attribute('y').hasValue()) {
child.y = child.attribute('y').toPixels('y');
if (child.attribute('dy').hasValue()) child.y += child.attribute('dy').toPixels('y');
} else {
if (child.attribute('dy').hasValue()) parent.y += child.attribute('dy').toPixels('y');
child.y = parent.y;
}
parent.y = child.y;
child.render(ctx);
for (var i = 0; i < child.children.length; i++) {
parent.renderChild(ctx, child, i);
}
}
}
svg.Element.text.prototype = new svg.Element.RenderedElementBase;
// text base
svg.Element.TextElementBase = function(node) {
this.base = svg.Element.RenderedElementBase;
this.base(node);
this.getGlyph = function(font, text, i) {
var c = text[i];
var glyph = null;
if (font.isArabic) {
var arabicForm = 'isolated';
if ((i == 0 || text[i - 1] == ' ') && i < text.length - 2 && text[i + 1] != ' ') arabicForm = 'terminal';
if (i > 0 && text[i - 1] != ' ' && i < text.length - 2 && text[i + 1] != ' ') arabicForm = 'medial';
if (i > 0 && text[i - 1] != ' ' && (i == text.length - 1 || text[i + 1] == ' ')) arabicForm = 'initial';
if (typeof(font.glyphs[c]) != 'undefined') {
glyph = font.glyphs[c][arabicForm];
if (glyph == null && font.glyphs[c].type == 'glyph') glyph = font.glyphs[c];
}
} else {
glyph = font.glyphs[c];
}
if (glyph == null) glyph = font.missingGlyph;
return glyph;
}
this.renderChildren = function(ctx) {
var customFont = this.parent.style('font-family').getDefinition();
if (customFont != null) {
var fontSize = this.parent.style('font-size').numValueOrDefault(svg.Font.Parse(svg.ctx.font).fontSize);
var fontStyle = this.parent.style('font-style').valueOrDefault(svg.Font.Parse(svg.ctx.font).fontStyle);
var text = this.getText();
if (customFont.isRTL) text = text.split("").reverse().join("");
var dx = svg.ToNumberArray(this.parent.attribute('dx').value);
for (var i = 0; i < text.length; i++) {
var glyph = this.getGlyph(customFont, text, i);
var scale = fontSize / customFont.fontFace.unitsPerEm;
ctx.translate(this.x, this.y);
ctx.scale(scale, -scale);
var lw = ctx.lineWidth;
ctx.lineWidth = ctx.lineWidth * customFont.fontFace.unitsPerEm / fontSize;
if (fontStyle == 'italic') ctx.transform(1, 0, .4, 1, 0, 0);
glyph.render(ctx);
if (fontStyle == 'italic') ctx.transform(1, 0, -.4, 1, 0, 0);
ctx.lineWidth = lw;
ctx.scale(1 / scale, -1 / scale);
ctx.translate(-this.x, -this.y);
this.x += fontSize * (glyph.horizAdvX || customFont.horizAdvX) / customFont.fontFace.unitsPerEm;
if (typeof(dx[i]) != 'undefined' && !isNaN(dx[i])) {
this.x += dx[i];
}
}
return;
}
if (ctx.fillStyle != '') ctx.fillText(svg.compressSpaces(this.getText()), this.x, this.y);
if (ctx.strokeStyle != '') ctx.strokeText(svg.compressSpaces(this.getText()), this.x, this.y);
}
this.getText = function() {
// OVERRIDE ME
}
this.measureTextRecursive = function(ctx) {
var width = this.measureText(ctx);
for (var i = 0; i < this.children.length; i++) {
width += this.children[i].measureTextRecursive(ctx);
}
return width;
}
this.measureText = function(ctx) {
var customFont = this.parent.style('font-family').getDefinition();
if (customFont != null) {
var fontSize = this.parent.style('font-size').numValueOrDefault(svg.Font.Parse(svg.ctx.font).fontSize);
var measure = 0;
var text = this.getText();
if (customFont.isRTL) text = text.split("").reverse().join("");
var dx = svg.ToNumberArray(this.parent.attribute('dx').value);
for (var i = 0; i < text.length; i++) {
var glyph = this.getGlyph(customFont, text, i);
measure += (glyph.horizAdvX || customFont.horizAdvX) * fontSize / customFont.fontFace.unitsPerEm;
if (typeof(dx[i]) != 'undefined' && !isNaN(dx[i])) {
measure += dx[i];
}
}
return measure;
}
var textToMeasure = svg.compressSpaces(this.getText());
if (!ctx.measureText) return textToMeasure.length * 10;
ctx.save();
this.setContext(ctx);
var width = ctx.measureText(textToMeasure).width;
ctx.restore();
return width;
}
}
svg.Element.TextElementBase.prototype = new svg.Element.RenderedElementBase;
// tspan
svg.Element.tspan = function(node) {
this.captureTextNodes = true;
this.base = svg.Element.TextElementBase;
this.base(node);
this.text = svg.compressSpaces(node.value || node.text || node.textContent || '');
this.getText = function() {
// if this node has children, then they own the text
if (this.children.length > 0) {
return '';
}
return this.text;
}
}
svg.Element.tspan.prototype = new svg.Element.TextElementBase;
// tref
svg.Element.tref = function(node) {
this.base = svg.Element.TextElementBase;
this.base(node);
this.getText = function() {
var element = this.getHrefAttribute().getDefinition();
if (element != null) return element.children[0].getText();
}
}
svg.Element.tref.prototype = new svg.Element.TextElementBase;
// a element
svg.Element.a = function(node) {
this.base = svg.Element.TextElementBase;
this.base(node);
this.hasText = node.childNodes.length > 0;
for (var i = 0; i < node.childNodes.length; i++) {
if (node.childNodes[i].nodeType != 3) this.hasText = false;
}
// this might contain text
this.text = this.hasText ? node.childNodes[0].value : '';
this.getText = function() {
return this.text;
}
this.baseRenderChildren = this.renderChildren;
this.renderChildren = function(ctx) {
if (this.hasText) {
// render as text element
this.baseRenderChildren(ctx);
var fontSize = new svg.Property('fontSize', svg.Font.Parse(svg.ctx.font).fontSize);
svg.Mouse.checkBoundingBox(this, new svg.BoundingBox(this.x, this.y - fontSize.toPixels('y'), this.x + this.measureText(ctx), this.y));
} else if (this.children.length > 0) {
// render as temporary group
var g = new svg.Element.g();
g.children = this.children;
g.parent = this;
g.render(ctx);
}
}
this.onclick = function() {
window.open(this.getHrefAttribute().value);
}
this.onmousemove = function() {
svg.ctx.canvas.style.cursor = 'pointer';
}
}
svg.Element.a.prototype = new svg.Element.TextElementBase;
// image element
svg.Element.image = function(node) {
this.base = svg.Element.RenderedElementBase;
this.base(node);
var href = this.getHrefAttribute().value;
if (href == '') {
return;
}
var isSvg = href.match(/\.svg$/)
svg.Images.push(this);
this.loaded = false;
if (!isSvg) {
this.img = document.createElement('img');
if (svg.opts['useCORS'] == true) {
this.img.crossOrigin = 'Anonymous';
}
var self = this;
this.img.onload = function() {
self.loaded = true;
}
this.img.onerror = function() {
svg.log('ERROR: image "' + href + '" not found');
self.loaded = true;
}
this.img.src = href;
} else {
this.img = svg.ajax(href);
this.loaded = true;
}
this.renderChildren = function(ctx) {
var x = this.attribute('x').toPixels('x');
var y = this.attribute('y').toPixels('y');
var width = this.attribute('width').toPixels('x');
var height = this.attribute('height').toPixels('y');
if (width == 0 || height == 0) return;
ctx.save();
if (isSvg) {
ctx.drawSvg(this.img, x, y, width, height);
} else {
ctx.translate(x, y);
svg.AspectRatio(ctx,
this.attribute('preserveAspectRatio').value,
width,
this.img.width,
height,
this.img.height,
0,
0);
ctx.drawImage(this.img, 0, 0);
}
ctx.restore();
}
this.getBoundingBox = function() {
var x = this.attribute('x').toPixels('x');
var y = this.attribute('y').toPixels('y');
var width = this.attribute('width').toPixels('x');
var height = this.attribute('height').toPixels('y');
return new svg.BoundingBox(x, y, x + width, y + height);
}
}
svg.Element.image.prototype = new svg.Element.RenderedElementBase;
// group element
svg.Element.g = function(node) {
this.base = svg.Element.RenderedElementBase;
this.base(node);
this.getBoundingBox = function() {
var bb = new svg.BoundingBox();
for (var i = 0; i < this.children.length; i++) {
bb.addBoundingBox(this.children[i].getBoundingBox());
}
return bb;
};
}
svg.Element.g.prototype = new svg.Element.RenderedElementBase;
// symbol element
svg.Element.symbol = function(node) {
this.base = svg.Element.RenderedElementBase;
this.base(node);
this.render = function(ctx) {
// NO RENDER
};
}
svg.Element.symbol.prototype = new svg.Element.RenderedElementBase;
// style element
svg.Element.style = function(node) {
this.base = svg.Element.ElementBase;
this.base(node);
// text, or spaces then CDATA
var css = ''
for (var i = 0; i < node.childNodes.length; i++) {
css += node.childNodes[i].data;
}
css = css.replace(/(\/\*([^*]|[\r\n]|(\*+([^*\/]|[\r\n])))*\*+\/)|(^[\s]*\/\/.*)/gm, ''); // remove comments
css = svg.compressSpaces(css); // replace whitespace
var cssDefs = css.split('}');
for (var i = 0; i < cssDefs.length; i++) {
if (svg.trim(cssDefs[i]) != '') {
var cssDef = cssDefs[i].split('{');
var cssClasses = cssDef[0].split(',');
var cssProps = cssDef[1].split(';');
for (var j = 0; j < cssClasses.length; j++) {
var cssClass = svg.trim(cssClasses[j]);
if (cssClass != '') {
var props = {};
for (var k = 0; k < cssProps.length; k++) {
var prop = cssProps[k].indexOf(':');
var name = cssProps[k].substr(0, prop);
var value = cssProps[k].substr(prop + 1, cssProps[k].length - prop);
if (name != null && value != null) {
props[svg.trim(name)] = new svg.Property(svg.trim(name), svg.trim(value));
}
}
svg.Styles[cssClass] = props;
svg.StylesSpecificity[cssClass] = getSelectorSpecificity(cssClass);
if (cssClass == '@font-face') {
var fontFamily = props['font-family'].value.replace(/"/g, '');
var srcs = props['src'].value.split(',');
for (var s = 0; s < srcs.length; s++) {
if (srcs[s].indexOf('format("svg")') > 0) {
var urlStart = srcs[s].indexOf('url');
var urlEnd = srcs[s].indexOf(')', urlStart);
var url = srcs[s].substr(urlStart + 5, urlEnd - urlStart - 6);
var doc = svg.parseXml(svg.ajax(url));
var fonts = doc.getElementsByTagName('font');
for (var f = 0; f < fonts.length; f++) {
var font = svg.CreateElement(fonts[f]);
svg.Definitions[fontFamily] = font;
}
}
}
}
}
}
}
}
}
svg.Element.style.prototype = new svg.Element.ElementBase;
// use element
svg.Element.use = function(node) {
this.base = svg.Element.RenderedElementBase;
this.base(node);
this.baseSetContext = this.setContext;
this.setContext = function(ctx) {
this.baseSetContext(ctx);
if (this.attribute('x').hasValue()) ctx.translate(this.attribute('x').toPixels('x'), 0);
if (this.attribute('y').hasValue()) ctx.translate(0, this.attribute('y').toPixels('y'));
}
var element = this.getHrefAttribute().getDefinition();
this.path = function(ctx) {
if (element != null) element.path(ctx);
}
this.getBoundingBox = function() {
if (element != null) return element.getBoundingBox();
}
this.renderChildren = function(ctx) {
if (element != null) {
var tempSvg = element;
if (element.type == 'symbol') {
// render me using a temporary svg element in symbol cases (http://www.w3.org/TR/SVG/struct.html#UseElement)
tempSvg = new svg.Element.svg();
tempSvg.type = 'svg';
tempSvg.attributes['viewBox'] = new svg.Property('viewBox', element.attribute('viewBox').value);
tempSvg.attributes['preserveAspectRatio'] = new svg.Property('preserveAspectRatio', element.attribute('preserveAspectRatio').value);
tempSvg.attributes['overflow'] = new svg.Property('overflow', element.attribute('overflow').value);
tempSvg.children = element.children;
}
if (tempSvg.type == 'svg') {
// if symbol or svg, inherit width/height from me
if (this.attribute('width').hasValue()) tempSvg.attributes['width'] = new svg.Property('width', this.attribute('width').value);
if (this.attribute('height').hasValue()) tempSvg.attributes['height'] = new svg.Property('height', this.attribute('height').value);
}
var oldParent = tempSvg.parent;
tempSvg.parent = null;
tempSvg.render(ctx);
tempSvg.parent = oldParent;
}
}
}
svg.Element.use.prototype = new svg.Element.RenderedElementBase;
// mask element
svg.Element.mask = function(node) {
this.base = svg.Element.ElementBase;
this.base(node);
this.apply = function(ctx, element) {
// render as temp svg
var x = this.attribute('x').toPixels('x');
var y = this.attribute('y').toPixels('y');
var width = this.attribute('width').toPixels('x');
var height = this.attribute('height').toPixels('y');
if (width == 0 && height == 0) {
var bb = new svg.BoundingBox();
for (var i = 0; i < this.children.length; i++) {
bb.addBoundingBox(this.children[i].getBoundingBox());
}
var x = Math.floor(bb.x1);
var y = Math.floor(bb.y1);
var width = Math.floor(bb.width());
var height = Math.floor(bb.height());
}
// temporarily remove mask to avoid recursion
var mask = element.attribute('mask').value;
element.attribute('mask').value = '';
var cMask = document.createElement('canvas');
cMask.width = x + width;
cMask.height = y + height;
var maskCtx = cMask.getContext('2d');
this.renderChildren(maskCtx);
var c = document.createElement('canvas');
c.width = x + width;
c.height = y + height;
var tempCtx = c.getContext('2d');
element.render(tempCtx);
tempCtx.globalCompositeOperation = 'destination-in';
tempCtx.fillStyle = maskCtx.createPattern(cMask, 'no-repeat');
tempCtx.fillRect(0, 0, x + width, y + height);
ctx.fillStyle = tempCtx.createPattern(c, 'no-repeat');
ctx.fillRect(0, 0, x + width, y + height);
// reassign mask
element.attribute('mask').value = mask;
}
this.render = function(ctx) {
// NO RENDER
}
}
svg.Element.mask.prototype = new svg.Element.ElementBase;
// clip element
svg.Element.clipPath = function(node) {
this.base = svg.Element.ElementBase;
this.base(node);
this.apply = function(ctx) {
var oldBeginPath = CanvasRenderingContext2D.prototype.beginPath;
CanvasRenderingContext2D.prototype.beginPath = function() {};
var oldClosePath = CanvasRenderingContext2D.prototype.closePath;
CanvasRenderingContext2D.prototype.closePath = function() {};
oldBeginPath.call(ctx);
for (var i = 0; i < this.children.length; i++) {
var child = this.children[i];
if (typeof(child.path) != 'undefined') {
var transform = null;
if (child.style('transform', false, true).hasValue()) {
transform = new svg.Transform(child.style('transform', false, true).value);
transform.apply(ctx);
}
child.path(ctx);
CanvasRenderingContext2D.prototype.closePath = oldClosePath;
if (transform) {
transform.unapply(ctx);
}
}
}
oldClosePath.call(ctx);
ctx.clip();
CanvasRenderingContext2D.prototype.beginPath = oldBeginPath;
CanvasRenderingContext2D.prototype.closePath = oldClosePath;
}
this.render = function(ctx) {
// NO RENDER
}
}
svg.Element.clipPath.prototype = new svg.Element.ElementBase;
// filters
svg.Element.filter = function(node) {
this.base = svg.Element.ElementBase;
this.base(node);
this.apply = function(ctx, element) {
// render as temp svg
var bb = element.getBoundingBox();
var x = Math.floor(bb.x1);
var y = Math.floor(bb.y1);
var width = Math.floor(bb.width());
var height = Math.floor(bb.height());
// temporarily remove filter to avoid recursion
var filter = element.style('filter').value;
element.style('filter').value = '';
var px = 0,
py = 0;
for (var i = 0; i < this.children.length; i++) {
var efd = this.children[i].extraFilterDistance || 0;
px = Math.max(px, efd);
py = Math.max(py, efd);
}
var c = document.createElement('canvas');
c.width = width + 2 * px;
c.height = height + 2 * py;
var tempCtx = c.getContext('2d');
tempCtx.translate(-x + px, -y + py);
element.render(tempCtx);
// apply filters
for (var i = 0; i < this.children.length; i++) {
if (typeof(this.children[i].apply) === 'function') {
this.children[i].apply(tempCtx, 0, 0, width + 2 * px, height + 2 * py);
}
}
// render on me
ctx.drawImage(c, 0, 0, width + 2 * px, height + 2 * py, x - px, y - py, width + 2 * px, height + 2 * py);
// reassign filter
element.style('filter', true).value = filter;
}
this.render = function(ctx) {
// NO RENDER
}
}
svg.Element.filter.prototype = new svg.Element.ElementBase;
svg.Element.feMorphology = function(node) {
this.base = svg.Element.ElementBase;
this.base(node);
this.apply = function(ctx, x, y, width, height) {
// TODO: implement
}
}
svg.Element.feMorphology.prototype = new svg.Element.ElementBase;
svg.Element.feComposite = function(node) {
this.base = svg.Element.ElementBase;
this.base(node);
this.apply = function(ctx, x, y, width, height) {
// TODO: implement
}
}
svg.Element.feComposite.prototype = new svg.Element.ElementBase;
svg.Element.feColorMatrix = function(node) {
this.base = svg.Element.ElementBase;
this.base(node);
var matrix = svg.ToNumberArray(this.attribute('values').value);
switch (this.attribute('type').valueOrDefault('matrix')) { // http://www.w3.org/TR/SVG/filters.html#feColorMatrixElement
case 'saturate':
var s = matrix[0];
matrix = [0.213 + 0.787 * s, 0.715 - 0.715 * s, 0.072 - 0.072 * s, 0, 0,
0.213 - 0.213 * s, 0.715 + 0.285 * s, 0.072 - 0.072 * s, 0, 0,
0.213 - 0.213 * s, 0.715 - 0.715 * s, 0.072 + 0.928 * s, 0, 0,
0, 0, 0, 1, 0,
0, 0, 0, 0, 1
];
break;
case 'hueRotate':
var a = matrix[0] * Math.PI / 180.0;
var c = function(m1, m2, m3) {
return m1 + Math.cos(a) * m2 + Math.sin(a) * m3;
};
matrix = [c(0.213, 0.787, -0.213), c(0.715, -0.715, -0.715), c(0.072, -0.072, 0.928), 0, 0,
c(0.213, -0.213, 0.143), c(0.715, 0.285, 0.140), c(0.072, -0.072, -0.283), 0, 0,
c(0.213, -0.213, -0.787), c(0.715, -0.715, 0.715), c(0.072, 0.928, 0.072), 0, 0,
0, 0, 0, 1, 0,
0, 0, 0, 0, 1
];
break;
case 'luminanceToAlpha':
matrix = [0, 0, 0, 0, 0,
0, 0, 0, 0, 0,
0, 0, 0, 0, 0,
0.2125, 0.7154, 0.0721, 0, 0,
0, 0, 0, 0, 1
];
break;
}
function imGet(img, x, y, width, height, rgba) {
return img[y * width * 4 + x * 4 + rgba];
}
function imSet(img, x, y, width, height, rgba, val) {
img[y * width * 4 + x * 4 + rgba] = val;
}
function m(i, v) {
var mi = matrix[i];
return mi * (mi < 0 ? v - 255 : v);
}
this.apply = function(ctx, x, y, width, height) {
// assuming x==0 && y==0 for now
var srcData = ctx.getImageData(0, 0, width, height);
for (var y = 0; y < height; y++) {
for (var x = 0; x < width; x++) {
var r = imGet(srcData.data, x, y, width, height, 0);
var g = imGet(srcData.data, x, y, width, height, 1);
var b = imGet(srcData.data, x, y, width, height, 2);
var a = imGet(srcData.data, x, y, width, height, 3);
imSet(srcData.data, x, y, width, height, 0, m(0, r) + m(1, g) + m(2, b) + m(3, a) + m(4, 1));
imSet(srcData.data, x, y, width, height, 1, m(5, r) + m(6, g) + m(7, b) + m(8, a) + m(9, 1));
imSet(srcData.data, x, y, width, height, 2, m(10, r) + m(11, g) + m(12, b) + m(13, a) + m(14, 1));
imSet(srcData.data, x, y, width, height, 3, m(15, r) + m(16, g) + m(17, b) + m(18, a) + m(19, 1));
}
}
ctx.clearRect(0, 0, width, height);
ctx.putImageData(srcData, 0, 0);
}
}
svg.Element.feColorMatrix.prototype = new svg.Element.ElementBase;
svg.Element.feGaussianBlur = function(node) {
this.base = svg.Element.ElementBase;
this.base(node);
this.blurRadius = Math.floor(this.attribute('stdDeviation').numValue());
this.extraFilterDistance = this.blurRadius;
this.apply = function(ctx, x, y, width, height) {
if (typeof(stackBlurCanvasRGBA) == 'undefined') {
svg.log('ERROR: StackBlur.js must be included for blur to work');
return;
}
// StackBlur requires canvas be on document
ctx.canvas.id = svg.UniqueId();
ctx.canvas.style.display = 'none';
document.body.appendChild(ctx.canvas);
stackBlurCanvasRGBA(ctx.canvas.id, x, y, width, height, this.blurRadius);
document.body.removeChild(ctx.canvas);
}
}
svg.Element.feGaussianBlur.prototype = new svg.Element.ElementBase;
// title element, do nothing
svg.Element.title = function(node) {}
svg.Element.title.prototype = new svg.Element.ElementBase;
// desc element, do nothing
svg.Element.desc = function(node) {}
svg.Element.desc.prototype = new svg.Element.ElementBase;
svg.Element.MISSING = function(node) {
svg.log('ERROR: Element \'' + node.nodeName + '\' not yet implemented.');
}
svg.Element.MISSING.prototype = new svg.Element.ElementBase;
// element factory
svg.CreateElement = function(node) {
var className = node.nodeName.replace(/^[^:]+:/, ''); // remove namespace
className = className.replace(/\-/g, ''); // remove dashes
var e = null;
if (typeof(svg.Element[className]) != 'undefined') {
e = new svg.Element[className](node);
} else {
e = new svg.Element.MISSING(node);
}
e.type = node.nodeName;
return e;
}
// load from url
svg.load = function(ctx, url) {
svg.loadXml(ctx, svg.ajax(url));
}
// load from xml
svg.loadXml = function(ctx, xml) {
svg.loadXmlDoc(ctx, svg.parseXml(xml));
}
svg.loadXmlDoc = function(ctx, dom) {
svg.init(ctx);
var mapXY = function(p) {
var e = ctx.canvas;
while (e) {
p.x -= e.offsetLeft;
p.y -= e.offsetTop;
e = e.offsetParent;
}
if (window.scrollX) p.x += window.scrollX;
if (window.scrollY) p.y += window.scrollY;
return p;
}
// bind mouse
if (svg.opts['ignoreMouse'] != true) {
ctx.canvas.onclick = function(e) {
var p = mapXY(new svg.Point(e != null ? e.clientX : event.clientX, e != null ? e.clientY : event.clientY));
svg.Mouse.onclick(p.x, p.y);
};
ctx.canvas.onmousemove = function(e) {
var p = mapXY(new svg.Point(e != null ? e.clientX : event.clientX, e != null ? e.clientY : event.clientY));
svg.Mouse.onmousemove(p.x, p.y);
};
}
var e = svg.CreateElement(dom.documentElement);
e.root = true;
e.addStylesFromStyleDefinition();
// render loop
var isFirstRender = true;
var draw = function() {
svg.ViewPort.Clear();
if (ctx.canvas.parentNode) svg.ViewPort.SetCurrent(ctx.canvas.parentNode.clientWidth, ctx.canvas.parentNode.clientHeight);
if (svg.opts['ignoreDimensions'] != true) {
// set canvas size
if (e.style('width').hasValue()) {
ctx.canvas.width = e.style('width').toPixels('x');
ctx.canvas.style.width = ctx.canvas.width + 'px';
}
if (e.style('height').hasValue()) {
ctx.canvas.height = e.style('height').toPixels('y');
ctx.canvas.style.height = ctx.canvas.height + 'px';
}
}
var cWidth = ctx.canvas.clientWidth || ctx.canvas.width;
var cHeight = ctx.canvas.clientHeight || ctx.canvas.height;
if (svg.opts['ignoreDimensions'] == true && e.style('width').hasValue() && e.style('height').hasValue()) {
cWidth = e.style('width').toPixels('x');
cHeight = e.style('height').toPixels('y');
}
svg.ViewPort.SetCurrent(cWidth, cHeight);
if (svg.opts['offsetX'] != null) e.attribute('x', true).value = svg.opts['offsetX'];
if (svg.opts['offsetY'] != null) e.attribute('y', true).value = svg.opts['offsetY'];
if (svg.opts['scaleWidth'] != null || svg.opts['scaleHeight'] != null) {
var xRatio = null,
yRatio = null,
viewBox = svg.ToNumberArray(e.attribute('viewBox').value);
if (svg.opts['scaleWidth'] != null) {
if (e.attribute('width').hasValue()) xRatio = e.attribute('width').toPixels('x') / svg.opts['scaleWidth'];
else if (!isNaN(viewBox[2])) xRatio = viewBox[2] / svg.opts['scaleWidth'];
}
if (svg.opts['scaleHeight'] != null) {
if (e.attribute('height').hasValue()) yRatio = e.attribute('height').toPixels('y') / svg.opts['scaleHeight'];
else if (!isNaN(viewBox[3])) yRatio = viewBox[3] / svg.opts['scaleHeight'];
}
if (xRatio == null) {
xRatio = yRatio;
}
if (yRatio == null) {
yRatio = xRatio;
}
e.attribute('width', true).value = svg.opts['scaleWidth'];
e.attribute('height', true).value = svg.opts['scaleHeight'];
e.style('transform', true, true).value += ' scale(' + (1.0 / xRatio) + ',' + (1.0 / yRatio) + ')';
}
// clear and render
if (svg.opts['ignoreClear'] != true) {
ctx.clearRect(0, 0, cWidth, cHeight);
}
e.render(ctx);
if (isFirstRender) {
isFirstRender = false;
if (typeof(svg.opts['renderCallback']) == 'function') svg.opts['renderCallback'](dom);
}
}
var waitingForImages = true;
if (svg.ImagesLoaded()) {
waitingForImages = false;
draw();
}
svg.intervalID = setInterval(function() {
var needUpdate = false;
if (waitingForImages && svg.ImagesLoaded()) {
waitingForImages = false;
needUpdate = true;
}
// need update from mouse events?
if (svg.opts['ignoreMouse'] != true) {
needUpdate = needUpdate | svg.Mouse.hasEvents();
}
// need update from animations?
if (svg.opts['ignoreAnimation'] != true) {
for (var i = 0; i < svg.Animations.length; i++) {
needUpdate = needUpdate | svg.Animations[i].update(1000 / svg.FRAMERATE);
}
}
// need update from redraw?
if (typeof(svg.opts['forceRedraw']) == 'function') {
if (svg.opts['forceRedraw']() == true) needUpdate = true;
}
// render if needed
if (needUpdate) {
draw();
svg.Mouse.runEvents(); // run and clear our events
}
}, 1000 / svg.FRAMERATE);
}
svg.stop = function() {
if (svg.intervalID) {
clearInterval(svg.intervalID);
}
}
svg.Mouse = new(function() {
this.events = [];
this.hasEvents = function() {
return this.events.length != 0;
}
this.onclick = function(x, y) {
this.events.push({
type: 'onclick',
x: x,
y: y,
run: function(e) {
if (e.onclick) e.onclick();
}
});
}
this.onmousemove = function(x, y) {
this.events.push({
type: 'onmousemove',
x: x,
y: y,
run: function(e) {
if (e.onmousemove) e.onmousemove();
}
});
}
this.eventElements = [];
this.checkPath = function(element, ctx) {
for (var i = 0; i < this.events.length; i++) {
var e = this.events[i];
if (ctx.isPointInPath && ctx.isPointInPath(e.x, e.y)) this.eventElements[i] = element;
}
}
this.checkBoundingBox = function(element, bb) {
for (var i = 0; i < this.events.length; i++) {
var e = this.events[i];
if (bb.isPointInBox(e.x, e.y)) this.eventElements[i] = element;
}
}
this.runEvents = function() {
svg.ctx.canvas.style.cursor = '';
for (var i = 0; i < this.events.length; i++) {
var e = this.events[i];
var element = this.eventElements[i];
while (element) {
e.run(element);
element = element.parent;
}
}
// done running, clear
this.events = [];
this.eventElements = [];
}
});
return svg;
}
})();
if (typeof(CanvasRenderingContext2D) != 'undefined') {
CanvasRenderingContext2D.prototype.drawSvg = function(s, dx, dy, dw, dh) {
canvg(this.canvas, s, {
ignoreMouse: true,
ignoreAnimation: true,
ignoreDimensions: true,
ignoreClear: true,
offsetX: dx,
offsetY: dy,
scaleWidth: dw,
scaleHeight: dh
});
}
} | josephfusco/select64 | js/canvg.js | JavaScript | mit | 102,571 |
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Module: ActiveScaffold::Helpers::FormColumns</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="classHeader">
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Module</strong></td>
<td class="class-name-in-header">ActiveScaffold::Helpers::FormColumns</td>
</tr>
<tr class="top-aligned-row">
<td><strong>In:</strong></td>
<td>
<a href="../../../files/vendor/plugins/active_scaffold/lib/bridges/calendar_date_select/lib/as_cds_bridge_rb.html">
vendor/plugins/active_scaffold/lib/bridges/calendar_date_select/lib/as_cds_bridge.rb
</a>
<br />
<a href="../../../files/vendor/plugins/active_scaffold/lib/bridges/file_column/lib/form_ui_rb.html">
vendor/plugins/active_scaffold/lib/bridges/file_column/lib/form_ui.rb
</a>
<br />
<a href="../../../files/vendor/plugins/active_scaffold/lib/helpers/form_column_helpers_rb.html">
vendor/plugins/active_scaffold/lib/helpers/form_column_helpers.rb
</a>
<br />
</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
<div id="description">
<p>
<a href="../Helpers.html">Helpers</a> that assist with the rendering of a
Form Column
</p>
</div>
</div>
<div id="method-list">
<h3 class="section-bar">Methods</h3>
<div class="name-list">
<a href="#M000667">active_scaffold_input_boolean</a>
<a href="#M000651">active_scaffold_input_calendar_date_select</a>
<a href="#M000661">active_scaffold_input_checkbox</a>
<a href="#M000662">active_scaffold_input_country</a>
<a href="#M000652">active_scaffold_input_file_column</a>
<a href="#M000653">active_scaffold_input_for</a>
<a href="#M000656">active_scaffold_input_options</a>
<a href="#M000663">active_scaffold_input_password</a>
<a href="#M000658">active_scaffold_input_plural_association</a>
<a href="#M000660">active_scaffold_input_record_select</a>
<a href="#M000659">active_scaffold_input_select</a>
<a href="#M000657">active_scaffold_input_singular_association</a>
<a href="#M000655">active_scaffold_input_text_options</a>
<a href="#M000664">active_scaffold_input_textarea</a>
<a href="#M000665">active_scaffold_input_usa_state</a>
<a href="#M000666">active_scaffold_input_virtual</a>
<a href="#M000675">column_renders_as</a>
<a href="#M000654">form_column</a>
<a href="#M000674">form_partial_for_column</a>
<a href="#M000677">is_subform?</a>
<a href="#M000676">is_subsection?</a>
<a href="#M000671">override_form_field</a>
<a href="#M000670">override_form_field?</a>
<a href="#M000669">override_form_field_partial</a>
<a href="#M000668">override_form_field_partial?</a>
<a href="#M000673">override_input</a>
<a href="#M000672">override_input?</a>
</div>
</div>
</div>
<!-- if includes -->
<div id="section">
<!-- if method_list -->
<div id="methods">
<h3 class="section-bar">Public Instance methods</h3>
<div id="method-M000667" class="method-detail">
<a name="M000667"></a>
<div class="method-heading">
<a href="FormColumns.src/M000667.html" target="Code" class="method-signature"
onclick="popupCode('FormColumns.src/M000667.html');return false;">
<span class="method-name">active_scaffold_input_boolean</span><span class="method-args">(column, options)</span>
</a>
</div>
<div class="method-description">
<p>
Column.type-based inputs
</p>
</div>
</div>
<div id="method-M000651" class="method-detail">
<a name="M000651"></a>
<div class="method-heading">
<a href="FormColumns.src/M000651.html" target="Code" class="method-signature"
onclick="popupCode('FormColumns.src/M000651.html');return false;">
<span class="method-name">active_scaffold_input_calendar_date_select</span><span class="method-args">(column, options)</span>
</a>
</div>
<div class="method-description">
</div>
</div>
<div id="method-M000661" class="method-detail">
<a name="M000661"></a>
<div class="method-heading">
<a href="FormColumns.src/M000661.html" target="Code" class="method-signature"
onclick="popupCode('FormColumns.src/M000661.html');return false;">
<span class="method-name">active_scaffold_input_checkbox</span><span class="method-args">(column, options)</span>
</a>
</div>
<div class="method-description">
</div>
</div>
<div id="method-M000662" class="method-detail">
<a name="M000662"></a>
<div class="method-heading">
<a href="FormColumns.src/M000662.html" target="Code" class="method-signature"
onclick="popupCode('FormColumns.src/M000662.html');return false;">
<span class="method-name">active_scaffold_input_country</span><span class="method-args">(column, options)</span>
</a>
</div>
<div class="method-description">
</div>
</div>
<div id="method-M000652" class="method-detail">
<a name="M000652"></a>
<div class="method-heading">
<a href="FormColumns.src/M000652.html" target="Code" class="method-signature"
onclick="popupCode('FormColumns.src/M000652.html');return false;">
<span class="method-name">active_scaffold_input_file_column</span><span class="method-args">(column, options)</span>
</a>
</div>
<div class="method-description">
</div>
</div>
<div id="method-M000653" class="method-detail">
<a name="M000653"></a>
<div class="method-heading">
<a href="FormColumns.src/M000653.html" target="Code" class="method-signature"
onclick="popupCode('FormColumns.src/M000653.html');return false;">
<span class="method-name">active_scaffold_input_for</span><span class="method-args">(column, scope = nil)</span>
</a>
</div>
<div class="method-description">
<p>
This method decides which input to use for the given column. It does not do
any rendering. It only decides which method is responsible for rendering.
</p>
</div>
</div>
<div id="method-M000656" class="method-detail">
<a name="M000656"></a>
<div class="method-heading">
<a href="FormColumns.src/M000656.html" target="Code" class="method-signature"
onclick="popupCode('FormColumns.src/M000656.html');return false;">
<span class="method-name">active_scaffold_input_options</span><span class="method-args">(column, scope = nil)</span>
</a>
</div>
<div class="method-description">
<p>
the standard active scaffold options used for class, name and scope
</p>
</div>
</div>
<div id="method-M000663" class="method-detail">
<a name="M000663"></a>
<div class="method-heading">
<a href="FormColumns.src/M000663.html" target="Code" class="method-signature"
onclick="popupCode('FormColumns.src/M000663.html');return false;">
<span class="method-name">active_scaffold_input_password</span><span class="method-args">(column, options)</span>
</a>
</div>
<div class="method-description">
</div>
</div>
<div id="method-M000658" class="method-detail">
<a name="M000658"></a>
<div class="method-heading">
<a href="FormColumns.src/M000658.html" target="Code" class="method-signature"
onclick="popupCode('FormColumns.src/M000658.html');return false;">
<span class="method-name">active_scaffold_input_plural_association</span><span class="method-args">(column, options)</span>
</a>
</div>
<div class="method-description">
</div>
</div>
<div id="method-M000660" class="method-detail">
<a name="M000660"></a>
<div class="method-heading">
<a href="FormColumns.src/M000660.html" target="Code" class="method-signature"
onclick="popupCode('FormColumns.src/M000660.html');return false;">
<span class="method-name">active_scaffold_input_record_select</span><span class="method-args">(column, options)</span>
</a>
</div>
<div class="method-description">
<p>
only works for singular associations requires RecordSelect plugin to be
installed and configured. … maybe this should be provided in a
bridge?
</p>
</div>
</div>
<div id="method-M000659" class="method-detail">
<a name="M000659"></a>
<div class="method-heading">
<a href="FormColumns.src/M000659.html" target="Code" class="method-signature"
onclick="popupCode('FormColumns.src/M000659.html');return false;">
<span class="method-name">active_scaffold_input_select</span><span class="method-args">(column, options)</span>
</a>
</div>
<div class="method-description">
</div>
</div>
<div id="method-M000657" class="method-detail">
<a name="M000657"></a>
<div class="method-heading">
<a href="FormColumns.src/M000657.html" target="Code" class="method-signature"
onclick="popupCode('FormColumns.src/M000657.html');return false;">
<span class="method-name">active_scaffold_input_singular_association</span><span class="method-args">(column, options)</span>
</a>
</div>
<div class="method-description">
<p>
Form input methods
</p>
</div>
</div>
<div id="method-M000655" class="method-detail">
<a name="M000655"></a>
<div class="method-heading">
<a href="FormColumns.src/M000655.html" target="Code" class="method-signature"
onclick="popupCode('FormColumns.src/M000655.html');return false;">
<span class="method-name">active_scaffold_input_text_options</span><span class="method-args">(options = {})</span>
</a>
</div>
<div class="method-description">
<p>
the standard active scaffold options used for textual inputs
</p>
</div>
</div>
<div id="method-M000664" class="method-detail">
<a name="M000664"></a>
<div class="method-heading">
<a href="FormColumns.src/M000664.html" target="Code" class="method-signature"
onclick="popupCode('FormColumns.src/M000664.html');return false;">
<span class="method-name">active_scaffold_input_textarea</span><span class="method-args">(column, options)</span>
</a>
</div>
<div class="method-description">
</div>
</div>
<div id="method-M000665" class="method-detail">
<a name="M000665"></a>
<div class="method-heading">
<a href="FormColumns.src/M000665.html" target="Code" class="method-signature"
onclick="popupCode('FormColumns.src/M000665.html');return false;">
<span class="method-name">active_scaffold_input_usa_state</span><span class="method-args">(column, options)</span>
</a>
</div>
<div class="method-description">
</div>
</div>
<div id="method-M000666" class="method-detail">
<a name="M000666"></a>
<div class="method-heading">
<a href="FormColumns.src/M000666.html" target="Code" class="method-signature"
onclick="popupCode('FormColumns.src/M000666.html');return false;">
<span class="method-name">active_scaffold_input_virtual</span><span class="method-args">(column, options)</span>
</a>
</div>
<div class="method-description">
</div>
</div>
<div id="method-M000675" class="method-detail">
<a name="M000675"></a>
<div class="method-heading">
<a href="FormColumns.src/M000675.html" target="Code" class="method-signature"
onclick="popupCode('FormColumns.src/M000675.html');return false;">
<span class="method-name">column_renders_as</span><span class="method-args">(column)</span>
</a>
</div>
<div class="method-description">
<p>
Macro-level rendering decisions for columns
</p>
</div>
</div>
<div id="method-M000654" class="method-detail">
<a name="M000654"></a>
<div class="method-heading">
<span class="method-name">form_column</span><span class="method-args">(column, scope = nil)</span>
</div>
<div class="method-description">
<p>
Alias for <a href="FormColumns.html#M000653">active_scaffold_input_for</a>
</p>
</div>
</div>
<div id="method-M000674" class="method-detail">
<a name="M000674"></a>
<div class="method-heading">
<a href="FormColumns.src/M000674.html" target="Code" class="method-signature"
onclick="popupCode('FormColumns.src/M000674.html');return false;">
<span class="method-name">form_partial_for_column</span><span class="method-args">(column)</span>
</a>
</div>
<div class="method-description">
</div>
</div>
<div id="method-M000677" class="method-detail">
<a name="M000677"></a>
<div class="method-heading">
<a href="FormColumns.src/M000677.html" target="Code" class="method-signature"
onclick="popupCode('FormColumns.src/M000677.html');return false;">
<span class="method-name">is_subform?</span><span class="method-args">(column)</span>
</a>
</div>
<div class="method-description">
</div>
</div>
<div id="method-M000676" class="method-detail">
<a name="M000676"></a>
<div class="method-heading">
<a href="FormColumns.src/M000676.html" target="Code" class="method-signature"
onclick="popupCode('FormColumns.src/M000676.html');return false;">
<span class="method-name">is_subsection?</span><span class="method-args">(column)</span>
</a>
</div>
<div class="method-description">
</div>
</div>
<div id="method-M000671" class="method-detail">
<a name="M000671"></a>
<div class="method-heading">
<a href="FormColumns.src/M000671.html" target="Code" class="method-signature"
onclick="popupCode('FormColumns.src/M000671.html');return false;">
<span class="method-name">override_form_field</span><span class="method-args">(column)</span>
</a>
</div>
<div class="method-description">
<p>
the naming convention for overriding form fields with helpers
</p>
</div>
</div>
<div id="method-M000670" class="method-detail">
<a name="M000670"></a>
<div class="method-heading">
<a href="FormColumns.src/M000670.html" target="Code" class="method-signature"
onclick="popupCode('FormColumns.src/M000670.html');return false;">
<span class="method-name">override_form_field?</span><span class="method-args">(column)</span>
</a>
</div>
<div class="method-description">
</div>
</div>
<div id="method-M000669" class="method-detail">
<a name="M000669"></a>
<div class="method-heading">
<a href="FormColumns.src/M000669.html" target="Code" class="method-signature"
onclick="popupCode('FormColumns.src/M000669.html');return false;">
<span class="method-name">override_form_field_partial</span><span class="method-args">(column)</span>
</a>
</div>
<div class="method-description">
<p>
the naming convention for overriding form fields with partials
</p>
</div>
</div>
<div id="method-M000668" class="method-detail">
<a name="M000668"></a>
<div class="method-heading">
<a href="FormColumns.src/M000668.html" target="Code" class="method-signature"
onclick="popupCode('FormColumns.src/M000668.html');return false;">
<span class="method-name">override_form_field_partial?</span><span class="method-args">(column)</span>
</a>
</div>
<div class="method-description">
<p>
Form column override signatures
</p>
</div>
</div>
<div id="method-M000673" class="method-detail">
<a name="M000673"></a>
<div class="method-heading">
<a href="FormColumns.src/M000673.html" target="Code" class="method-signature"
onclick="popupCode('FormColumns.src/M000673.html');return false;">
<span class="method-name">override_input</span><span class="method-args">(form_ui)</span>
</a>
</div>
<div class="method-description">
<p>
the naming convention for overriding form input types with helpers
</p>
</div>
</div>
<div id="method-M000672" class="method-detail">
<a name="M000672"></a>
<div class="method-heading">
<a href="FormColumns.src/M000672.html" target="Code" class="method-signature"
onclick="popupCode('FormColumns.src/M000672.html');return false;">
<span class="method-name">override_input?</span><span class="method-args">(form_ui)</span>
</a>
</div>
<div class="method-description">
</div>
</div>
</div>
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html> | NESCent/max-bodysize-evol | doc/rdoc/classes/ActiveScaffold/Helpers/FormColumns.html | HTML | mit | 19,771 |
<?php namespace Indikator\News\Updates;
use October\Rain\Database\Updates\Migration;
use Schema;
class ChangeVarcharLength extends Migration
{
public function up()
{
Schema::table('indikator_news_posts', function($table)
{
$table->string('image', 191)->change();
});
Schema::table('indikator_news_categories', function($table)
{
$table->string('image', 191)->change();
});
Schema::table('indikator_news_subscribers', function($table)
{
$table->string('registered_ip', 191)->change();
$table->string('confirmed_ip', 191)->change();
$table->string('confirmation_hash', 191)->change();
$table->string('unsubscribed_ip', 191)->change();
});
Schema::table('indikator_news_newsletter_logs', function($table)
{
$table->string('status', 191)->change();
$table->string('hash', 191)->change();
});
}
public function down()
{
Schema::table('indikator_news_posts', function($table)
{
$table->string('image', 200)->change();
});
Schema::table('indikator_news_categories', function($table)
{
$table->string('image', 200)->change();
});
Schema::table('indikator_news_subscribers', function($table)
{
$table->string('registered_ip', 255)->change();
$table->string('confirmed_ip', 255)->change();
$table->string('confirmation_hash', 255)->change();
$table->string('unsubscribed_ip', 255)->change();
});
Schema::table('indikator_news_newsletter_logs', function($table)
{
$table->string('status', 255)->change();
$table->string('hash', 255)->change();
});
}
}
| gergo85/oc-news | updates/change_varchar_length.php | PHP | mit | 1,858 |
//
// sdmSheetsAndAlerts.h
// SheetsAndAlerts
//
// Created by Peter JC Spencer on 18/08/2015.
// Copyright (c) 2015 Spencer's digital media. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "sdmCustomAlertView.h"
@interface sdmSheetsAndAlerts : NSObject
// ActionSheet support.
+ (void)showSheetNamed:(NSString *)name
inView:(UIView *)view
forDelegate:(id<UIActionSheetDelegate>)delegate;
// Custom alertView support.
+ (void)showCustomAlertNamed:(NSString *)name
forDelegate:(id<sdmCustomAlertViewDelegate>)delegate;
@end
| PJCSpencer/SheetsAndAlerts | SheetsAndAlerts/Common/sdmSheetsAndAlerts.h | C | mit | 588 |
<link rel="stylesheet" type="text/css" href="<?php echo base_url(); ?>resources/assets/datatable/jquery.dataTables.min.css">
<script type="text/javascript" language="javascript" src="<?php echo base_url(); ?>resources/assets/datatable/jquery.dataTables.min.js">
</script>
<style type="text/css">
.page_content{
padding: 15px;
background-color: white;
margin-top: 15px;
}
.page_des_big_image{
width: 100%;
height: 300px;
}
.bdy_des{
margin-top: 25px;
}
.breadcump{
background-image: url("<?php echo base_url("resources/images/breadcump_image.jpg")?>");
height: 103px;
}
.breadcump-wrapper{
/* background-color: #000000 !important;*/
opacity: 0.7;
width: 100%;
height:100%;
}
.wrapper{
padding:30px !important;
color: #FFFFFF;
font-weight: bold;
}
.breadcump_row a{
color: white;
}
#search-submit-holder, #tree-equation-footer {
height: 45px;
padding: 5px;
background-color: #f4f4f4;
border-top: 1px solid #d9d9d9;
border-radius: 0px 0px 4px 4px;
}
#easyPaginate {width:800px;}
#easyPaginate img {display:block;margin-bottom:10px;}
.easyPaginateNav a {padding:5px;}
.easyPaginateNav a.current {font-weight:bold;text-decoration:underline;}
.form-group {
margin-bottom: 15px;
}
.form-control {
height: 40px !important;
}
</style>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-select/1.12.4/css/bootstrap-select.min.css">
<!-- Latest compiled and minified JavaScript -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-select/1.12.4/js/bootstrap-select.min.js"></script>
<link href="<?php echo base_url(); ?>resources/resource_potal/assets/css/pagination/jquery.snippet.min.css" rel="stylesheet" media="screen"/>
<!-- <link href="<?php echo base_url(); ?>resources/resource_potal/assets/css/pagination/styles.css" rel="stylesheet" media="screen"/> -->
<script type="text/javascript">
$('.selectpicker').selectpicker({
// style: 'btn-info',
size: 4
});
</script>
<script type="text/javascript">
$('.responsive-tabs').responsiveTabs({
accordionOn: ['xs', 'sm'] // xs, sm, md, lg
});
</script>
<?php
$lang_ses = $this->session->userdata("site_lang");
?>
<div class="col-sm-12 breadcump img-responsive">
<div class="row">
<div class="breadcump-wrapper">
<div class="wrapper">
<div style="font-size:25px;" class="breadcump_row"><?php echo $this->lang->line("allometric_equations"); ?>
</div>
<div class="breadcump_row"><a href="<?php echo base_url() ?>"><?php echo $this->lang->line("home"); ?></a> ><?php echo $this->lang->line("allometric_equations"); ?>
</div>
</div>
</div>
</div>
</div>
<div class="col-md-12 page_content">
<h3>Allometric Equation Search</h3>
<div class="col-sm-12">
<ul class="nav nav-tabs">
<li class="<?php if(!isset($searchType)){ echo 'active'; } ?>" > <a data-toggle="tab" href="#home">Keyword</a></li>
<li class="
<?php if(isset($searchType)){
if($searchType==5)
{
echo 'active';
}
else {
echo '';
}
} ?>
"
><a data-toggle="tab" href="#menu5">Component</a></li>
<li class="
<?php if(isset($searchType)){
if($searchType==2)
{
echo 'active';
}
else {
echo '';
}
} ?>
"> <a data-toggle="tab" href="#menu1">Taxonomy</a>
</li>
<li
class="
<?php if(isset($searchType)){
if($searchType==3)
{
echo 'active';
}
else {
echo '';
}
} ?>
"
><a data-toggle="tab" href="#menu2">Location</a></li>
<li class="
<?php if(isset($searchType)){
if($searchType==4)
{
echo 'active';
}
else {
echo '';
}
} ?>
"
><a data-toggle="tab" href="#menu3">Reference</a></li>
</ul>
<div class="tab-content">
<div id="home" class="tab-pane fade
<?php if(!isset($searchType)){ echo 'in active'; } ?>
">
<p> Search allometric equations by keyword.
This searches accross several text fields as like as Taxonomy,Location,Reference.
<br>
Example searches: Log Green Biomass = -1.5851 + 2.4855 * Log (DBH),Volume,1985,Sterculiaceae,Heritiera fomes,Coastal Area
</p>
<p>
</p>
<!-- <form action="<?php echo site_url('data/search_allometricequation_key');?>" method = "post"> -->
<form action="<?php echo site_url('portal/searchAllometricEquationAll');?>" method = "get">
<div class="col-md-6">
<!-- <div class="form-group">
<label>Allometric Equation No<span style="color:red;"></span></label>
<input type="text" class="form-control input-sm f" name ="ID_AE" value = "<?php echo (isset($ID_AE))?$ID_AE:'';?>" class ="ID_AE" maxlength="64" placeholder="Allometric Equation" />
</div> -->
<!-- <div class="form-group">
<label>Allometric Equation <span style="color:red;"></span></label>
<input type="text" class="form-control input-sm" name ="Equation" value = "<?php echo (isset($Equation))?$Equation:'';?>" class ="Equation" maxlength="200" placeholder="Allometric Equation " />
</div> -->
<div class="form-group">
<label>Keyword </label>
<input type="text" class="form-control input-sm" name = "keyword" value = "<?php echo (isset($keyword))?$keyword:'';?>" placeholder="Keyword" /><br>
<!-- <input id="searchButton" style="float:right" class="btn btn-success" type="submit" value="Search"> -->
<input type="hidden" name="Equation_VarNames" value="">
</div>
</div>
</div>
<div id="menu5" class="tab-pane fade">
<p>Search by tree components such as branch diameter, leaves, stump and fruit
<br>
EB Bark: Yes + Rf Fine Roots: Yes,F Fruit: No + S Stump: Yes
</p>
<!-- <form action="<?php echo site_url('portal/search_allometricequation_ref');?>" method = "post"> -->
<div class="col-md-4">
<div class="form-group">
<label class="control-label" style="float: left;clear: left;width: 130px;">B - Bark <span style="color:red;"></span></label>
<div class="controls ">
<select class="select form-control" name="B" style="width:70px">
<option value="" selected="selected"></option>
<option value="NA">No</option>
<option value="1">Yes</option>
</select>
</div>
</div>
<div class="form-group">
<label class="control-label" style="float: left;clear: left;width: 130px;">Bd - Dead branches<span style="color:red;"></span></label>
<div class="controls ">
<select class="select form-control" name="Bd" style="width:70px">
<option value="" selected="selected"></option>
<option value="NA">No</option>
<option value="1">Yes</option>
</select>
</div>
</div>
<div class="form-group">
<label class="control-label" style="float: left;clear: left;width: 130px;">Bg - Big branches<span style="color:red;"></span></label>
<div class="controls ">
<select class="select form-control" name="Bg" style="width:70px">
<option value="" selected="selected"></option>
<option value="NA">No</option>
<option value="1">Yes</option>
</select>
</div>
</div>
<div class="form-group">
<label class="control-label" style="float: left;clear: left;width: 130px;">Bt - Thin branches<span style="color:red;"></span></label>
<div class="controls ">
<select class="select form-control" name="Bt" style="width:70px">
<option value="" selected="selected"></option>
<option value="NA">No</option>
<option value="1">Yes</option>
</select>
</div>
</div>
<div class="form-group">
<label class="control-label" style="float: left;clear: left;width: 130px;">L - Leaves<span style="color:red;"></span></label>
<div class="controls ">
<select class="select form-control" name="L" style="width:70px">
<option value="" selected="selected"></option>
<option value="NA">No</option>
<option value="1">Yes</option>
</select>
</div>
</div>
<div class="form-group">
<label class="control-label" style="float: left;clear: left;width: 130px;">Rb - Large roots<span style="color:red;"></span></label>
<div class="controls ">
<select class="select form-control" name="Rb" style="width:70px">
<option value="" selected="selected"></option>
<option value="NA">No</option>
<option value="1">Yes</option>
</select>
</div>
</div>
<div class="form-group">
<label class="control-label" style="float: left;clear: left;width: 130px;">Rf - Fine roots<span style="color:red;"></span></label>
<div class="controls ">
<select class="select form-control" name="Rf" style="width:70px">
<option value="" selected="selected"></option>
<option value="NA">No</option>
<option value="1">Yes</option>
</select>
</div>
</div>
<div class="form-group">
<label class="control-label" style="float: left;clear: left;width: 130px;">Rm - Medium roots<span style="color:red;"></span></label>
<div class="controls ">
<select class="select form-control" name="Rm" style="width:70px">
<option value="" selected="selected"></option>
<option value="NA">No</option>
<option value="1">Yes</option>
</select>
</div>
</div>
<div class="form-group">
<label class="control-label" style="float: left;clear: left;width: 130px;">S - Stump<span style="color:red;"></span></label>
<div class="controls ">
<select class="select form-control" name="S" style="width:70px">
<option value="" selected="selected"></option>
<option value="NA">No</option>
<option value="1">Yes</option>
</select>
</div>
</div>
<div class="form-group">
<label class="control-label" class="control-label" style="float: left;clear: left;width: 130px;">T - Trunks<span style="color:red;"></span></label>
<div class="controls ">
<select class="select form-control" name="T" style="width:70px">
<option value="" selected="selected"></option>
<option value="NA">No</option>
<option value="1">Yes</option>
</select>
</div>
</div>
<div class="form-group">
<label class="control-label" style="float: left;clear: left;width: 130px;">F - Fruit<span style="color:red;"></span></label>
<div class="controls ">
<select class="select form-control" name="F" style="width:70px">
<option value="" selected="selected"></option>
<option value="NA">No</option>
<option value="1">Yes</option>
</select>
</div>
</div>
</div>
<div class="col-lg-8">
<img src="<?php echo base_url('resources/images/component.png')?>" class="img-responsive" width="500">
</div>
<!-- <input id="searchButton" style="float:right" class="btn btn-success" type="submit" value="Search"> -->
<input type="hidden" class="form-control input-sm" name ="location_name" value = "<?php echo (isset($location_name))?$location_name:'';?>" maxlength="64" class ="location_name" placeholder="Year" />
</div>
<div id="menu1" class="tab-pane fade">
<p> Search allometric equations by family, genus or species.
Example searches
<br>
Example searches:Leguminosae,Senna,Senna siamea
</p>
<div class="col-md-6">
<div class="form-group">
<label>Family<span style="color:red;"></span></label>
<p><?php
$Family = $this->Forestdata_model->get_all_family();
$options = array('' => '--Select Family--');
foreach ($Family as $Family) {
$options["$Family->Family"] = $Family->Family;
}
$Family = set_value('Family');
echo form_dropdown('Family', $options, $Family, 'id="Family" style="width:100%;" class="form-control singleSelectExample" data-placeholder="Select Family" ');
?></p>
<!-- <input type="text" class="form-control input-sm f" name ="Family" value = "<?php echo (isset($Family))?$Family:'';?>" class ="Family" maxlength="64" placeholder="Family" /> -->
</div>
<div class="form-group">
<label>Genus<span style="color:red;"></span></label>
<!-- <input type="text" class="form-control input-sm g" name ="Genus" value = "<?php echo (isset($Genus))?$Genus:'';?>" class ="Genus" maxlength="64" placeholder="Genus" /> -->
<p><?php
$Genus = $this->Forestdata_model->get_all_genus();
$options = array('' => '--Select Genus--');
foreach ($Genus as $Genus) {
$options["$Genus->Genus"] = $Genus->Genus;
}
$Genus = set_value('Genus');
echo form_dropdown('Genus', $options, $Genus, 'id="Genus" style="width:100%;" class="form-control singleSelectExample" data-placeholder="Select Genus" ');
?></p>
</div>
<div class="form-group">
<label>Species<span style="color:red;"></span></label>
<!-- <input type="text" class="form-control input-sm s" name ="Species" value = "<?php echo (isset($Species))?$Species:'';?>" maxlength="64" class ="Species" placeholder="Species" /> -->
<p><?php
$Species = $this->Forestdata_model->get_all_species();
$options = array('' => '--Select Species--');
foreach ($Species as $Species) {
$options["$Species->Species"] = $Species->Species;
}
$Species = set_value('Species');
echo form_dropdown('Species', $options, $Species, 'id="Species" style="width:100%;" class="form-control singleSelectExample" data-placeholder="Select Species" ');
?></p>
<br>
<!-- <input id="searchButton" style="float:right" class="btn btn-success" type="submit" value="Search"> -->
</div>
</div>
</div>
<div id="menu2" class="tab-pane fade">
<p> Search allometric equations by tree location and biome.Example searches
<br>
Example searches:Biome (FAO):Tropical moist forest
</p>
<div class="col-md-12">
<div class="col-md-6">
<div class="form-group">
<label>Division<span style="color:red;"></span></label>
<!-- <input type="text" class="form-control input-sm" name ="Division" id="division" value = "<?php echo (isset($Division))?$Division:'';?>" class ="division" maxlength="64" placeholder="Division" /> -->
<p><?php
$ID_Divisions = $this->Forestdata_model->get_all_division();
$options = array('' => '--Select Division--');
foreach ($ID_Divisions as $ID_Division) {
$options["$ID_Division->Division"] = $ID_Division->Division;
}
$ID_Division = set_value('Division');
echo form_dropdown('Division', $options, $ID_Division, 'id="ID_Division" style="width:100%;" class="form-control singleSelectExample" data-placeholder="Choose a Division..." ');
?></p>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label>District<span style="color:red;"></span></label>
<p><select class="form-control singleSelectExample" id="ID_District" style="width:100%;" name="District">
<option value="">Select District</option></p>
</select>
</div>
</div>
</div>
<div class="col-md-12">
<div class="col-md-6">
<div class="form-group">
<label>Bangladesh Agroecological Zone <span style="color:red;"></span></label><br>
<!-- <input type="text" class="form-control" name ="EcoZones" id="ecoZones" value = "<?php echo (isset($EcoZones))?$EcoZones:'';?>" maxlength="64" class ="ecoZones" placeholder="FAO Global Ecological Zone" /> -->
<p><?php
$AEZ_NAMES = $this->Forestdata_model->get_all_agroecological_zones();
$options = array('' => '--Select Agroecological Zone--');
foreach ($AEZ_NAMES as $AEZ_NAME) {
$options["$AEZ_NAME->AEZ_NAME"] = $AEZ_NAME->AEZ_NAME;
}
$AEZ_NAME = set_value('AEZ_NAME');
echo form_dropdown('AEZ_NAME', $options, $AEZ_NAME, 'id="AEZ_NAME" style="width:100%;" class="form-control singleSelectExample" data-placeholder="Choose a Agroecological Zone..." ');
?></p>
</div>
</div>
<div class="col-md-6">
<label>FAO Biomes <span style="color:red;"></span></label><br>
<!-- <input type="text" class="form-control" name ="EcoZones" id="ecoZones" value = "<?php echo (isset($EcoZones))?$EcoZones:'';?>" maxlength="64" class ="ecoZones" placeholder="FAO Global Ecological Zone" /> -->
<p><?php
$FAOBiomess = $this->Forestdata_model->get_all_faobiomes();
$options = array('' => '--Select FAO Biomes --');
foreach ($FAOBiomess as $FAOBiomes) {
$options["$FAOBiomes->FAOBiomes"] = $FAOBiomes->FAOBiomes;
}
$FAOBiomes = set_value('FAOBiomes');
echo form_dropdown('FAOBiomes', $options, $FAOBiomes, 'id="FAOBiomes" style="width:100%;" class="form-control singleSelectExample" data-placeholder="Choose a FAO Biomes..." ');
?></p>
</div>
</div>
<div class="col-md-12">
<div class="col-md-6">
<label>BFI Zone <span style="color:red;"></span></label><br>
<!-- <input type="text" class="form-control" name ="EcoZones" id="ecoZones" value = "<?php echo (isset($EcoZones))?$EcoZones:'';?>" maxlength="64" class ="ecoZones" placeholder="FAO Global Ecological Zone" /> -->
<p><?php
$Zoness = $this->Forestdata_model->get_all_zones();
$options = array('' => '--Select BFI Zone--');
foreach ($Zoness as $Zones) {
$options["$Zones->Zones"] = $Zones->Zones;
}
$Zones = set_value('Zones');
echo form_dropdown('Zones', $options, $Zones, 'id="Zones" style="width:100%;" class="form-control singleSelectExample" data-placeholder="Choose a BFI Zone..." ');
?></p>
<br><br>
<!-- <input id="searchButton" style="float:right" class="btn btn-success" type="submit" value="Search"> -->
</div>
</div>
</div>
<div id="menu3" class="tab-pane fade">
<p> Search allometric equations by author, year, and reference.
Example searches
<br>
Example searches:Author: Mahmood, H,Reference:Biomass tables for minjiri,Year: 2004
</p>
<!-- <form action="<?php echo site_url('portal/search_allometricequation_ref');?>" method = "post"> -->
<div class="col-md-6">
<div class="form-group">
<label>Reference <span style="color:red;"></span></label>
<input type="text" class="form-control input-sm" name ="Reference" value = "<?php echo (isset($Reference))?$Reference:'';?>" class ="reference" placeholder="Reference" />
</div>
<div class="form-group">
<label>Author <span style="color:red;"></span></label>
<input type="text" class="form-control input-sm" name ="Author" value = "<?php echo (isset($Author))?$Author:'';?>" class ="author" placeholder="Author" />
</div>
<div class="form-group">
<label>Year <span style="color:red;"></span></label>
<input type="text" class="form-control input-sm" name ="Year" value = "<?php echo (isset($Year))?$Year:'';?>" class ="year" placeholder="Year" />
<br>
<!-- <input id="searchButton" style="float:right" class="btn btn-success" type="submit" value="Search"> -->
</div>
</div>
<!-- <input id="searchButton" style="float:right" class="btn btn-success" type="submit" value="Search"> -->
<input type="hidden" class="form-control input-sm" name ="location_name" value = "<?php echo (isset($location_name))?$location_name:'';?>" class ="location_name" placeholder="Year" />
<input type="hidden" class="form-control input-sm" name ="LatDD" value = "<?php echo (isset($LatDD))?$LatDD:'';?>" class ="LatDD" placeholder="Year" />
<input type="hidden" class="form-control input-sm" name ="LongDD" value = "<?php echo (isset($LongDD))?$LongDD:'';?>" class ="LongDD" placeholder="Year" />
<!-- <input type="hidden" class="form-control input-sm" name ="District" value = "<?php echo (isset($LongDD))?$District:'';?>" maxlength="64" class ="District" placeholder="Year" />
<input type="hidden" class="form-control input-sm" name ="Division" value = "<?php echo (isset($LongDD))?$Division:'';?>" maxlength="64" class ="Division" placeholder="Year" /> -->
</div>
</div>
</div>
<div class="col-lg-6">
<input id="searchButton" style="float:right" class="btn btn-success" type="submit" value="Search">
</div>
</form><br>
<div class="col-sm-12 bdy_des">
<div class="row" style="background-color:#eee;border:1px solid #ddd;border-radius:4px;margin:0px 1px 20px 1px;">
<div class="col-lg-6">
<h4>Result count: <span id="summary-results-total">
<?php
if(isset($allometricEquationView_count))
{
echo count($allometricEquationView_count);
}
else if(isset($allometricEquationDatagrid))
{
echo count($allometricEquationDatagrid);
}
else if(isset($allometricEquationDatagridMap))
{
echo count($allometricEquationDatagridMap);
}
else
{
echo $this->db->count_all_results('ae');
}
?>
</span> </h4>
<br><br>
</div>
<div class="col-lg-6">
<h4> Search criteria</h4>
<p><?php
$keyWord='';
if(isset($_GET['keyword']))
{
$keyWord=$_GET['keyword'];
}
if($keyWord=='')
{
if(!empty($fieldNameValue)){
$n=count($fieldNameValue);
$i=0;
foreach($fieldNameValue as $key=>$value)
{
$pieces = explode("/", $key);
$fieldName= $pieces[0]; // piece1
$keyWord= $pieces[1];
//echo $fieldName;exit;// piece2
if($i<$n-1)
{
$substitute="$keyWord=$value&";
}
else {
$substitute="$keyWord=$value";
}
$sub=str_replace(' ','+',$substitute);
//echo $actualUrl;
$newUrl=str_replace($sub,'',$actualUrl);
// $url=str_replace('','',$actualUrl);
$i++;
echo "<b> $fieldName </b> : $value "."<a href='$newUrl'>Remove Filter</a> <br>";
}
}
else{
echo "No criteria - All results are shown";
}
// echo "<pre>";
// print_r($fieldNameValue);exit();
}
else
{
$url=site_url('data/allometricEquationView');
echo "Keyword: $keyWord <a href='$url'>Remove Filter</a>";
}
?></p>
</div>
</div>
<ul class="nav nav-tabs">
<li class="active"><a data-toggle="tab" class="resultList" href="#results-list"><span class="glyphicon glyphicon-list"></span> Results List</a></li>
<li><a data-toggle="tab" class="results-map" href="#results-map"><span class="glyphicon glyphicon-globe"></span> Map View</a></li>
<div style="float:right;">
<form action='export/' id="export-form" method="POST">
<input type='hidden' name='csrfmiddlewaretoken' value='EUSnAj1qQRRf6anXMDF1cWRSTLAwax2J' />
<input type="hidden" name="query" id="export-query" />
<input type="hidden" name="extension" id="export-extension" />
<div class="btn-group">
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-expanded="false" >
<span class="glyphicon glyphicon-download"></span> Export Results <span class="caret"></span>
</button>
<ul class="dropdown-menu" role="menu">
<?php
if(!isset($string))
{
$string=1;
}
?>
<!-- <li><a href="#" id="export-txt">Download TXT (Tab Delimited UTF-16)</a></li> -->
<li><a href="<?php echo site_url('Portal/allometricEquationViewcsv/'.$string); ?>">Download CSV</a></li>
<li><a href="<?php echo site_url('Portal/allometricEquationViewjson/'.$string); ?>" id="export-json">Download JSON</a></li>
<!-- <li><a href="#" id="export-xml">Download XML</a></li> -->
</ul>
</div>
<form>
</div>
</ul>
<?php
//echo $strs;
//echo $result = mcrypt_ecb (MCRYPT_3DES, 'test', $string, MCRYPT_ENCRYPT);
//echo $string=base64_decode($string);
if(isset($strs))
{
$str=$string;
}
else
{
$str=0;
}
?>
<div class="tab-content">
<div id="results-list" class="tab-pane fade in active ">
<div id="paginationClass">
<table class="table table-striped table-bordered table-hover datatable table-sm common_table" data-source="<?php echo site_url('data/allometricEqnAjaxData/'.$str); ?>" id="">
<thead>
<tr>
<th><center>Allometric Equation Data</center></th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
</div>
<div id="results-map" class="tab-pane fade">
<link rel="stylesheet" href="<?php echo base_url(); ?>resources/js/leaflet/leaflet.css" />
<script src="<?php echo base_url(); ?>resources/js/leaflet/leaflet.js"></script>
<style type="text/css">
#map{ height: 100% }
</style>
</div>
</div>
<div class="row mapBlock" style="display:none">
<div class="col-md-12" style="height:500px!important;width:100%">
<div id="map">
</div>
<script>
// initialize the map
</script>
</div>
</div>
</div>
</div>
</div>
</div>
<script type="text/javascript">
$(document).ready(function(){
var pmId=$("input.pmId").val();
if(pmId>0)
{
var urlTail='?section='+pmId;
}
else
{
var urlTail='';
}
var source_data = $('.common_table').data('source')+urlTail;
// begin second table
oTable2 = $('.common_table').dataTable({
"processing": true,
"serverSide": true,
"searching": false,
"searchable": false,
"pagingType": "full_numbers",
'pageLength': 10,
"aLengthMenu": [
[10, 20,50],
[10, 20,50], // change per page values here
],
// Load data for the table's content from an Ajax source
"ajax": {
//"type": "GET",
"url": source_data,
},
//Set column definition initialisation properties.
"columnDefs": [
{"targets": [0],"orderable": false},
{"targets": [ -1 ], "orderable": false},
{"targets": [ -1 ], "orderable": false}
]
});
});
</script>
<?php
$jsonQuery=str_replace("=","",$jsonQuery);
?>
<script type="text/javascript">
$('#tabs a').click(function (e) {
e.preventDefault();
$(this).tab('show');})
</script>
<script type="text/javascript">
$(document).ready(function(){
$("a.results-map").click(function(){
$("div.mapBlock").show();
var map = new L.Map('map', {center: new L.LatLng(23.8101, 90.4312), zoom: 7});
var osm = new L.TileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png');
map.addLayer(osm);
$.getJSON("<?php echo site_url(); ?>/data/getMapJsonData/<?php echo $jsonQuery; ?>",function(data){
var ratIcon = L.icon({
iconUrl: '<?php echo base_url(); ?>resources/final.png',
iconSize: [19,30]
});
L.geoJson(data,{
pointToLayer: function(feature,latlng){
var marker = L.marker(latlng,{icon: ratIcon});
marker.bindPopup('<h4><b>Allometric Equations : </b>'+feature.properties.total_species+'</h4><h5>Species Represented</h5>'+feature.properties.Species+'<h5>FAO Biomes </h5>'+feature.properties.FAOBiomes+'<h5>Output </h5>'+feature.properties.Output+'<h5>Latitude :'+feature.properties.LatDD+' </h5><h5>Longitude :'+feature.properties.LongDD+' </h5><h5>Location name </h5>'+feature.properties.location_name+' </h5><h5><a href="<?php echo base_url(); ?>index.php/portal/allometricEquationViewMapData/'+feature.properties.LatDD+'/'+feature.properties.LongDD+'">Refine search to view just these records >></a></h5>');
return marker;
}
}).addTo(map);
});
});
});
$("a.resultList").click(function(){
$("div.mapBlock").hide();
});
</script>
<script type="text/javascript">
$(document).on('keypress', '#Genus', function () {
var pattern = /[0-9]+/g;
var id = $(this).attr('id').match(pattern);
$(this).autocomplete({
source: "<?php echo site_url('Portal/get_genus'); ?>",
select: function (event, ui) {
$("#Genus" + id).val(ui.item.id);
}
});
});
$(document).on('keypress', '#Family', function () {
var pattern = /[0-9]+/g;
var id = $(this).attr('id').match(pattern);
$(this).autocomplete({
source: "<?php echo site_url('Portal/get_family'); ?>",
select: function (event, ui) {
$("#Genus" + id).val(ui.item.id);
}
});
});
$(document).on('keypress', '#Species', function () {
var pattern = /[0-9]+/g;
var id = $(this).attr('id').match(pattern);
$(this).autocomplete({
source: "<?php echo site_url('Portal/get_species'); ?>",
select: function (event, ui) {
$("#Species" + id).val(ui.item.id);
}
});
});
$(document).on('keypress', '#District', function () {
var pattern = /[0-9]+/g;
var id = $(this).attr('id').match(pattern);
$(this).autocomplete({
source: "<?php echo site_url('Portal/get_district'); ?>",
select: function (event, ui) {
$("#District" + id).val(ui.item.id);
}
});
});
$(document).on('click', '.btn_remove_class', function () {
var id = $(this).attr('id');
alert(id);
$('.'+id).remove();
$(this).remove();
});
$(document).on('keypress', '#division', function () {
var pattern = /[0-9]+/g;
var id = $(this).attr('id').match(pattern);
$(this).autocomplete({
source: "<?php echo site_url('Portal/get_division'); ?>",
select: function (event, ui) {
$("#division" + id).val(ui.item.id);
}
});
});
$(document).on('keypress', '#ecoZones', function () {
var pattern = /[0-9]+/g;
var id = $(this).attr('id').match(pattern);
$(this).autocomplete({
source: "<?php echo site_url('Portal/get_ecological_zones'); ?>",
select: function (event, ui) {
$("#ecoZones" + id).val(ui.item.id);
}
});
});
$(document).on('keypress', '#reference', function () {
var pattern = /[0-9]+/g;
var id = $(this).attr('id').match(pattern);
$(this).autocomplete({
source: "<?php echo site_url('Portal/get_reference'); ?>",
select: function (event, ui) {
$("#reference" + id).val(ui.item.id);
}
});
});
$(document).on('keypress', '#author', function () {
var pattern = /[0-9]+/g;
var id = $(this).attr('id').match(pattern);
$(this).autocomplete({
source: "<?php echo site_url('Portal/get_author'); ?>",
select: function (event, ui) {
$("#author" + id).val(ui.item.id);
}
});
});
$(document).on('keypress', '#year', function () {
var pattern = /[0-9]+/g;
var id = $(this).attr('id').match(pattern);
$(this).autocomplete({
source: "<?php echo site_url('Portal/get_year'); ?>",
select: function (event, ui) {
$("#year" + id).val(ui.item.id);
}
});
});
</script>
<script type="text/javascript">
$(document).on("click", "input.searchButton", function () {
var sp=$('input.s').val();
var ge=$('input.g').val();
var fa=$('input.f').val();
if(sp!='')
{
var Url='{{url("/view_Demand_Filter/")}}'+'/'+sp;
}
if(ge!='')
{
var Url='{{url("$roleName/view_Demand_Filter/")}}'+'/'+ge;
}
if(fa!='')
{
var Url='{{url("$roleName/view_Demand_Filter/")}}'+'/'+fa;
}
// $.ajax({
// type: "GET",
// url: destination,
// success: function (data) {
// $("div.dmndTbl").html(data);
// }
// });
// alert(Url);
});
</script>
<script>
// Setting default configuration here or you can set through configuration object as seen below
$.fn.select2.defaults = $.extend($.fn.select2.defaults, {
allowClear: true, // Adds X image to clear select
closeOnSelect: true, // Only applies to multiple selects. Closes the select upon selection.
placeholder: 'Select...',
minimumResultsForSearch: 15 // Removes search when there are 15 or fewer options
});
$(document).ready(
function () {
// Single select example if using params obj or configuration seen above
var configParamsObj = {
placeholder: 'Select an option...', // Place holder text to place in the select
minimumResultsForSearch: 3 // Overrides default of 15 set above
};
$(".singleSelectExample").select2(configParamsObj);
});
</script>
<script type="text/javascript">
$(document).ready(function() {
$('#ID_Division').change(function() {
var Division = $(this).val();
//var ID_Division = $(this).val();
//alert(ID_Division);
var url = '<?php echo site_url('Portal/ajax_get_division') ?>';
$.ajax({
type: "POST",
url: url,
data: {Division:Division},
dataType: 'html',
success: function(data) {
$('#ID_District').html(data);
}
});
});
});
$(document).ready(function() {
$('#ID_District').change(function() {
var District = $(this).val();
//alert(District);
var url = '<?php echo site_url('Portal/up_thana_by_dis_id') ?>';
$.ajax({
type: "POST",
url: url,
data: {District:District},
dataType: 'html',
success: function(data) {
$('#THANA_ID').html(data);
}
});
});
});
$(document).ready(function() {
$('#THANA_ID').change(function() {
var THANAME = $(this).val();
//alert(District);
var url = '<?php echo site_url('Portal/up_union_by_dis_id') ?>';
$.ajax({
type: "POST",
url: url,
data: {THANAME:THANAME},
dataType: 'html',
success: function(data) {
$('#union_id').html(data);
}
});
});
});
</script>
<!--<script src="<?php echo base_url(); ?>resources/resource_potal/assets/js/scripts.js"></script>-->
<script src="<?php echo base_url(); ?>resources/resource_potal/assets/js/jquery.snippet.min.js"></script>
<script src="<?php echo base_url(); ?>resources/resource_potal/assets/js/responsive-tabs.js"></script>
<script src="<?php echo base_url(); ?>resources/resource_potal/assets/js/jquery.easyPaginate.js"></script>
| faobd/forest-inventory | application/views/portal/allometricEquationPage.php | PHP | mit | 39,481 |
package com.eftimoff.empty;
import android.app.Application;
import com.mobilesolutions.lolapi.LolApi;
public class SampleApplication extends Application {
@Override
public void onCreate() {
super.onCreate();
final String apiKey = "1fcc2cda-891d-4042-a454-a61a2c79fa4b";
LolApi.init(apiKey,getApplicationContext());
}
}
| MobileSolution/android-lol-api | sample/src/main/java/com/eftimoff/empty/SampleApplication.java | Java | mit | 359 |
#!/bin/bash
GREEN="\033[0;32m"
CLEAR="\033[0m"
echo -e "\n${GREEN}Running docker-compose down${CLEAR}"
docker-compose down 1>/dev/null
echo -e "\n${GREEN}removing vault files from ./data${CLEAR}"
rm -rf ./data > /dev/null 2>&1 || true
| twiesenthal/vault-examples | down.sh | Shell | mit | 238 |
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("09-PlayWithIntDoubleString")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("09-PlayWithIntDoubleString")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("e6b5fd4f-9762-46bc-b88c-a56e51819e21")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
| glifada/TelerikAcademy | C#-Part1/05. ConditionalStatements/09-PlayWithIntDoubleString/Properties/AssemblyInfo.cs | C# | mit | 1,428 |
---
title: map
date: 2018-09-27
---
# map
## define map
键必须是⽀支持相等运算符 (==、!=) 类型,⽐比如 number、string、 pointer、array、struct,以及对应的 interface。值可以是任意类型,没有限制。
map[KEY]VALUE
### make map
m := make(map[string]int) //使用make创建一个空的map
b := make(map[int]byte); // map 支持动态 allocate 扩容,而普通的slice 则必须指定 len
m["one"] = 1
m["two"] = 2
m["three"] = 3
fmt.Println(m) //输出 map[three:3 two:2 one:1] (顺序在运行时可能不一样)
fmt.Println(len(m)) //输出 3
v := m["two"] //从map里取值
fmt.Println(v) // 输出 2
### init map(可以扩容)
key:int
m1 := map[string]int{"one": 1, "two": 2, "three": 3}
fmt.Println(m1) //输出 map[two:2 three:3 one:1] (顺序在运行时可能不一样)
key 可以是变量
key = "age"
m1 := map[string]int{key: 20}
key:interface
map[string]interface{}{
"a":1,
"k2":"b",
}
struct map:
var m = map[string]Vertex{
"Bell Labs": {40.68433, -74.39967},
"Google": Vertex{37.42202, -122.08408},
}
init with variable key:
type T string
const (
A T = "key1"
B T = "key2"
)
var m = map[T]int{
A:2,
B:3,
}
fmt.Printf("%#v\n", m) //Speak
### multiple map
taskIdMap = append(taskIdMap, map[int64]workflow.TaskID{
eventID: workflow.TaskID{
WorkflowID: wfID,
RunID: *event.DecisionTaskFailedEventAttributes.BaseRunId,
},
})
以上会报:fix warning redundant type from array, slice, or map composite literal (#7106)
应该修改成:
taskIdMap = append(taskIdMap, map[int64]workflow.TaskID{
eventID: {
WorkflowID: wfID,
RunID: *event.DecisionTaskFailedEventAttributes.BaseRunId,
},
})
## nil map(不能扩容)
The `zero` value of a map is `nil`. A `nil` map has no keys, nor can keys be added.
var m map[string]int
fmt.Println(m==nil); //true
fmt.Printf("%#v\n", m) //map[string]int(nil)
m=make(map[string]int)
fmt.Println(m==nil); //false
fmt.Printf("%#v\n", m) // map[string]int{}
下面这种形参,也是nil map
func f()(m map[string]int){
m["a"] = 1 //error
return
}
## map index address
map 只用于:`regular addressable value`类型
https://stackoverflow.com/questions/32751537/why-do-i-get-a-cannot-assign-error-when-setting-value-to-a-struct-as-a-value-i
cannot assign to struct field p["HM"].age in map
//go-lib/map/map-index-address.go
package main
import "fmt"
type Person struct {
name string
age int
}
type People map[string]Person
func main() {
p := make(People)
p["HM"] = Person{"Hank McNamara", 39}
// cannot assign to field p["HM"].age in map
p["HM"].age = p["HM"].age + 1
// 可以用: p["HM"] = p["HM"].incrementAge()
fmt.Printf("age: %d\n", p["HM"].age)
}
go `=`赋值只能用于addressable, 很可惜`p["HM"] is not addressable`.
Each left-hand side operand must be addressable, a map index expression
2种方法是用index address:
1. 用:`map[string]*MyStruct`参与赋值
2. `p["HM"] = p["HM"].incrementAge()`
## add
m["new_key"] = 1
## get
elem := m[key] //key 不存在,默认是0
map[string][]string{}["no_key"] //默认是[]string{}
### test
if elem, exists := m[key]; exists{
}
## delete
允许删除不存在的key 不报错
delete(m, "two")
fmt.Println(m) //输出 map[three:3 one:1]
## foreach
for key := range m1{
fmt.Printf("%s \n", key)
}
for key, val := range m1{
fmt.Printf("%s => %d \n", key, val)
}
}
可以在迭代时安全删除键值。但如果期间有新增操作,那么就不知道会有什么意外了。
m := map[int]string{
0: "a", 1: "a", 2: "a", 3: "a", 4: "a",
5: "a", 6: "a", 7: "a", 8: "a", 9: "a",
}
for k := range m {
m[k+k] = "x"
delete(m, k)
}
//output: map[12:x 16:x 20:x 28:x 36:x]
## update
get的value 是临时复制的,应该
u := m[1] //copy value
u.name = "Tom"
m[1] = u // 替换 value。
或者用指针直接修改
m2 := map[int]*user{
1: &user{"user1"},
}
m2[1].name = "Jack"
# 参考
- 雨痕的golang 笔记第四版 | hilojack/hilojack.github.io | post/go/go-var-map.md | Markdown | mit | 4,550 |
Mean.JS boilerplate app | Drewbie345/mean-memoryKeep | README.md | Markdown | mit | 23 |
<html>
<div class="content-block">
<div class="content-block-title">
<b>Subject</b>
</div>
<div class="list-block">
<ul>
<li>
<div class="item-content">
<div class="item-inner">
<div style="width:83%">
<div>Property Address</div>
<div>
<input id="property-address" class ="text-filled" type="text" placeholder="Address"/>
</div>
</div>
<div style="width:15%">
<div>Unit #</div>
<div>
<input id="unit-number" class="text-number" type="text" placeholder="Number"/>
</div>
</div>
</div>
</div>
</li>
<li>
<div class="item-content">
<div class="item-inner" >
<div style="width:24%">
<div>State</div>
<div>
<select id="state" class="dropdown" >
<option>Select</option>
<option>AL</option>
<option>AK</option>
<option>AZ</option>
<option>AR</option>
<option>CA</option>
<option>CO</option>
<option>CT</option>
<option>DE</option>
<option>FL</option>
<option>GA</option>
<option>HI</option>
<option>ID</option>
<option>IL</option>
<option>IN</option>
<option>IA</option>
<option>KS</option>
<option>KY</option>
<option>LA</option>
<option>ME</option>
<option>MD</option>
<option>MA</option>
<option>MI</option>
<option>MN</option>
<option>MS</option>
<option>MO</option>
<option>MT</option>
<option>NE</option>
<option>NV</option>
<option>NH</option>
<option>NJ</option>
<option>NM</option>
<option>NY</option>
<option>NC</option>
<option>ND</option>
<option>OH</option>
<option>OK</option>
<option>OR</option>
<option>PA</option>
<option>RI</option>
<option>SC</option>
<option>SD</option>
<option>TN</option>
<option>TX</option>
<option>UT</option>
<option>VT</option>
<option>VA</option>
<option>WA</option>
<option>WV</option>
<option>WI</option>
<option>WY</option>
</select>
</div>
</div>
<div style="width:24%">
<div>City</div>
<div>
<input id="city" class="text-filled" type="text" placeholder="City"/>
</div>
</div>
<div style="width:24%">
<div>Zip Code</div>
<div>
<input id="zip" class="text-number" type="text" placeholder="Zip" maxlength="5"/>
</div>
</div>
<div style="width:24%">
<div>County</div>
<div>
<input type="text" id="county" class="text-filled" placeholder="County">
</div>
</div>
</div>
</div>
</li>
<li>
<div class="item-content">
<div class="item-inner" >
<div style="width:49%">
<div>Borrower</div>
<div>
<input id="borrower" class="text-filled" type="text" placeholder="Name"/>
</div>
</div>
<div style="width:49%">
<div>Owner of Public Record</div>
<div>
<input id="owner-of-public-record" class="text-filled" type="text" placeholder="Name"/>
</div>
</div>
</div>
</div>
</li>
<li>
<div class="item-content">
<div class="item-inner">
<div style="width:100%">
<div>Legal Description</div>
<div>
<input id="legal-description" class="text-filled" type="text" placeholder="Description" />
</div>
</div>
</div>
</div>
</li>
<li>
<div class="item-content">
<div class="item-inner">
<div style="width:33%">
<div>Assessor's Parcel #</div>
<div>
<input id="assessors-parcel-num" class="text-number" type="text" placeholder="Assessor's Parcel #"/>
</div>
</div>
<div style="width:33%">
<div>Tax Year</div>
<div>
<select id="tax-year" class="dropdown">
<option>Select</option>
<option>2014</option>
<option>2013</option>
<option>2012</option>
<option>2011</option>
<option>2010</option>
<option>2009</option>
</select>
</div>
</div>
<div style="width:33%">
<div>R.E. Taxes $</div>
<div>
<input id="re-taxes" class="text-number" type="text" placeholder="$$$"/>
</div>
</div>
</div>
</div>
</li>
<li>
<div class="item-content">
<div class="item-inner">
<div style="width:24%">
<div>Project Name</div>
<div>
<input id="project-name" class="text-filled" type="text" placeholder="Name"/>
</div>
</div>
<div style="width:24%">
<div>Phase #</div>
<div>
<input id="phase-number" class="text-number" type="text" placeholder="Number"/>
</div>
</div>
<div style="width:24%">
<div>Map Reference</div>
<div>
<input id="map-reference" class="text-filled" type="text" placeholder="Reference"/>
</div>
</div>
<div style="width:24%">
<div>Census Tract</div>
<div>
<input id="census-tract" class="text-filled" type="text" placeholder="Tract"/>
</div>
</div>
</div>
</div>
</li>
<li>
<div class="item-content">
<div class="item-inner">
<div style="width:39%">
<div>Occupant</div>
<div>
<select id="occupant" class="dropdown">
<option>Select</option>
<option>Occupant</option>
<option>Tenant</option>
<option>Vacant</option>
</select>
</div>
</div>
<div style="width:19%">
<div>Special Assessments $</div>
<div>
<input id="special-assessment" class="text-filled" type="text" placeholder="Special Assessment"/>
</div>
</div>
<div style="width:19%">
<div>HOA $</div>
<div>
<input id="hoa-money" class="text-number" type="text" placeholder="$$$"/>
</div>
</div>
<div style="width:10%">
<div> </div>
<div>
<select id="assessment-time" class="dropdown">
<option>Select</option>
<option>Per Year</option>
<option>Per Month</option>
</select>
</div>
</div>
</div>
</div>
</li>
<li>
<div class="item-content">
<div class="item-inner">
<div style="width:49%">
<div>Property Rights Appraised</div>
<div>
<select id="property-rights-appraised" class="dropdown">
<option>Select</option>
<option>Fee Simple</option>
<option>Leasehold</option>
<option>Other (describe)</option>
</select>
</div>
</div>
<div style="width:49%">
<div> </div>
<div>
<input type="text" class="text-filled" placeholder="Other"/>
</div>
</div>
</div>
</div>
</li>
<li>
<div class="item-content">
<div class="item-inner">
<div style="width:49%">
<div>Assignment Type</div>
<div>
<select id="assignment-type" class="dropdown">
<option>Select</option>
<option>Purchase Transaction</option>
<option>Refinance Transaction</option>
<option>Other (describe)</option>
</select>
</div>
</div>
<div style="width:49%">
<div> </div>
<div>
<input type="text" class="text-filled" placeholder="Other"/>
</div>
</div>
</div>
</div>
</li>
<li>
<div class="item-content">
<div class="item-inner">
<div style="width:49%">
<div>Lender/Client</div>
<div>
<input id="lender-client" class="text-filled" type="text" placeholder="Lender/ClientName"/>
</div>
</div>
<div style="width:49%">
<div>Address</div>
<div>
<input id="address" class="text-filled" type="text" placeholder="Address"/>
</div>
</div>
</div>
</div>
</li>
<li>
<div class="item-content">
<div class="item-inner">
<div style="width:80%;">Is the subject property currently offered for sale or has it been offered for sale in the twelve months prior to the effective date of this appraisal?</div>
<div style="width:20%;">
<select id="currently-offered" class="dropdown">
<option>Select</option>
<option>Yes</option>
<option>No</option>
</select>
</div>
</div>
</div>
</li>
<li>
<div class="item-content">
<div class="item-inner">
<div style="width:40%;">Report data source(s) used, offering price(s), and date(s).</div>
<div style="width:60%;">
<input id="data-source-offer-price" class="text-filled" type="text" placeholder="Data"/>
</div>
</div>
</div>
</li>
</ul>
</div>
</div>
</html> | somenathghosh/Appraisal-App | Apprasial-App/1075/1075-subject.html | HTML | mit | 12,171 |
class RecordObserver < ActiveRecord::Observer
def after_create(record)
if record.plan.present?
record.plan.update_attribute(:is_done, true)
end
end
def after_destroy(record)
if record.plan.present?
record.plan.update_attribute(:is_done, false)
end
end
end
| arailser/igeey.com | app/models/record_observer.rb | Ruby | mit | 293 |
var moduleDeps = require('module-deps')
var resolve = require('resolve')
var through = require('through2')
var sort = require('sort-stream')
var deterministic = require('./deterministic')
var pack = require('./pack')
var path = require('path')
var fs = require('fs')
function exists (p) {
try {
(fs.accessSync || fs.statSync)(p)
return true
} catch (err) {
console.error('not found', p, err)
return false
}
}
function pkgRoot (file) {
var dir = path.dirname(file)
, prev
while (true) {
if (exists(path.join(dir, 'package.json')) || exists(path.join(dir, 'node_modules')))
return dir
if (prev === dir) {
throw new Error('Could not find module root for ' + file)
}
prev = dir
dir = path.join(dir, '..')
}
}
function createDepStream(opts) {
return moduleDeps({
ignoreMissing: opts.ignoreMissing,
filter: function (s) {
return (!~opts.filter.indexOf(s)) && opts.replace[s] !== false
},
resolve: function (required, module, cb) {
if(opts.replace && opts.replace[required]) {
required = opts.replace[required]
}
if(opts.replace[required] === false) throw new Error('should not resolve:'+required)
return resolve (required, {
basedir: path.dirname(module.filename),
extensions: ['.js', '.json', '.node']
},
function (err, file) {
if(err) return cb (err)
if (file) {
if (file[0] !== '/') {
var c = required.split('/')[0]
if (c[0] !== '.') console.error('missing dependency. need to install:', c)
} else if (file && file.substr(-5) === '.node') {
opts.replace[required] = path.relative(path.dirname(opts.entry), file)
return cb(null, null)
}
}
cb(null, /^\//.test(file) ? file : null)
})
},
postFilter: function (id, file, pkg) {
if(/\.node$/.test(id)) console.error(id, file)
return file || !(/\.node$/.test(id))
}
})
.on('data', function (e) {
e.id = path.relative(process.cwd(), e.id)
e.source = e.source.replace(/^\s*#![^\n]*/, '\n')
try {
JSON.parse(e.source)
e.source = 'module.exports = ' + e.source
} catch (e) { }
for(var k in e.deps) {
if(!e.deps[k])
delete e.deps[k]
else
e.deps[k] = path.relative(process.cwd(), e.deps[k])
}
})
}
module.exports = function (opts, cb) {
var deps = createDepStream(opts)
deps
.pipe(deterministic(function (err, content, deps, entry) {
if(err) cb(err)
else cb(null,
(opts.shebang !== false ? '#! /usr/bin/env node\n' : '') +
pack(content, deps, entry)
)
}))
deps.end(opts.entry)
}
| dominictarr/noderify | inject.js | JavaScript | mit | 2,793 |
local t = LoadFont("Common normal")..{
InitCommand=function(self)
self:x(30):zoom(0.3):rotationz(90)
end
}
return t | ca25nada/spawncamping-wallhack | Graphics/StepsDisplayListRow StepsType.lua | Lua | mit | 120 |
namespace Plottable.Plots {
export class StackedBar<X, Y> extends Bar<X, Y> {
private _stackingResult: Utils.Stacking.StackingResult;
private _stackedExtent: number[];
/**
* A StackedBar Plot stacks bars across Datasets based on the primary value of the bars.
* On a vertical StackedBar Plot, the bars with the same X value are stacked.
* On a horizontal StackedBar Plot, the bars with the same Y value are stacked.
*
* @constructor
* @param {Scale} xScale
* @param {Scale} yScale
* @param {string} [orientation="vertical"] One of "vertical"/"horizontal".
*/
constructor(orientation = Bar.ORIENTATION_VERTICAL) {
super(orientation);
this.addClass("stacked-bar-plot");
this._stackingResult = new Utils.Map<Dataset, Utils.Map<string, Utils.Stacking.StackedDatum>>();
this._stackedExtent = [];
}
public x(): Plots.AccessorScaleBinding<X, number>;
public x(x: number | Accessor<number>): this;
public x(x: X | Accessor<X>, xScale: Scale<X, number>): this;
public x(x?: number | Accessor<number> | X | Accessor<X>, xScale?: Scale<X, number>): any {
if (x == null) {
return super.x();
}
if (xScale == null) {
super.x(<number | Accessor<number>> x);
} else {
super.x(<X | Accessor<X>> x, xScale);
}
this._updateStackExtentsAndOffsets();
return this;
}
public y(): Plots.AccessorScaleBinding<Y, number>;
public y(y: number | Accessor<number>): this;
public y(y: Y | Accessor<Y>, yScale: Scale<Y, number>): this;
public y(y?: number | Accessor<number> | Y | Accessor<Y>, yScale?: Scale<Y, number>): any {
if (y == null) {
return super.y();
}
if (yScale == null) {
super.y(<number | Accessor<number>> y);
} else {
super.y(<Y | Accessor<Y>> y, yScale);
}
this._updateStackExtentsAndOffsets();
return this;
}
protected _generateAttrToProjector() {
let attrToProjector = super._generateAttrToProjector();
let valueAttr = this._isVertical ? "y" : "x";
let keyAttr = this._isVertical ? "x" : "y";
let primaryScale: Scale<any, number> = this._isVertical ? this.y().scale : this.x().scale;
let primaryAccessor = this._propertyBindings.get(valueAttr).accessor;
let keyAccessor = this._propertyBindings.get(keyAttr).accessor;
let normalizedKeyAccessor = (datum: any, index: number, dataset: Dataset) => {
return Utils.Stacking.normalizeKey(keyAccessor(datum, index, dataset));
};
let getStart = (d: any, i: number, dataset: Dataset) =>
primaryScale.scale(this._stackingResult.get(dataset).get(normalizedKeyAccessor(d, i, dataset)).offset);
let getEnd = (d: any, i: number, dataset: Dataset) =>
primaryScale.scale(+primaryAccessor(d, i, dataset) +
this._stackingResult.get(dataset).get(normalizedKeyAccessor(d, i, dataset)).offset);
let heightF = (d: any, i: number, dataset: Dataset) => {
return Math.abs(getEnd(d, i, dataset) - getStart(d, i, dataset));
};
attrToProjector[this._isVertical ? "height" : "width"] = heightF;
let attrFunction = (d: any, i: number, dataset: Dataset) =>
+primaryAccessor(d, i, dataset) < 0 ? getStart(d, i, dataset) : getEnd(d, i, dataset);
attrToProjector[valueAttr] = (d: any, i: number, dataset: Dataset) =>
this._isVertical ? attrFunction(d, i, dataset) : attrFunction(d, i, dataset) - heightF(d, i, dataset);
return attrToProjector;
}
protected _onDatasetUpdate() {
this._updateStackExtentsAndOffsets();
super._onDatasetUpdate();
return this;
}
protected _updateExtentsForProperty(property: string) {
super._updateExtentsForProperty(property);
if ((property === "x" || property === "y") && this._projectorsReady()) {
this._updateStackExtentsAndOffsets();
}
}
protected _extentsForProperty(attr: string) {
let primaryAttr = this._isVertical ? "y" : "x";
if (attr === primaryAttr) {
return [this._stackedExtent];
} else {
return super._extentsForProperty(attr);
}
}
private _updateStackExtentsAndOffsets() {
if (!this._projectorsReady()) {
return;
}
let datasets = this.datasets();
let keyAccessor = this._isVertical ? this.x().accessor : this.y().accessor;
let valueAccessor = this._isVertical ? this.y().accessor : this.x().accessor;
let filter = this._filterForProperty(this._isVertical ? "y" : "x");
this._stackingResult = Utils.Stacking.stack(datasets, keyAccessor, valueAccessor);
this._stackedExtent = Utils.Stacking.stackedExtent(this._stackingResult, keyAccessor, filter);
}
}
}
| softwords/plottable | src/plots/stackedBarPlot.ts | TypeScript | mit | 4,820 |
'use strict';
var Router = require('director').Router;
var router = new Router({
'/': require('./tournaments'),
'/tournament/:tournamentId': require('./tournament')
});
router.init('/');
| marcusnielsen/bh-tournament | client/router/index.js | JavaScript | mit | 194 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.9.1"/>
<title>V8 API Reference Guide for node.js v0.0.1 - v0.0.2: Class Members</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
$(document).ready(function() { init_search(); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td style="padding-left: 0.5em;">
<div id="projectname">V8 API Reference Guide for node.js v0.0.1 - v0.0.2
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.9.1 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main Page</span></a></li>
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
<li class="current"><a href="annotated.html"><span>Classes</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
<li><a href="examples.html"><span>Examples</span></a></li>
<li>
<div id="MSearchBox" class="MSearchBoxInactive">
<span class="left">
<img id="MSearchSelect" src="search/mag_sel.png"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
alt=""/>
<input type="text" id="MSearchField" value="Search" accesskey="S"
onfocus="searchBox.OnSearchFieldFocus(true)"
onblur="searchBox.OnSearchFieldFocus(false)"
onkeyup="searchBox.OnSearchFieldChange(event)"/>
</span><span class="right">
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
</span>
</div>
</li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="annotated.html"><span>Class List</span></a></li>
<li><a href="classes.html"><span>Class Index</span></a></li>
<li><a href="hierarchy.html"><span>Class Hierarchy</span></a></li>
<li class="current"><a href="functions.html"><span>Class Members</span></a></li>
</ul>
</div>
<div id="navrow3" class="tabs2">
<ul class="tablist">
<li class="current"><a href="functions.html"><span>All</span></a></li>
<li><a href="functions_func.html"><span>Functions</span></a></li>
<li><a href="functions_type.html"><span>Typedefs</span></a></li>
</ul>
</div>
<div id="navrow4" class="tabs3">
<ul class="tablist">
<li><a href="#index_a"><span>a</span></a></li>
<li><a href="#index_c"><span>c</span></a></li>
<li><a href="#index_d"><span>d</span></a></li>
<li><a href="#index_e"><span>e</span></a></li>
<li><a href="#index_g"><span>g</span></a></li>
<li><a href="#index_h"><span>h</span></a></li>
<li><a href="#index_i"><span>i</span></a></li>
<li><a href="#index_l"><span>l</span></a></li>
<li><a href="#index_m"><span>m</span></a></li>
<li><a href="#index_n"><span>n</span></a></li>
<li><a href="#index_o"><span>o</span></a></li>
<li><a href="#index_p"><span>p</span></a></li>
<li><a href="#index_r"><span>r</span></a></li>
<li><a href="#index_s"><span>s</span></a></li>
<li><a href="#index_t"><span>t</span></a></li>
<li><a href="#index_u"><span>u</span></a></li>
<li><a href="#index_w"><span>w</span></a></li>
<li class="current"><a href="#index_~"><span>~</span></a></li>
</ul>
</div>
</div><!-- top -->
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div class="contents">
<div class="textblock">Here is a list of all documented class members with links to the class documentation for each member:</div>
<h3><a class="anchor" id="index_a"></a>- a -</h3><ul>
<li>AddMessageListener()
: <a class="el" href="classv8_1_1_v8.html#a125dadf8feb6178a42333f2a6412ea73">v8::V8</a>
</li>
<li>AddObjectGroup()
: <a class="el" href="classv8_1_1_v8.html#a4744037e970e3b3bafcc3cac03a5967f">v8::V8</a>
</li>
<li>AdjustAmountOfExternalAllocatedMemory()
: <a class="el" href="classv8_1_1_v8.html#a8e6f2e66c028d1ffa3f5e8a799790bc5">v8::V8</a>
</li>
</ul>
<h3><a class="anchor" id="index_c"></a>- c -</h3><ul>
<li>Call()
: <a class="el" href="classv8_1_1_debug.html#a0e209f780a454d01c08e4a3e378770f9">v8::Debug</a>
</li>
<li>Clear()
: <a class="el" href="classv8_1_1_handle.html#a452516a09df056438c3d3a177ebd1977">v8::Handle< T ></a>
</li>
<li>ClearWeak()
: <a class="el" href="classv8_1_1_persistent.html#a30806c1125371c269a02ec03d47c69ab">v8::Persistent< T ></a>
</li>
<li>Clone()
: <a class="el" href="classv8_1_1_object.html#a5018c9d085aa71f65530cf1e073a04ad">v8::Object</a>
</li>
<li>Close()
: <a class="el" href="classv8_1_1_handle_scope.html#af18b68b6b149e69a05873a20c6fa269c">v8::HandleScope</a>
</li>
<li>Compile()
: <a class="el" href="classv8_1_1_script.html#a9c1a035de382abb86de8468baa62f8ab">v8::Script</a>
</li>
<li>CreateHandle()
: <a class="el" href="classv8_1_1_handle_scope.html#ab3c4482c4e557fdab066c122883df3a5">v8::HandleScope</a>
</li>
</ul>
<h3><a class="anchor" id="index_d"></a>- d -</h3><ul>
<li>data()
: <a class="el" href="classv8_1_1_string_1_1_external_ascii_string_resource.html#adeb99e8c8c630e2dac5ad76476249d2f">v8::String::ExternalAsciiStringResource</a>
, <a class="el" href="classv8_1_1_string_1_1_external_string_resource.html#a987309199b848511adb708e221e0fb0a">v8::String::ExternalStringResource</a>
</li>
<li>DetachGlobal()
: <a class="el" href="classv8_1_1_context.html#a841c7dd92eb8c57df92a268a164dea97">v8::Context</a>
</li>
<li>Dispose()
: <a class="el" href="classv8_1_1_persistent.html#a33e53191844272ba0f2da4f55fc12297">v8::Persistent< T ></a>
, <a class="el" href="classv8_1_1_v8.html#a566450d632c0a63770682b9da3cae08d">v8::V8</a>
</li>
</ul>
<h3><a class="anchor" id="index_e"></a>- e -</h3><ul>
<li>Empty()
: <a class="el" href="classv8_1_1_string.html#a93009e63fb89a2c8264b87ec422af963">v8::String</a>
</li>
<li>EnableAgent()
: <a class="el" href="classv8_1_1_debug.html#a63f491229ef01576bfeb5814e9b14a5e">v8::Debug</a>
</li>
<li>EnableSlidingStateWindow()
: <a class="el" href="classv8_1_1_v8.html#aa91df5fe1bb98b87952ef4bbf0aceb96">v8::V8</a>
</li>
<li>Enter()
: <a class="el" href="classv8_1_1_context.html#a6995c49d9897eb49053f07874b825133">v8::Context</a>
</li>
<li>Equals()
: <a class="el" href="classv8_1_1_value.html#adc2a7a92a120675bbd4c992163a20869">v8::Value</a>
</li>
<li>EventCallback
: <a class="el" href="classv8_1_1_debug.html#a4be52510b70764b730dd1289bd9bbe37">v8::Debug</a>
</li>
<li>Exception()
: <a class="el" href="classv8_1_1_try_catch.html#a99c425f29b3355b4294cbe762377f99b">v8::TryCatch</a>
</li>
<li>Exit()
: <a class="el" href="classv8_1_1_context.html#a2db09d4fefb26023a40d88972a4c1599">v8::Context</a>
</li>
</ul>
<h3><a class="anchor" id="index_g"></a>- g -</h3><ul>
<li>GetClientData()
: <a class="el" href="classv8_1_1_debug_1_1_message.html#ab81bb81d233f5f37e6626a7bcac22142">v8::Debug::Message</a>
</li>
<li>GetCurrent()
: <a class="el" href="classv8_1_1_context.html#aca2df9d70e51f241d733f4ad0eb46401">v8::Context</a>
</li>
<li>GetEndColumn()
: <a class="el" href="classv8_1_1_message.html#aaf82cd7f7449add5f50d4253499cad05">v8::Message</a>
</li>
<li>GetEndPosition()
: <a class="el" href="classv8_1_1_message.html#a50cbec87379e628b1647466926882037">v8::Message</a>
</li>
<li>GetEntered()
: <a class="el" href="classv8_1_1_context.html#accfc7365efba8bce18cbf9df1c1fc79d">v8::Context</a>
</li>
<li>GetEventContext()
: <a class="el" href="classv8_1_1_debug_1_1_message.html#a34ff90d879888746a7a0eacebd6aa088">v8::Debug::Message</a>
</li>
<li>GetExecutionState()
: <a class="el" href="classv8_1_1_debug_1_1_message.html#aa54e11b06d304e8b8f34cc79ee49d869">v8::Debug::Message</a>
</li>
<li>GetExternalAsciiStringResource()
: <a class="el" href="classv8_1_1_string.html#a18c79a15ed843c9f521dc94765a373ea">v8::String</a>
</li>
<li>GetExternalStringResource()
: <a class="el" href="classv8_1_1_string.html#a88a04df453d4f0ed68f2e22922d48dcf">v8::String</a>
</li>
<li>GetFunction()
: <a class="el" href="classv8_1_1_function_template.html#a3b8e5e214b2ee34c36138961ebac696a">v8::FunctionTemplate</a>
</li>
<li>GetIdentityHash()
: <a class="el" href="classv8_1_1_object.html#ac1ece41e81a499920ec3a2a3471653bc">v8::Object</a>
</li>
<li>GetInternalField()
: <a class="el" href="classv8_1_1_object.html#a99c6d30058de4b6e02ba3df8d328a059">v8::Object</a>
</li>
<li>GetJSON()
: <a class="el" href="classv8_1_1_debug_1_1_message.html#a41076f64f82c927cbb2fe5c8325557d5">v8::Debug::Message</a>
</li>
<li>GetLineNumber()
: <a class="el" href="classv8_1_1_message.html#a67f97fd76b8f98ed65743b9615d64a79">v8::Message</a>
</li>
<li>GetLogLines()
: <a class="el" href="classv8_1_1_v8.html#ac7e91e25ed7773db1f31413fb726bca7">v8::V8</a>
</li>
<li>GetPropertyNames()
: <a class="el" href="classv8_1_1_object.html#a9f45786246c6e6027b32f685d900a41f">v8::Object</a>
</li>
<li>GetPrototype()
: <a class="el" href="classv8_1_1_object.html#ae8d3fed7d6dbd667c29cabb3039fe7af">v8::Object</a>
</li>
<li>GetRealNamedPropertyInPrototypeChain()
: <a class="el" href="classv8_1_1_object.html#abcede2bb76c86c5071314ffb340cf68c">v8::Object</a>
</li>
<li>GetScriptData()
: <a class="el" href="classv8_1_1_message.html#ace10c210ccbb542b1b75cadefbc4e899">v8::Message</a>
</li>
<li>GetScriptResourceName()
: <a class="el" href="classv8_1_1_message.html#ac5d31afb758897cd1653c5eb3327a4d6">v8::Message</a>
</li>
<li>GetSecurityToken()
: <a class="el" href="classv8_1_1_context.html#a8e71e658633518ca7718c0f6e938c6a9">v8::Context</a>
</li>
<li>GetStartColumn()
: <a class="el" href="classv8_1_1_message.html#aab8007ba81d3f195280bce0693810cc2">v8::Message</a>
</li>
<li>GetStartPosition()
: <a class="el" href="classv8_1_1_message.html#a31a550a1d3d09a2d72d0742be821956f">v8::Message</a>
</li>
<li>GetVersion()
: <a class="el" href="classv8_1_1_v8.html#afcecc0e9e8b5fa17a06a93f7b5a7538d">v8::V8</a>
</li>
<li>Global()
: <a class="el" href="classv8_1_1_context.html#af5cd9f97ef6a3307c1c21f80f4b743eb">v8::Context</a>
</li>
</ul>
<h3><a class="anchor" id="index_h"></a>- h -</h3><ul>
<li>Handle()
: <a class="el" href="classv8_1_1_handle.html#aa7543a3d572565806a66e922634cc2f4">v8::Handle< T ></a>
</li>
<li>HasCaught()
: <a class="el" href="classv8_1_1_try_catch.html#a48f704fbf2b82564b5d2a4ff596e4137">v8::TryCatch</a>
</li>
<li>HasIndexedLookupInterceptor()
: <a class="el" href="classv8_1_1_object.html#a278913bcd203434870ce5184a538a9af">v8::Object</a>
</li>
<li>HasInstance()
: <a class="el" href="classv8_1_1_function_template.html#aa883e4ab6643498662f7873506098c98">v8::FunctionTemplate</a>
</li>
<li>HasNamedLookupInterceptor()
: <a class="el" href="classv8_1_1_object.html#a1e96fcb9ee17101c0299ec68f2cf8610">v8::Object</a>
</li>
<li>HasOutOfMemoryException()
: <a class="el" href="classv8_1_1_context.html#aadec400a5da1e79e58a8770fd706b9a0">v8::Context</a>
</li>
<li>HostDispatchHandler
: <a class="el" href="classv8_1_1_debug.html#a442f686afe7d80928b57b3ff8ac3f6e7">v8::Debug</a>
</li>
</ul>
<h3><a class="anchor" id="index_i"></a>- i -</h3><ul>
<li>Id()
: <a class="el" href="classv8_1_1_script.html#aa25adfbb98af9179b4891e09432c2916">v8::Script</a>
</li>
<li>IgnoreOutOfMemoryException()
: <a class="el" href="classv8_1_1_v8.html#a1058ff39b32a17976df1e2b75c3d1cb4">v8::V8</a>
</li>
<li>InContext()
: <a class="el" href="classv8_1_1_context.html#a5cf983417f9cfc6e1dd9228eccb78d31">v8::Context</a>
</li>
<li>Inherit()
: <a class="el" href="classv8_1_1_function_template.html#a18f343e7e5749ed886d6e76a1424216e">v8::FunctionTemplate</a>
</li>
<li>Initialize()
: <a class="el" href="classv8_1_1_v8.html#a40daec93ce44bdd922567fc121be9db8">v8::V8</a>
</li>
<li>InstanceTemplate()
: <a class="el" href="classv8_1_1_function_template.html#a00dd9725566908e8fd14064542f5a781">v8::FunctionTemplate</a>
</li>
<li>InternalFieldCount()
: <a class="el" href="classv8_1_1_object.html#aaec28576353eebe6fee113bce2718ecc">v8::Object</a>
, <a class="el" href="classv8_1_1_object_template.html#a43de785d594d8c01b18230b1aa79e31c">v8::ObjectTemplate</a>
</li>
<li>IsActive()
: <a class="el" href="classv8_1_1_locker.html#a19d2b640f2f9b3dd0ec3a6c09a0442ed">v8::Locker</a>
</li>
<li>IsArray()
: <a class="el" href="classv8_1_1_value.html#aaee0b144087d20eae02314c9393ff80f">v8::Value</a>
</li>
<li>IsBoolean()
: <a class="el" href="classv8_1_1_value.html#a0aceb7645e71b096df5cd73d1252b1b0">v8::Value</a>
</li>
<li>IsDate()
: <a class="el" href="classv8_1_1_value.html#a8bc11fab0aded4a805722ab6df173cae">v8::Value</a>
</li>
<li>IsDead()
: <a class="el" href="classv8_1_1_v8.html#a0d5593ecf0d41035e4d9ee512119f0b7">v8::V8</a>
</li>
<li>IsEmpty()
: <a class="el" href="classv8_1_1_handle.html#ab3b20b28e7f672de83a2dc8d6809f815">v8::Handle< T ></a>
</li>
<li>IsEvent()
: <a class="el" href="classv8_1_1_debug_1_1_message.html#a36ade83a9c960ce581b1a4051f763785">v8::Debug::Message</a>
</li>
<li>IsExternal()
: <a class="el" href="classv8_1_1_string.html#abbf623aabba9446cd57af14018877398">v8::String</a>
, <a class="el" href="classv8_1_1_value.html#a7ac61a325c18af8dcb6d7d5bf47d2503">v8::Value</a>
</li>
<li>IsExternalAscii()
: <a class="el" href="classv8_1_1_string.html#a470adeefeeb419860d4e069714fed42e">v8::String</a>
</li>
<li>IsFalse()
: <a class="el" href="classv8_1_1_value.html#a68c0296071d01ca899825d7643cf495a">v8::Value</a>
</li>
<li>IsFunction()
: <a class="el" href="classv8_1_1_value.html#a05532a34cdd215f273163830ed8b77e7">v8::Value</a>
</li>
<li>IsInt32()
: <a class="el" href="classv8_1_1_value.html#a01e1db51c65b2feace248b7acbf71a2c">v8::Value</a>
</li>
<li>IsLocked()
: <a class="el" href="classv8_1_1_locker.html#ae42d6fa84c0b22bcff748b26ef83db5f">v8::Locker</a>
</li>
<li>IsNearDeath()
: <a class="el" href="classv8_1_1_persistent.html#a1f60b982c5e734df7e4fe22ccd5b62cf">v8::Persistent< T ></a>
</li>
<li>IsNull()
: <a class="el" href="classv8_1_1_value.html#aa2c6ed8ef832223a7e2cd81e6ac61c78">v8::Value</a>
</li>
<li>IsNumber()
: <a class="el" href="classv8_1_1_value.html#a1bd51e3e55f67c65b9a8f587fbffb7c7">v8::Value</a>
</li>
<li>IsObject()
: <a class="el" href="classv8_1_1_value.html#a355b7991c5c978c0341f6f961b63c5a2">v8::Value</a>
</li>
<li>IsString()
: <a class="el" href="classv8_1_1_value.html#ab23a34b7df62806808e01b0908bf5f00">v8::Value</a>
</li>
<li>IsTrue()
: <a class="el" href="classv8_1_1_value.html#a8f27462322186b295195eecb3e81d6d7">v8::Value</a>
</li>
<li>IsUndefined()
: <a class="el" href="classv8_1_1_value.html#aea287b745656baa8a12a2ae1d69744b6">v8::Value</a>
</li>
<li>IsWeak()
: <a class="el" href="classv8_1_1_persistent.html#aa636a55b81eee222f86866dd5ae8c06f">v8::Persistent< T ></a>
</li>
</ul>
<h3><a class="anchor" id="index_l"></a>- l -</h3><ul>
<li>length()
: <a class="el" href="classv8_1_1_string_1_1_external_ascii_string_resource.html#aeecccc52434c2057d3dc5c9732458a8e">v8::String::ExternalAsciiStringResource</a>
, <a class="el" href="classv8_1_1_string_1_1_external_string_resource.html#ab5ca300fea077d7c7774ec49d32e4da1">v8::String::ExternalStringResource</a>
</li>
<li>Length()
: <a class="el" href="classv8_1_1_string.html#a94353cd764d2bf0cda141714c3c9eb6c">v8::String</a>
</li>
<li>Local()
: <a class="el" href="classv8_1_1_local.html#af7cf8d2fe7e10a14ad382189712adaff">v8::Local< T ></a>
</li>
</ul>
<h3><a class="anchor" id="index_m"></a>- m -</h3><ul>
<li>MakeExternal()
: <a class="el" href="classv8_1_1_string.html#a5efd1eba40c1fa8a6aae2c4a175a63be">v8::String</a>
</li>
<li>MakeWeak()
: <a class="el" href="classv8_1_1_persistent.html#ab04609812113450bece2640ad0b27658">v8::Persistent< T ></a>
</li>
<li>MarkAsUndetectable()
: <a class="el" href="classv8_1_1_object_template.html#a7e40ef313b44c2ad336c73051523b4f8">v8::ObjectTemplate</a>
</li>
<li>Message()
: <a class="el" href="classv8_1_1_try_catch.html#a2811e500fbb906ee505895a3d94fc66f">v8::TryCatch</a>
</li>
<li>MessageHandler
: <a class="el" href="classv8_1_1_debug.html#aea5c8ab838a3b3c263a71828fb0767ac">v8::Debug</a>
</li>
<li>MessageHandler2
: <a class="el" href="classv8_1_1_debug.html#a0fb8f7e1f8fa47cb23f7ad72cd533c77">v8::Debug</a>
</li>
</ul>
<h3><a class="anchor" id="index_n"></a>- n -</h3><ul>
<li>New()
: <a class="el" href="classv8_1_1_context.html#af4ea79b695e75849211ae26e28f8b517">v8::Context</a>
, <a class="el" href="classv8_1_1_function_template.html#af9012aee4a102c4018fec8e9532cb996">v8::FunctionTemplate</a>
, <a class="el" href="classv8_1_1_local.html#ac4024a7e2aea140c6aaa38fc32d5a840">v8::Local< T ></a>
, <a class="el" href="classv8_1_1_object_template.html#a394801526a9e9eb6df349a0eb8dfa0d0">v8::ObjectTemplate</a>
, <a class="el" href="classv8_1_1_persistent.html#ad309269ccaeffa6dec338093752ca539">v8::Persistent< T ></a>
, <a class="el" href="classv8_1_1_string.html#a974c70e8e7ee9c36d064555953fc9a6d">v8::String</a>
</li>
<li>NewExternal()
: <a class="el" href="classv8_1_1_string.html#a5b98a12b3c09f22597d2ff3f9c9f2f2d">v8::String</a>
</li>
<li>NewInstance()
: <a class="el" href="classv8_1_1_object_template.html#ad25d8ebf37b1a3aaf7d4a03b1a9bd5c1">v8::ObjectTemplate</a>
</li>
<li>NewSymbol()
: <a class="el" href="classv8_1_1_string.html#ad190aa56ee2e94a429df13c84b19f025">v8::String</a>
</li>
<li>NewUndetectable()
: <a class="el" href="classv8_1_1_string.html#a28dc24076f4954a1dba0d70a6ecb0b04">v8::String</a>
</li>
<li>NumberOfHandles()
: <a class="el" href="classv8_1_1_handle_scope.html#abb2d32a75b0468885b7340404050604b">v8::HandleScope</a>
</li>
<li>NumberValue()
: <a class="el" href="classv8_1_1_date.html#a00ae69718a3810d82ae0b54b28d53512">v8::Date</a>
</li>
</ul>
<h3><a class="anchor" id="index_o"></a>- o -</h3><ul>
<li>ObjectProtoToString()
: <a class="el" href="classv8_1_1_object.html#aeb2f524c806075e5f9032a24afd86869">v8::Object</a>
</li>
<li>operator!=()
: <a class="el" href="classv8_1_1_handle.html#ab550353b4a7bc3ad3df53fe80df7ea61">v8::Handle< T ></a>
</li>
<li>operator==()
: <a class="el" href="classv8_1_1_handle.html#afcc79738c6fff05c70e958a471f2b7d9">v8::Handle< T ></a>
</li>
</ul>
<h3><a class="anchor" id="index_p"></a>- p -</h3><ul>
<li>PauseProfiler()
: <a class="el" href="classv8_1_1_v8.html#a5fefebea0cd37105837a9d267baf2e5c">v8::V8</a>
</li>
<li>Persistent()
: <a class="el" href="classv8_1_1_persistent.html#aff7516636baaf209885220f7cff34463">v8::Persistent< T ></a>
</li>
<li>PrototypeTemplate()
: <a class="el" href="classv8_1_1_function_template.html#aa2bcc2652b5f0fdbc666d943ccf72021">v8::FunctionTemplate</a>
</li>
</ul>
<h3><a class="anchor" id="index_r"></a>- r -</h3><ul>
<li>RemoveMessageListeners()
: <a class="el" href="classv8_1_1_v8.html#a024f57744e8dfdcb2ea1417024b4805c">v8::V8</a>
</li>
<li>Reset()
: <a class="el" href="classv8_1_1_try_catch.html#a3aae8acab4c99b374b7d782763d4c8e1">v8::TryCatch</a>
</li>
<li>ResumeProfiler()
: <a class="el" href="classv8_1_1_v8.html#ab0557aaba62c7fb253fe838003aa60af">v8::V8</a>
</li>
<li>Run()
: <a class="el" href="classv8_1_1_script.html#a5f43b29d40bd51ebad2cc275ba3898a1">v8::Script</a>
</li>
</ul>
<h3><a class="anchor" id="index_s"></a>- s -</h3><ul>
<li>Set()
: <a class="el" href="classv8_1_1_template.html#a8a29557db5d0bc980752084b925a9b01">v8::Template</a>
</li>
<li>SetAccessCheckCallbacks()
: <a class="el" href="classv8_1_1_object_template.html#acd0c47ecc715fa1256dc95524a4e8608">v8::ObjectTemplate</a>
</li>
<li>SetAccessor()
: <a class="el" href="classv8_1_1_object_template.html#a944ce96b6b65d571f8d682407b70d484">v8::ObjectTemplate</a>
</li>
<li>SetCallAsFunctionHandler()
: <a class="el" href="classv8_1_1_object_template.html#a0132c34bbb52a69d13c54bf325effe6e">v8::ObjectTemplate</a>
</li>
<li>SetCallHandler()
: <a class="el" href="classv8_1_1_function_template.html#a9eb1c827b17faf398a81068721bf40ab">v8::FunctionTemplate</a>
</li>
<li>SetCaptureMessage()
: <a class="el" href="classv8_1_1_try_catch.html#a541b8fa6951bd5a439692c22d5c7b73c">v8::TryCatch</a>
</li>
<li>SetClassName()
: <a class="el" href="classv8_1_1_function_template.html#a10ad6f0d3d1f67823e08fbca7c5dde41">v8::FunctionTemplate</a>
</li>
<li>SetCounterFunction()
: <a class="el" href="classv8_1_1_v8.html#a830d3ba2704b6e7c361188b22318c0be">v8::V8</a>
</li>
<li>SetCreateHistogramFunction()
: <a class="el" href="classv8_1_1_v8.html#ac4db0dff0f29c750d30fcac65c4d1968">v8::V8</a>
</li>
<li>SetData()
: <a class="el" href="classv8_1_1_context.html#a5121f42bf87ec10563e687761e750f53">v8::Context</a>
, <a class="el" href="classv8_1_1_script.html#a92d2d9fe3ce03316fc1433b6e4368b5d">v8::Script</a>
</li>
<li>SetFailedAccessCheckCallbackFunction()
: <a class="el" href="classv8_1_1_v8.html#aa6ed646d43360c209881871b3ac747aa">v8::V8</a>
</li>
<li>SetFatalErrorHandler()
: <a class="el" href="classv8_1_1_v8.html#ab386f81a6d58dcf481d00446e8d15c9e">v8::V8</a>
</li>
<li>SetFlagsFromCommandLine()
: <a class="el" href="classv8_1_1_v8.html#a63157ad9284ffad1c0ab62b21aadd08c">v8::V8</a>
</li>
<li>SetFlagsFromString()
: <a class="el" href="classv8_1_1_v8.html#ab263a85e6f97ea79d944bd20bb09a95f">v8::V8</a>
</li>
<li>SetGlobalGCEpilogueCallback()
: <a class="el" href="classv8_1_1_v8.html#a94bac5e06a99141c5629842e18558cfe">v8::V8</a>
</li>
<li>SetGlobalGCPrologueCallback()
: <a class="el" href="classv8_1_1_v8.html#a503e14a77e922775bd88bc2e19e19886">v8::V8</a>
</li>
<li>SetHiddenPrototype()
: <a class="el" href="classv8_1_1_function_template.html#ade426e8a21d777ae6100e6c1aa7bfaee">v8::FunctionTemplate</a>
</li>
<li>SetHiddenValue()
: <a class="el" href="classv8_1_1_object.html#a2200482b09feb914dc91d8256671f7f0">v8::Object</a>
</li>
<li>SetIndexedPropertyHandler()
: <a class="el" href="classv8_1_1_object_template.html#af436aeb8132068d3678246f31515ff5a">v8::ObjectTemplate</a>
</li>
<li>SetInternalField()
: <a class="el" href="classv8_1_1_object.html#a361b1781e7db29b17b063ef31315989e">v8::Object</a>
</li>
<li>SetInternalFieldCount()
: <a class="el" href="classv8_1_1_object_template.html#ab63916ac584a76bca8ba541f86ce9fce">v8::ObjectTemplate</a>
</li>
<li>SetNamedPropertyHandler()
: <a class="el" href="classv8_1_1_object_template.html#aa80e9db593d8b954c4153082dc7a439d">v8::ObjectTemplate</a>
</li>
<li>SetSecurityToken()
: <a class="el" href="classv8_1_1_context.html#a288d8549547f6bdf4312f5333f60f24d">v8::Context</a>
</li>
<li>SetVerbose()
: <a class="el" href="classv8_1_1_try_catch.html#a032cd889d76bd596e2616df11ced8682">v8::TryCatch</a>
</li>
<li>StartPreemption()
: <a class="el" href="classv8_1_1_locker.html#a272bf054bb4d8bb51b0101ba7bf3456f">v8::Locker</a>
</li>
<li>StopPreemption()
: <a class="el" href="classv8_1_1_locker.html#ab79915454872612692808fea64f539ec">v8::Locker</a>
</li>
</ul>
<h3><a class="anchor" id="index_t"></a>- t -</h3><ul>
<li>ToArrayIndex()
: <a class="el" href="classv8_1_1_value.html#ae810be0ae81a87f677592d0176daac48">v8::Value</a>
</li>
<li>TryCatch()
: <a class="el" href="classv8_1_1_try_catch.html#adc9b1b11e73b0325df727914c348053d">v8::TryCatch</a>
</li>
<li>TurnOnAccessCheck()
: <a class="el" href="classv8_1_1_object.html#a6e9fe342c0f77995defa6b479d01a3bd">v8::Object</a>
</li>
</ul>
<h3><a class="anchor" id="index_u"></a>- u -</h3><ul>
<li>UseDefaultSecurityToken()
: <a class="el" href="classv8_1_1_context.html#aa9e1a14982b64fd51ab87600a287bad2">v8::Context</a>
</li>
<li>Utf8Length()
: <a class="el" href="classv8_1_1_string.html#afb2bb302d3ffe807e66a0797d6ac4189">v8::String</a>
</li>
</ul>
<h3><a class="anchor" id="index_w"></a>- w -</h3><ul>
<li>WillStartRunning()
: <a class="el" href="classv8_1_1_debug_1_1_message.html#af8d236b6a334423732a38cbf8cfd7aef">v8::Debug::Message</a>
</li>
<li>Write()
: <a class="el" href="classv8_1_1_string.html#aebb106cdacfe0eff1be6e51b5d7342e5">v8::String</a>
</li>
</ul>
<h3><a class="anchor" id="index_~"></a>- ~ -</h3><ul>
<li>~ExternalAsciiStringResource()
: <a class="el" href="classv8_1_1_string_1_1_external_ascii_string_resource.html#acd8790ae14be1b90794b363d24a147d0">v8::String::ExternalAsciiStringResource</a>
</li>
<li>~ExternalStringResource()
: <a class="el" href="classv8_1_1_string_1_1_external_string_resource.html#a6b7ef9e33a47059092e1447b10c35416">v8::String::ExternalStringResource</a>
</li>
<li>~TryCatch()
: <a class="el" href="classv8_1_1_try_catch.html#a2c9ad4b40d17dd31c6dd020736b30679">v8::TryCatch</a>
</li>
</ul>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Tue Aug 11 2015 23:44:03 for V8 API Reference Guide for node.js v0.0.1 - v0.0.2 by  <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.9.1
</small></address>
</body>
</html>
| v8-dox/v8-dox.github.io | a3627c0/html/functions.html | HTML | mit | 26,019 |
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>br (RobotsDotText::RobotsFile)</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
</head>
<body class="standalone-code">
<pre><span class="ruby-comment cmt"># File lib/robots_dot_text.rb, line 59</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">br</span>
<span class="ruby-identifier">line_break</span>
<span class="ruby-keyword kw">end</span></pre>
</body>
</html> | albertobraschi/robots_dot_text | doc/classes/RobotsDotText/RobotsFile.src/M000012.html | HTML | mit | 737 |
export interface SequelizeStoreOptions {
expiration: number;
updateFrequency: number;
}
export interface NewSessionRecord {
user: string | undefined;
expires: Date;
}
export interface SessionRecord extends NewSessionRecord {
sid: string;
}
export interface SequelizeSessionRecord extends SessionRecord {
destroy: any;
save: any;
}
export interface ExpressCookie {
expires: Date;
}
export interface ExpressSession {
cookie: ExpressCookie;
}
export declare type SimpleCallback = (error: Error) => void;
export declare class SequelizeStore {
options: SequelizeStoreOptions;
sessionModel: any;
expirationCron: any;
constructor(sessionModel: any, options: SequelizeStoreOptions);
private deleteExpiredSessions(callback);
startSessionCron(): void;
stopSessionCron(): void;
private determineExpiration(cookie);
clear(callback: SimpleCallback): any;
destroySession(sid: string, callback: SimpleCallback): any;
get(sid: string, callback: (error: Error, session: any) => void): Promise<SessionRecord | undefined>;
length(callback: SimpleCallback): any;
set(sid: string, data: ExpressSession, callback: SimpleCallback): Promise<any>;
touchSession(sid: string, data: ExpressSession, callback: SimpleCallback): any;
}
| vineyard-bloom/vineyard-users | src/session-store.d.ts | TypeScript | mit | 1,297 |
//---------------------------------------------------------------------------
//
// <copyright file=HighlightLayer.cs company=Microsoft>
// Copyright (C) Microsoft Corporation. All rights reserved.
// </copyright>
//
//
// Description: HighlightLayer.Changed event handler.
//
// History:
// 07/01/2004 : benwest - Created
//
//---------------------------------------------------------------------------
using System.Collections;
namespace System.Windows.Documents
{
/// <summary>
/// HighlightLayer.Changed event handler.
/// </summary>
internal delegate void HighlightChangedEventHandler(object sender, HighlightChangedEventArgs args);
}
| mind0n/hive | Cache/Libs/net46/wpf/src/Framework/System/Windows/Documents/HighlightChangedEventHandler.cs | C# | mit | 670 |
module.exports = angular => {
const ngModule = angular
.module('da.desktop.familyTree', []);
require('./familyTree.directive')(ngModule);
return ngModule;
};
| Jonathan-Law/fhd | src/desktop/components/individual/familyTree/index.js | JavaScript | mit | 169 |
//
// SenateXMLParserDelegate.h
// Core Data Generator
//
// Created by Christopher Febles on 3/5/13.
// Copyright (c) 2013 Christopher Febles. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <CoreData/CoreData.h>
#import "Senator.h"
@interface SenateXMLParserDelegate : NSObject <NSXMLParserDelegate> {
Senator *member;
NSMutableArray *senators;
NSString *elementValue;
}
@property (nonatomic, retain) Senator *member;
@property (nonatomic, retain) NSMutableArray *senators;
@property (nonatomic, retain) NSString *elementValue;
@end
| christopherfebles/Congress | CongressCards/SenateXMLParserDelegate.h | C | mit | 573 |
define(['lib/jquery', 'lib/underscore', 'lib/chartjs',
'js/views/chart/chart.view'],
function($, _, Chart, ChartView){
var JobsVsJavaScriptLibrariesView = ChartView.extend({
initialize: function(options) {
options = options || {};
options.data = options.data || {};
options.data = {
'card-icon': options.data.icon || 'fa fa-bar-chart',
'title': options.data.title || 'Most Popular JavaScript Libraries/Frameworks'
};
ChartView.prototype.initialize.apply(this, [options]);
},
drawChart: function(){
var ctx = this.$(".card-chart")[0];
Chart.defaults.global.fontFamily = '"Roboto", sans-serif';
$.post('/api/jobs-vs-js-libraries-stat', '', function(response){
var libraries = _.sortBy(response.data, function(library){
return library.jobs;
}).reverse();
var labels = [];
var data = [];
_.each(libraries, function(library){
if (labels.length <= 15){
labels.push(library.name);
}
if (data.length <= 15){
data.push(library.jobs)
}
});
setTimeout(function(){
new Chart(ctx, {
type: 'horizontalBar',
data: {
labels: labels,
datasets: [{
data: data,
backgroundColor: '#ff9800',
borderColor: '#ff9800'
}]
},
options: {
legend: {
display: false
},
scales: {
xAxes: [{
showLines: false,
barPercentage: 0.0,
ticks: {
maxRotation: 0,
minRotation: 0
}
}]
},
animation: {
duration: 1000
},
responsive: true,
maintainAspectRatio: false
}
});
}, 0);
});
}
});
return JobsVsJavaScriptLibrariesView;
}); | Mo-Talha/Nomad | server/static/js/views/chart/jobsvsjavascriptlibraries.view.js | JavaScript | mit | 2,773 |
#include "cursor.hpp"
#include "pointer.hpp"
#include "touch.hpp"
#include "../core-impl.hpp"
#include "../../view/view-impl.hpp"
#include "input-manager.hpp"
#include "wayfire/workspace-manager.hpp"
#include "wayfire/compositor-surface.hpp"
#include "wayfire/output-layout.hpp"
#include "tablet.hpp"
#include "wayfire/signal-definitions.hpp"
#include "wayfire/util/log.hpp"
wf::cursor_t::cursor_t(wf::seat_t *seat)
{
cursor = wlr_cursor_create();
this->seat = seat;
wlr_cursor_attach_output_layout(cursor,
wf::get_core().output_layout->get_handle());
wlr_cursor_map_to_output(cursor, NULL);
wlr_cursor_warp(cursor, NULL, cursor->x, cursor->y);
init_xcursor();
config_reloaded = [=] (wf::signal_data_t*)
{
init_xcursor();
};
wf::get_core().connect_signal("reload-config", &config_reloaded);
request_set_cursor.set_callback([&] (void *data)
{
auto ev = static_cast<wlr_seat_pointer_request_set_cursor_event*>(data);
set_cursor(ev, true);
});
request_set_cursor.connect(&seat->seat->events.request_set_cursor);
}
void wf::cursor_t::add_new_device(wlr_input_device *dev)
{
wlr_cursor_attach_input_device(cursor, dev);
}
void wf::cursor_t::setup_listeners()
{
auto& core = wf::get_core_impl();
/* Dispatch pointer events to the pointer_t */
on_frame.set_callback([&] (void*)
{
seat->lpointer->handle_pointer_frame();
wlr_idle_notify_activity(core.protocols.idle,
core.get_current_seat());
});
on_frame.connect(&cursor->events.frame);
#define setup_passthrough_callback(evname) \
on_ ## evname.set_callback([&] (void *data) { \
set_touchscreen_mode(false); \
auto ev = static_cast<wlr_event_pointer_ ## evname*>(data); \
auto mode = emit_device_event_signal("pointer_" #evname, ev); \
seat->lpointer->handle_pointer_ ## evname(ev, mode); \
wlr_idle_notify_activity(core.protocols.idle, core.get_current_seat()); \
emit_device_event_signal("pointer_" #evname "_post", ev); \
}); \
on_ ## evname.connect(&cursor->events.evname);
setup_passthrough_callback(button);
setup_passthrough_callback(motion);
setup_passthrough_callback(motion_absolute);
setup_passthrough_callback(axis);
setup_passthrough_callback(swipe_begin);
setup_passthrough_callback(swipe_update);
setup_passthrough_callback(swipe_end);
setup_passthrough_callback(pinch_begin);
setup_passthrough_callback(pinch_update);
setup_passthrough_callback(pinch_end);
#undef setup_passthrough_callback
/**
* All tablet events are directly sent to the tablet device, it should
* manage them
*/
#define setup_tablet_callback(evname) \
on_tablet_ ## evname.set_callback([&] (void *data) { \
set_touchscreen_mode(false); \
auto ev = static_cast<wlr_event_tablet_tool_ ## evname*>(data); \
auto handling_mode = emit_device_event_signal("tablet_" #evname, ev); \
if (ev->device->tablet->data) { \
auto tablet = \
static_cast<wf::tablet_t*>(ev->device->tablet->data); \
tablet->handle_ ## evname(ev, handling_mode); \
} \
wlr_idle_notify_activity(wf::get_core().protocols.idle, seat->seat); \
emit_device_event_signal("tablet_" #evname "_post", ev); \
}); \
on_tablet_ ## evname.connect(&cursor->events.tablet_tool_ ## evname);
setup_tablet_callback(tip);
setup_tablet_callback(axis);
setup_tablet_callback(button);
setup_tablet_callback(proximity);
#undef setup_tablet_callback
}
void wf::cursor_t::init_xcursor()
{
std::string theme = wf::option_wrapper_t<std::string>("input/cursor_theme");
int size = wf::option_wrapper_t<int>("input/cursor_size");
auto theme_ptr = (theme == "default") ? NULL : theme.c_str();
// Set environment variables needed for Xwayland and maybe other apps
// which use them to determine the correct cursor size
setenv("XCURSOR_SIZE", std::to_string(size).c_str(), 1);
if (theme_ptr)
{
setenv("XCURSOR_THEME", theme_ptr, 1);
}
if (xcursor)
{
wlr_xcursor_manager_destroy(xcursor);
}
xcursor = wlr_xcursor_manager_create(theme_ptr, size);
load_xcursor_scale(1);
for (auto& wo : wf::get_core().output_layout->get_current_configuration())
{
if (wo.second.source & wf::OUTPUT_IMAGE_SOURCE_SELF)
{
load_xcursor_scale(wo.first->scale);
}
}
set_cursor("default");
}
void wf::cursor_t::load_xcursor_scale(float scale)
{
wlr_xcursor_manager_load(xcursor, scale);
}
void wf::cursor_t::set_cursor(std::string name)
{
if (this->hide_ref_counter)
{
return;
}
if (this->touchscreen_mode_active)
{
return;
}
if (name == "default")
{
name = "left_ptr";
}
idle_set_cursor.run_once([name, this] ()
{
wlr_xcursor_manager_set_cursor_image(xcursor, name.c_str(), cursor);
});
}
void wf::cursor_t::unhide_cursor()
{
if (this->hide_ref_counter && --this->hide_ref_counter)
{
return;
}
set_cursor("default");
}
void wf::cursor_t::hide_cursor()
{
idle_set_cursor.disconnect();
wlr_cursor_set_surface(cursor, NULL, 0, 0);
this->hide_ref_counter++;
}
void wf::cursor_t::warp_cursor(wf::pointf_t point)
{
wlr_cursor_warp_closest(cursor, NULL, point.x, point.y);
}
wf::pointf_t wf::cursor_t::get_cursor_position()
{
return {cursor->x, cursor->y};
}
void wf::cursor_t::set_cursor(
wlr_seat_pointer_request_set_cursor_event *ev, bool validate_request)
{
if (this->hide_ref_counter)
{
return;
}
if (this->touchscreen_mode_active)
{
return;
}
if (validate_request)
{
auto pointer_client = seat->seat->pointer_state.focused_client;
if (pointer_client != ev->seat_client)
{
return;
}
}
if (!wf::get_core_impl().input->input_grabbed())
{
wlr_cursor_set_surface(cursor, ev->surface,
ev->hotspot_x, ev->hotspot_y);
}
}
void wf::cursor_t::set_touchscreen_mode(bool enabled)
{
if (this->touchscreen_mode_active == enabled)
{
return;
}
this->touchscreen_mode_active = enabled;
if (enabled)
{
hide_cursor();
} else
{
unhide_cursor();
}
}
wf::cursor_t::~cursor_t()
{
wf::get_core().disconnect_signal("reload-config", &config_reloaded);
}
| ammen99/wayfire | src/core/seat/cursor.cpp | C++ | mit | 6,541 |
class RenameUserAccountsToUsers < ActiveRecord::Migration[5.0]
def change
rename_table :user_accounts, :users
end
end
| zenglue/NY-Refugee-Resources-MVC-Sinatra-App | db/migrate/20161108005514_rename_user_accounts_to_users.rb | Ruby | mit | 126 |
/* imports */
/*! normalize.css v2.1.3 | MIT License | git.io/normalize */
/* ==========================================================================
HTML5 display definitions
========================================================================== */
/**
* Correct `block` display not defined in IE 8/9.
*/
article, aside, details, figcaption, figure, footer, header, hgroup, main, nav, section, summary {
display: block; }
/**
* Correct `inline-block` display not defined in IE 8/9.
*/
audio, canvas, video {
display: inline-block; }
/**
* Prevent modern browsers from displaying `audio` without controls.
* Remove excess height in iOS 5 devices.
*/
audio:not([controls]) {
display: none;
height: 0; }
/**
* Address `[hidden]` styling not present in IE 8/9.
* Hide the `template` element in IE, Safari, and Firefox < 22.
*/
[hidden], template {
display: none; }
/* ==========================================================================
Base
========================================================================== */
/**
* 1. Set default font family to sans-serif.
* 2. Prevent iOS text size adjust after orientation change, without disabling
* user zoom.
*/
html {
font-family: sans-serif;
/* 1 */
-ms-text-size-adjust: 100%;
/* 2 */
-webkit-text-size-adjust: 100%;
/* 2 */ }
/**
* Remove default margin.
*/
body {
margin: 0; }
/* ==========================================================================
Links
========================================================================== */
/**
* Remove the gray background color from active links in IE 10.
*/
a {
background: transparent; }
/**
* Address `outline` inconsistency between Chrome and other browsers.
*/
a:focus {
outline: thin dotted; }
/**
* Improve readability when focused and also mouse hovered in all browsers.
*/
a:active, a:hover {
outline: 0; }
/* ==========================================================================
Typography
========================================================================== */
/**
* Address variable `h1` font-size and margin within `section` and `article`
* contexts in Firefox 4+, Safari 5, and Chrome.
*/
h1 {
font-size: 2em;
margin: 0.67em 0; }
/**
* Address styling not present in IE 8/9, Safari 5, and Chrome.
*/
abbr[title] {
border-bottom: 1px dotted; }
/**
* Address style set to `bolder` in Firefox 4+, Safari 5, and Chrome.
*/
b, strong {
font-weight: bold; }
/**
* Address styling not present in Safari 5 and Chrome.
*/
dfn {
font-style: italic; }
/**
* Address differences between Firefox and other browsers.
*/
hr {
-moz-box-sizing: content-box;
box-sizing: content-box;
height: 0; }
/**
* Address styling not present in IE 8/9.
*/
mark {
background: #ff0;
color: #000; }
/**
* Correct font family set oddly in Safari 5 and Chrome.
*/
code, kbd, pre, samp {
font-family: monospace, serif;
font-size: 1em; }
/**
* Improve readability of pre-formatted text in all browsers.
*/
pre {
white-space: pre-wrap; }
/**
* Set consistent quote types.
*/
q {
quotes: "\201C" "\201D" "\2018" "\2019"; }
/**
* Address inconsistent and variable font size in all browsers.
*/
small {
font-size: 80%; }
/**
* Prevent `sub` and `sup` affecting `line-height` in all browsers.
*/
sub, sup {
font-size: 75%;
line-height: 0;
position: relative;
vertical-align: baseline; }
sup {
top: -0.5em; }
sub {
bottom: -0.25em; }
/* ==========================================================================
Embedded content
========================================================================== */
/**
* Remove border when inside `a` element in IE 8/9.
*/
img {
border: 0; }
/**
* Correct overflow displayed oddly in IE 9.
*/
svg:not(:root) {
overflow: hidden; }
/* ==========================================================================
Figures
========================================================================== */
/**
* Address margin not present in IE 8/9 and Safari 5.
*/
figure {
margin: 0; }
/* ==========================================================================
Forms
========================================================================== */
/**
* Define consistent border, margin, and padding.
*/
fieldset {
border: 1px solid #c0c0c0;
margin: 0 2px;
padding: 0.35em 0.625em 0.75em; }
/**
* 1. Correct `color` not being inherited in IE 8/9.
* 2. Remove padding so people aren't caught out if they zero out fieldsets.
*/
legend {
border: 0;
/* 1 */
padding: 0;
/* 2 */ }
/**
* 1. Correct font family not being inherited in all browsers.
* 2. Correct font size not being inherited in all browsers.
* 3. Address margins set differently in Firefox 4+, Safari 5, and Chrome.
*/
button, input, select, textarea {
font-family: inherit;
/* 1 */
font-size: 100%;
/* 2 */
margin: 0;
/* 3 */ }
/**
* Address Firefox 4+ setting `line-height` on `input` using `!important` in
* the UA stylesheet.
*/
button, input {
line-height: normal; }
/**
* Address inconsistent `text-transform` inheritance for `button` and `select`.
* All other form control elements do not inherit `text-transform` values.
* Correct `button` style inheritance in Chrome, Safari 5+, and IE 8+.
* Correct `select` style inheritance in Firefox 4+ and Opera.
*/
button, select {
text-transform: none; }
/**
* 1. Avoid the WebKit bug in Android 4.0.* where (2) destroys native `audio`
* and `video` controls.
* 2. Correct inability to style clickable `input` types in iOS.
* 3. Improve usability and consistency of cursor style between image-type
* `input` and others.
*/
button, html input[type="button"], input[type="reset"], input[type="submit"] {
-webkit-appearance: button;
/* 2 */
cursor: pointer;
/* 3 */ }
/**
* Re-set default cursor for disabled elements.
*/
button[disabled], html input[disabled] {
cursor: default; }
/**
* 1. Address box sizing set to `content-box` in IE 8/9/10.
* 2. Remove excess padding in IE 8/9/10.
*/
input[type="checkbox"], input[type="radio"] {
-moz-box-sizing: border-box;
box-sizing: border-box;
/* 1 */
padding: 0;
/* 2 */ }
/**
* 1. Address `appearance` set to `searchfield` in Safari 5 and Chrome.
* 2. Address `box-sizing` set to `border-box` in Safari 5 and Chrome
* (include `-moz` to future-proof).
*/
input[type="search"] {
-webkit-appearance: textfield;
/* 1 */
-moz-box-sizing: content-box;
/* 2 */
box-sizing: content-box; }
/**
* Remove inner padding and search cancel button in Safari 5 and Chrome
* on OS X.
*/
input[type="search"]::-webkit-search-cancel-button, input[type="search"]::-webkit-search-decoration {
-webkit-appearance: none; }
/**
* Remove inner padding and border in Firefox 4+.
*/
button::-moz-focus-inner, input::-moz-focus-inner {
border: 0;
padding: 0; }
/**
* 1. Remove default vertical scrollbar in IE 8/9.
* 2. Improve readability and alignment in all browsers.
*/
textarea {
overflow: auto;
/* 1 */
vertical-align: top;
/* 2 */ }
/* ==========================================================================
Tables
========================================================================== */
/**
* Remove most spacing between table cells.
*/
table {
border-collapse: collapse;
border-spacing: 0; }
@font-face {
font-family: 'IceCaps';
src: url('/assets/fonts/IceCaps.ttf') format('truetype');
font-weight: normal;
font-style: normal; }
/* settings */
/* /settings */
.social-link:before {
line-height: 1em;
font-family: 'fontello';
font-style: normal;
font-weight: normal;
font-variant: normal;
text-transform: none;
speak: none; }
.social-link.twitter:before {
content: '\e800'; }
.social-link.facebook:before {
content: '\e801'; }
.social-link.instagram:before {
content: '\e802'; }
/* mixins */
/* /mixins */
/* partials */
.visually-hidden {
position: absolute !important;
clip: rect(1px 1px 1px 1px);
clip: rect(1px, 1px, 1px, 1px);
padding: 0 !important;
border: 0 !important;
height: 1px !important;
width: 1px !important;
overflow: hidden; }
.visually-hidden-text {
text-indent: -10000px; }
.inactive {
display: none !important; }
.hidden {
visibility: hidden; }
.clearfix:before, .server-info-list:before, .label-list:before, .milestone-info-list-item.open-issues:before, .milestone-info-list-item.closed-issues:before, .clearfix:after, .server-info-list:after, .label-list:after, .milestone-info-list-item.open-issues:after, .milestone-info-list-item.closed-issues:after {
content: " ";
display: table; }
.clearfix:after, .server-info-list:after, .label-list:after, .milestone-info-list-item.open-issues:after, .milestone-info-list-item.closed-issues:after {
clear: both; }
.relative-container {
position: relative; }
/* /partials */
/* helper styles */
*, *:before, *:after {
-moz-box-sizing: border-box;
box-sizing: border-box; }
/* /helper styles */
/* general page styles */
html {
background-color: #fff;
font-size: 14px; }
body {
min-width: 600px;
max-width: 1200px;
margin: 0 auto;
padding: 2.85714em 1.42857em;
-webkit-font-smoothing: antialiased;
font-family: 'apercuregular', 'Helvetica Neue', Helvetica, Arial, sans-serif;
font-weight: 300;
color: #505050; }
a {
text-decoration: none;
color: #000; }
a:hover {
text-decoration: underline; }
p {
font-size: 0.85714em;
line-height: 1.5em;
color: #505050; }
h1, h2, h3, h4, h5, h6 {
margin: 0; }
input {
letter-spacing: inherit; }
[type="submit"] {
border-radius: 0;
border-style: solid;
border-width: 1px;
background-color: #fff;
text-transform: lowercase;
letter-spacing: 0.25em; }
p, ul, li, dl, dt, dd {
margin: 0;
padding: 0; }
li {
list-style: none;
display: inline-block; }
.top-row, .bottom-row {
letter-spacing: 0.25em; }
.primary-media {
position: relative; }
.primary-image {
width: 100%;
height: auto; }
/* /general page styles */
.header {
font-size: 2.2em;
font-family: 'IceCaps';
color: #79a9e0; }
.bottom-row {
font-size: 0.78571em; }
.footer-nav-item, .social-link-item {
margin-left: 2.24%; }
.footer-nav-item:first-child, .social-link-item:first-child {
margin-left: 0; }
.social-links {
padding: 0 1em; }
.social-link-item {
margin-left: 1.09091em; }
.social-link {
font-size: 1.36364em; }
.social-link:hover {
text-decoration: none; }
.newsletter {
float: right; }
.newsletter [type="email"] {
min-width: 13.27273em; }
.newsletter [type="submit"] {
position: relative;
top: -1px; }
.accordian-unit {
display: block;
width: 100%;
position: relative;
overflow: hidden;
border: 1px solid #ccc;
cursor: pointer; }
.accordian-unit:after {
content: '\25BF';
position: absolute;
right: 1em;
top: 0.5em;
font-size: 2em;
-webkit-transform: rotate(180deg);
-ms-transform: rotate(180deg);
transform: rotate(180deg);
-webkit-transition: -webkit-transform 250ms ease;
transition: transform 250ms ease; }
.accordian-unit.expanded > .accordian-unit-body {
display: block; }
.accordian-unit.expanded:after {
-webkit-transform: rotate(0deg);
-ms-transform: rotate(0deg);
transform: rotate(0deg); }
.accordian-unit-body {
display: none; }
.property-list-item, .server-list-item {
margin-top: 1em;
padding: 1em; }
.property-list-item:first-child, .server-list-item:first-child {
margin-top: 0; }
.property-header {
font-size: 3em;
margin-bottom: 0.2em; }
.server-list-item {
position: relative; }
.server-list-item:before {
content: '';
width: 2.2em;
height: 2.2em;
position: absolute;
left: 1em;
top: 1.15em;
border-radius: 50%; }
.server-list-item.open:before {
background-color: green; }
.server-list-item.closed:before {
background-color: red; }
.server-header {
padding-left: 1.75em;
font-size: 2em; }
.server-name {
display: inline-block;
margin-right: 1em;
min-width: 40%;
position: relative; }
.server-name:after {
content: ':';
position: absolute;
right: 0; }
.server-info-list {
margin-top: 14px;
padding-top: 1em;
border-top: 1px solid #CCC;
font-size: 1.5em;
cursor: default; }
.server-info-list-item {
margin-right: 1em;
margin-bottom: 1em;
padding: 0.5em;
border: 1px solid #CCC;
float: left; }
.server-info-list-item:last-child {
margin-bottom: 0; }
.server-info-list-item.last-commit, .server-info-list-item.milestone {
width: 100%;
margin-right: 0; }
.server-info-list-item > .term {
margin-bottom: 0.25em; }
.server-info-list-item.pull-request, .server-info-list-item.labels {
max-width: 30%; }
.term, .last-commit-time {
display: block; }
.author-link {
margin-right: 2.5em;
position: relative;
background-repeat: no-repeat;
background-position: -10000% -10000%; }
.author-link:after {
content: '';
width: 2em;
height: 2em;
position: absolute;
left: 110%;
bottom: 0;
background-image: inherit;
background-size: cover; }
.label-list-item {
float: left;
margin-left: 0.25em; }
.label-list-item:first-child {
margin-left: 0; }
.label-link {
padding: 0.15em 0.25em;
border-radius: 0.1em;
text-shadow: 1px 1px rgba(255, 255, 255, 0.3), -1px 1px rgba(255, 255, 255, 0.3), 1px -1px rgba(255, 255, 255, 0.3), -1px -1px rgba(255, 255, 255, 0.3); }
.label-link:hover {
text-decoration: none; }
.milestone-info-list-item {
display: block; }
.milestone-info-list-item.open-issues, .milestone-info-list-item.closed-issues {
width: 18%; }
.milestone-info-list-item.open-issues .term, .milestone-info-list-item.closed-issues .term {
float: left; }
.milestone-info-list-item.open-issues .definition, .milestone-info-list-item.closed-issues .definition {
float: right; }
.milestone-info-list-item.issues {
margin-top: 0.5em;
padding: 0.5em; }
.milestone-info-list-item.issues:after {
right: 0.5em;
font-size: 1.2em; }
.milestone-issue-list {
margin-top: 0.5em; }
.milestone-issue-list-item {
display: block;
position: relative;
margin-top: 1.5em;
padding-top: 1.5em;
border-top: 1px solid #ccc; }
.milestone-issue-list-item:first-child {
margin-top: 0;
padding-top: 0;
border: none; }
.milestone-issue-list-item:before {
content: '';
position: absolute;
width: 1.25em;
height: 1.25em;
border-radius: 50%; }
.milestone-issue-list-item.open:before {
background-color: green; }
.milestone-issue-list-item.closed:before {
background-color: red; }
.milestone-issue-info-list-item {
display: block;
margin-top: 0.5em; }
.milestone-issue-info-list-item:first-child {
margin-top: 0; }
.milestone-issue-info-list-item > .term {
margin-bottom: 0.25em; }
.milestone-issue-header {
margin-bottom: 0.25em;
padding-left: 1.5em; }
/* /imports */
/* responsive media queries */
@media only screen and (max-width: 767px) {
body {
max-width: 100%;
padding: 2.85714em 0.85714em; }
.top-nav-list {
position: relative;
text-align: center; }
.top-nav-list li {
width: auto !important; }
.top-nav-list .collaborators-dropdown {
display: none; }
.top-nav-list .page, .top-nav-list .where {
position: absolute; }
.top-nav-list .page, .top-nav-list .where {
top: 9px; }
.top-nav-list .page {
left: 0; }
.top-nav-list .where {
right: 0; }
.top-nav-list .current-edition {
display: inline-block; }
.logo {
display: block;
margin: 0 auto 0.2em; }
.logo img {
max-width: 160px;
height: auto; }
.footer-nav-item, .social-link-item {
display: block;
margin-left: 0;
margin-top: 1em; }
.footer-nav-item:first-child, .social-link-item:first-child {
margin-top: 0; }
.social-links {
padding: 0 1em; }
.social-links ul {
float: right; }
.social-link-item {
display: inline-block;
margin-top: 0; }
.newsletter {
float: none;
clear: both; }
.newsletter label {
display: block;
margin-bottom: 0.4em; }
.newsletter [type="email"] {
min-width: 17.09091em; } }
| briznad/stgr | app/webroot/assets/css/style.css | CSS | mit | 16,344 |
import React, { Component, PropTypes } from 'react';
import { connect } from 'react-redux';
import { SignUpForm } from '../shared/signup';
import { Message } from '../shared';
function mapStateToProps(state) {
return {
messages: state.messages
};
}
class Signup extends Component {
static propTypes = {
actions: PropTypes.object.isRequired
};
render() {
let { actions} = this.props;
return (
<div>
<h1>Sign up</h1>
<Message { ...this.props } />
<SignUpForm actions={actions} />
</div>
);
}
}
export default connect(mapStateToProps)(Signup);
| noxee/reddit-fantasy | client/lib/components/pages/Signup.js | JavaScript | mit | 684 |
package spoterm
import (
"fmt"
"log"
"net/http"
"net/http/httptest"
"strings"
"testing"
"time"
)
var spotermTests = []struct {
handler func(w http.ResponseWriter, r *http.Request)
termTime time.Time
chOpen bool
expErr error
}{
{ // termination time not set, 404
func(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusNotFound)
},
time.Time{},
true,
nil,
},
// termination time not set, non-time data present
{
func(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusOK)
w.Write([]byte("foo"))
},
time.Time{},
true,
nil,
},
{ // response error
func(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusInternalServerError)
w.Write([]byte("t"))
},
time.Time{},
false,
fmt.Errorf("response error 500"),
},
// termination time set
{
func(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusOK)
w.Write([]byte("2015-02-04T21:22:49Z"))
},
time.Unix(0, 1423084969000000000).UTC(),
true,
nil,
},
}
func TestSpotermNotify(t *testing.T) {
tp, nt, pi := termPath, httpTimeout, pollInterval
defer func() { termPath, httpTimeout, pollInterval = tp, nt, pi }()
pollInterval = 200 * time.Millisecond
httpTimeout = 100 * time.Millisecond
for _, tc := range spotermTests {
// Set up http server
server := httptest.NewServer(http.HandlerFunc(tc.handler))
defer server.Close()
termPath = server.URL
c, err := SpotermNotify()
if err != nil {
t.Logf("error %v", err)
if strings.Contains(err.Error(), tc.expErr.Error()) {
continue // error expected and matched
}
t.Fatal(err)
}
if tc.expErr != nil {
t.Fatalf("expected error: %v got %v", tc.expErr, err)
}
tmr := time.NewTimer(500 * time.Millisecond)
select {
case time, ok := <-c:
t.Log("time received: ", time, " ", tc.termTime)
if time != tc.termTime {
t.Fatalf("expected: %v, got %v", tc.termTime, time)
}
if ok != tc.chOpen {
t.Fatalf("expected channel open: %v, got %v", tc.termTime, time)
}
case <-tmr.C:
tmr.Stop()
t.Logf("test timeout")
if !tc.chOpen {
t.Fatalf("expected channel closed")
}
}
server.Close()
}
}
func TestSpotermNotifyNotEC2(t *testing.T) {
httpTimeout = 200 * time.Millisecond
_, err := SpotermNotify()
if !(err != nil && strings.Contains(err.Error(), "must run on EC2 instance")) {
t.Fatal(err)
}
t.Log(err)
}
func ExampleSpotermNotify() {
ch, err := SpotermNotify()
if err != nil {
// handle error
// an error will occur if run on a non-ec2 instance
log.Fatal(err)
}
go func() {
if t, ok := <-ch; ok {
// received termination-time
// run cleanup actions here
log.Printf("the instance will be terminated at %v", t)
} else {
log.Printf("SpotermNotify channel closed due to error")
}
}()
}
| rlmcpherson/spoterm | spoterm_test.go | GO | mit | 2,834 |
using System;
using System.Collections.Generic;
using Microsoft.Data.Entity.Migrations;
using Microsoft.Data.Entity.Metadata;
namespace HelloMvcWithDI.Patterns.EF.Migrations
{
public partial class first_migration : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Product",
columns: table => new
{
Id = table.Column<int>(nullable: false)
.Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
Price = table.Column<decimal>(nullable: false),
ProductName = table.Column<string>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Product", x => x.Id);
});
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable("Product");
}
}
}
| tonysneed/GK.AspNet5.London.160404 | Demos/04b-HelloMvcWithDI/src/HelloMvcWithDI.Patterns.EF/Migrations/20160405145241_first_migration.cs | C# | mit | 1,090 |
import os
from mock import Mock, PropertyMock, patch
from patroni.async_executor import CriticalTask
from patroni.postgresql import Postgresql
from patroni.postgresql.bootstrap import Bootstrap
from patroni.postgresql.cancellable import CancellableSubprocess
from patroni.postgresql.config import ConfigHandler
from . import psycopg_connect, BaseTestPostgresql
@patch('subprocess.call', Mock(return_value=0))
@patch('patroni.psycopg.connect', psycopg_connect)
@patch('os.rename', Mock())
class TestBootstrap(BaseTestPostgresql):
@patch('patroni.postgresql.CallbackExecutor', Mock())
def setUp(self):
super(TestBootstrap, self).setUp()
self.b = self.p.bootstrap
@patch('time.sleep', Mock())
@patch.object(CancellableSubprocess, 'call')
@patch.object(Postgresql, 'remove_data_directory', Mock(return_value=True))
@patch.object(Postgresql, 'data_directory_empty', Mock(return_value=False))
@patch.object(Bootstrap, '_post_restore', Mock(side_effect=OSError))
def test_create_replica(self, mock_cancellable_subprocess_call):
self.p.config._config['create_replica_methods'] = ['pgBackRest']
self.p.config._config['pgBackRest'] = {'command': 'pgBackRest', 'keep_data': True, 'no_params': True}
mock_cancellable_subprocess_call.return_value = 0
self.assertEqual(self.b.create_replica(self.leader), 0)
self.p.config._config['create_replica_methods'] = ['basebackup']
self.p.config._config['basebackup'] = [{'max_rate': '100M'}, 'no-sync']
self.assertEqual(self.b.create_replica(self.leader), 0)
self.p.config._config['basebackup'] = [{'max_rate': '100M', 'compress': '9'}]
with patch('patroni.postgresql.bootstrap.logger.error', new_callable=Mock()) as mock_logger:
self.b.create_replica(self.leader)
mock_logger.assert_called_once()
self.assertTrue("only one key-value is allowed and value should be a string" in mock_logger.call_args[0][0],
"not matching {0}".format(mock_logger.call_args[0][0]))
self.p.config._config['basebackup'] = [42]
with patch('patroni.postgresql.bootstrap.logger.error', new_callable=Mock()) as mock_logger:
self.b.create_replica(self.leader)
mock_logger.assert_called_once()
self.assertTrue("value should be string value or a single key-value pair" in mock_logger.call_args[0][0],
"not matching {0}".format(mock_logger.call_args[0][0]))
self.p.config._config['basebackup'] = {"foo": "bar"}
self.assertEqual(self.b.create_replica(self.leader), 0)
self.p.config._config['create_replica_methods'] = ['wale', 'basebackup']
del self.p.config._config['basebackup']
mock_cancellable_subprocess_call.return_value = 1
self.assertEqual(self.b.create_replica(self.leader), 1)
mock_cancellable_subprocess_call.side_effect = Exception('foo')
self.assertEqual(self.b.create_replica(self.leader), 1)
mock_cancellable_subprocess_call.side_effect = [1, 0]
self.assertEqual(self.b.create_replica(self.leader), 0)
mock_cancellable_subprocess_call.side_effect = [Exception(), 0]
self.assertEqual(self.b.create_replica(self.leader), 0)
self.p.cancellable.cancel()
self.assertEqual(self.b.create_replica(self.leader), 1)
@patch('time.sleep', Mock())
@patch.object(CancellableSubprocess, 'call')
@patch.object(Postgresql, 'remove_data_directory', Mock(return_value=True))
@patch.object(Bootstrap, '_post_restore', Mock(side_effect=OSError))
def test_create_replica_old_format(self, mock_cancellable_subprocess_call):
""" The same test as before but with old 'create_replica_method'
to test backward compatibility
"""
self.p.config._config['create_replica_method'] = ['wale', 'basebackup']
self.p.config._config['wale'] = {'command': 'foo'}
mock_cancellable_subprocess_call.return_value = 0
self.assertEqual(self.b.create_replica(self.leader), 0)
del self.p.config._config['wale']
self.assertEqual(self.b.create_replica(self.leader), 0)
self.p.config._config['create_replica_method'] = ['wale']
mock_cancellable_subprocess_call.return_value = 1
self.assertEqual(self.b.create_replica(self.leader), 1)
def test_basebackup(self):
self.p.cancellable.cancel()
self.b.basebackup(None, None, {'foo': 'bar'})
def test__initdb(self):
self.assertRaises(Exception, self.b.bootstrap, {'initdb': [{'pgdata': 'bar'}]})
self.assertRaises(Exception, self.b.bootstrap, {'initdb': [{'foo': 'bar', 1: 2}]})
self.assertRaises(Exception, self.b.bootstrap, {'initdb': [1]})
self.assertRaises(Exception, self.b.bootstrap, {'initdb': 1})
@patch.object(CancellableSubprocess, 'call', Mock())
@patch.object(Postgresql, 'is_running', Mock(return_value=True))
@patch.object(Postgresql, 'data_directory_empty', Mock(return_value=False))
@patch.object(Postgresql, 'controldata', Mock(return_value={'max_connections setting': 100,
'max_prepared_xacts setting': 0,
'max_locks_per_xact setting': 64}))
def test_bootstrap(self):
with patch('subprocess.call', Mock(return_value=1)):
self.assertFalse(self.b.bootstrap({}))
config = {'users': {'replicator': {'password': 'rep-pass', 'options': ['replication']}}}
with patch.object(Postgresql, 'is_running', Mock(return_value=False)),\
patch('multiprocessing.Process', Mock(side_effect=Exception)),\
patch('multiprocessing.get_context', Mock(side_effect=Exception), create=True):
self.assertRaises(Exception, self.b.bootstrap, config)
with open(os.path.join(self.p.data_dir, 'pg_hba.conf')) as f:
lines = f.readlines()
self.assertTrue('host all all 0.0.0.0/0 md5\n' in lines)
self.p.config._config.pop('pg_hba')
config.update({'post_init': '/bin/false',
'pg_hba': ['host replication replicator 127.0.0.1/32 md5',
'hostssl all all 0.0.0.0/0 md5',
'host all all 0.0.0.0/0 md5']})
self.b.bootstrap(config)
with open(os.path.join(self.p.data_dir, 'pg_hba.conf')) as f:
lines = f.readlines()
self.assertTrue('host replication replicator 127.0.0.1/32 md5\n' in lines)
@patch.object(CancellableSubprocess, 'call')
@patch.object(Postgresql, 'get_major_version', Mock(return_value=90600))
@patch.object(Postgresql, 'controldata', Mock(return_value={'Database cluster state': 'in production'}))
def test_custom_bootstrap(self, mock_cancellable_subprocess_call):
self.p.config._config.pop('pg_hba')
config = {'method': 'foo', 'foo': {'command': 'bar'}}
mock_cancellable_subprocess_call.return_value = 1
self.assertFalse(self.b.bootstrap(config))
mock_cancellable_subprocess_call.return_value = 0
with patch('multiprocessing.Process', Mock(side_effect=Exception("42"))),\
patch('multiprocessing.get_context', Mock(side_effect=Exception("42")), create=True),\
patch('os.path.isfile', Mock(return_value=True)),\
patch('os.unlink', Mock()),\
patch.object(ConfigHandler, 'save_configuration_files', Mock()),\
patch.object(ConfigHandler, 'restore_configuration_files', Mock()),\
patch.object(ConfigHandler, 'write_recovery_conf', Mock()):
with self.assertRaises(Exception) as e:
self.b.bootstrap(config)
self.assertEqual(str(e.exception), '42')
config['foo']['recovery_conf'] = {'foo': 'bar'}
with self.assertRaises(Exception) as e:
self.b.bootstrap(config)
self.assertEqual(str(e.exception), '42')
mock_cancellable_subprocess_call.side_effect = Exception
self.assertFalse(self.b.bootstrap(config))
@patch('time.sleep', Mock())
@patch('os.unlink', Mock())
@patch('shutil.copy', Mock())
@patch('os.path.isfile', Mock(return_value=True))
@patch('patroni.postgresql.bootstrap.quote_ident', Mock())
@patch.object(Bootstrap, 'call_post_bootstrap', Mock(return_value=True))
@patch.object(Bootstrap, '_custom_bootstrap', Mock(return_value=True))
@patch.object(Postgresql, 'start', Mock(return_value=True))
@patch.object(Postgresql, 'get_major_version', Mock(return_value=110000))
def test_post_bootstrap(self):
config = {'method': 'foo', 'foo': {'command': 'bar'}}
self.b.bootstrap(config)
task = CriticalTask()
with patch.object(Bootstrap, 'create_or_update_role', Mock(side_effect=Exception)):
self.b.post_bootstrap({}, task)
self.assertFalse(task.result)
self.p.config._config.pop('pg_hba')
self.b.post_bootstrap({}, task)
self.assertTrue(task.result)
self.b.bootstrap(config)
with patch.object(Postgresql, 'pending_restart', PropertyMock(return_value=True)), \
patch.object(Postgresql, 'restart', Mock()) as mock_restart:
self.b.post_bootstrap({}, task)
mock_restart.assert_called_once()
self.b.bootstrap(config)
self.p.set_state('stopped')
self.p.reload_config({'authentication': {'superuser': {'username': 'p', 'password': 'p'},
'replication': {'username': 'r', 'password': 'r'},
'rewind': {'username': 'rw', 'password': 'rw'}},
'listen': '*', 'retry_timeout': 10, 'parameters': {'wal_level': '', 'hba_file': 'foo'}})
with patch.object(Postgresql, 'major_version', PropertyMock(return_value=110000)), \
patch.object(Postgresql, 'restart', Mock()) as mock_restart:
self.b.post_bootstrap({}, task)
mock_restart.assert_called_once()
@patch.object(CancellableSubprocess, 'call')
def test_call_post_bootstrap(self, mock_cancellable_subprocess_call):
mock_cancellable_subprocess_call.return_value = 1
self.assertFalse(self.b.call_post_bootstrap({'post_init': '/bin/false'}))
mock_cancellable_subprocess_call.return_value = 0
self.p.config.superuser.pop('username')
self.assertTrue(self.b.call_post_bootstrap({'post_init': '/bin/false'}))
mock_cancellable_subprocess_call.assert_called()
args, kwargs = mock_cancellable_subprocess_call.call_args
self.assertTrue('PGPASSFILE' in kwargs['env'])
self.assertEqual(args[0], ['/bin/false', 'dbname=postgres host=127.0.0.2 port=5432'])
mock_cancellable_subprocess_call.reset_mock()
self.p.config._local_address.pop('host')
self.assertTrue(self.b.call_post_bootstrap({'post_init': '/bin/false'}))
mock_cancellable_subprocess_call.assert_called()
self.assertEqual(mock_cancellable_subprocess_call.call_args[0][0], ['/bin/false', 'dbname=postgres port=5432'])
mock_cancellable_subprocess_call.side_effect = OSError
self.assertFalse(self.b.call_post_bootstrap({'post_init': '/bin/false'}))
@patch('os.path.exists', Mock(return_value=True))
@patch('os.unlink', Mock())
@patch.object(Bootstrap, 'create_replica', Mock(return_value=0))
def test_clone(self):
self.b.clone(self.leader)
| zalando/patroni | tests/test_bootstrap.py | Python | mit | 11,708 |
import $ from 'jquery';
import moment from 'moment';
export function initializeAjaxDebuggingUtils () {
if (document && console && console.log)
$(document)
.ajaxSend( logJQueryAjaxEvent('[AJAX Send] ') )
.ajaxComplete( logJQueryAjaxEvent('[AJAX Complete] ') );
}
function logJQueryAjaxEvent (eventName) {
return (event, jqXHR, ajaxOptions) => {
console.log(eventName,
'url:', ajaxOptions.url,
' | ',
'time:', moment().format('h:mm:ss.SS'),
' | ',
'data:', { event, jqXHR, ajaxOptions });
}
}
| laynemcnish/walksafely-react | app/util/dev_ajax_debug.js | JavaScript | mit | 608 |
import os
import os.path
base_path = os.path.dirname(os.path.realpath("__file__"))
NAME = 'rust'
GCC_LIST = ['rust', '%s/target/release/libuwsgi_rust.a' % base_path]
CFLAGS = []
if os.uname()[0] == 'Darwin':
CFLAGS.append('-mmacosx-version-min=10.7')
if os.system("cargo build --release") != 0:
os._exit(1)
# To also build the example app:
#os.system("cargo build --release --manifest-path examples/Cargo.toml")
| unbit/uwsgi-rust | uwsgiplugin.py | Python | mit | 425 |
from vcf_parser.utils import build_models_dict
def test_simple_models():
"""
Test how the build_models_dict behaves
"""
models = ['1:AD','2:AR_comp|AD_dn']
assert build_models_dict(models) == {'1':['AD'], '2':['AR_comp', 'AD_dn']}
def test_empty_models():
"""
Test how the build_models_dict behaves
"""
models = []
assert build_models_dict(models) == {}
| moonso/vcf_parser | tests/test_build_models.py | Python | mit | 406 |
#!/bin/bash
# LGSM install_header.sh function
# Author: Daniel Gibbs
# Website: https://gameservermanagers.com
lgsm_version="210516"
local modulename="Install"
clear
echo "================================="
echo "${gamename}"
echo "Linux Game Server Manager"
echo "by Daniel Gibbs"
echo "Contributors: http://goo.gl/qLmitD"
echo "https://gameservermanagers.com"
echo "================================="
| zunnu/linuxgsm | lgsm/functions/install_header.sh | Shell | mit | 405 |
@main("Hilfe") {
<div class="row">
<div class="col-lg-12" role="main">
<div class="hp-notepad-content addmargin">
<h1>
<strong>Hilfe</strong>
</h1>
<br />
<div class="panel-group" id="accordion">
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
<a data-toggle="collapse" data-parent="#accordion" href="#login">
<strong>An- und Abmelden</strong>
</a>
</h4>
</div>
<div id="login" class="panel-collapse collapse">
<div class="panel-body">
<p>
<u><strong>Wie kann ich mich registrieren?</strong></u></u>
</p>
<p>Eine Registrierung ist nicht nötig. Du kannst direkt mit
deinem LDAP-Account durchstarten.</p>
<p>
<u><strong>Wie kann ich mich bei Socia anmelden?</strong></u>
</p>
<p>
<ol>
<li>Gib im Feld „<b>Matrikelnummer</b>“ deine 6-stellige
LDAP-Nummer mit vorangestelltem Zusatz ein. (z.B. s0123456)
<li>Gib im Feld „<b>Passwort</b>“ dein Fachbereich 4 Passwort
ein.
<li>Klicke auf „<b>Anmelden</b>“
</ol>
</p>
<p>
<u><strong>Warum kann ich mich bei Socia nicht
anmelden?</strong></u>
</p>
<p>Falls du Probleme bei der Anmeldung hast:
<ol>
<li>Überprüfe, ob du deine Matrikelnummer korrekt eingegeben
hast.
<li>Überprüfe, ob du dein Passwort korrekt eingegeben hast.
<li>Sollte trotz 1. und 2. die Anmeldung nicht erfolgreich
sein, dann <b><a href="@routes.Application.feedback()">melde es uns</a></b>.
</ol>
</p>
<p>
<u><strong>Wie kann ich mich bei Socia abmelden?</strong></u>
</p>
<p>
Klicke auf jeder beliebigen Socia-Seite oben rechts auf deinen
Namen und wähle „<b>Logout</b>“.
</p>
<p>
<u><strong>Was kann ich tun wenn ich mein Passwort
vergessen habe?</strong></u>
</p>
<p>Für Socia wird das Passwort des Fachbereichs 4 verwendet.
Solltest du dein Passwort vergessen haben, dann melde dich bitte
bei den Laboringenieuren des Fachbereichs 4.</p>
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
<a data-toggle="collapse" data-parent="#accordion" href="#search">
<strong>Suche</strong>
</a>
</h4>
</div>
<div id="search" class="panel-collapse collapse">
<div class="panel-body">
<p>
<u><strong>Wie funktioniert bei Socia die Suche?</strong></u>
</p>
<p>
Du kannst im Suchfeld nach Benutzer, Gruppen und Kursen suchen. Gib
hierfür ein Suchbegriff in das Suchfeld ein und klicke auf <span class="glyphicon glyphicon-search"></span>.
Auf der Ergebnisseite findest du jeweils die ersten zehn
Ergebnisse für Benutzer, Gruppen als auch Kurse. Wenn du nicht das
findest, wonach du suchst und mehr als 10 Suchergebnisse vorhanden
sind, klicke unter der Liste auf „<b>Weitere
Kurse/Gruppen/Personen anzeigen</b>“.
</p>
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
<a data-toggle="collapse" data-parent="#accordion" href="#friends">
<strong>Kontakte</strong>
</a>
</h4>
</div>
<div id="friends" class="panel-collapse collapse">
<div class="panel-body">
<p>
<u><strong>Wie kann ich Benutzer auf Socia finden?</strong></u>
</p>
<p>Nachdem du dich bei Socia angemeldet hast, kannst du die
Suche in der Navigation nutzen, um Freunde zu finden. Gib einfach
den Namen in das Suchfeld ein und klicke auf das Icon <span class="glyphicon glyphicon-search"></span>.</p>
<p>
<u><strong>Wie kann ich Benutzer zu meiner
Kontaktliste hinzufügen?</strong></u>
</p>
<p>Nachdem du den gesuchten Benutzer gefunden hast, stehen dir
zwei Möglichkeiten zur Verfügung eine Kontaktanfrage zu
senden.
<ol>
<li>In der Suchergebnisliste findest du rechts unter den
Optionen das Icon <span class="glyphicon glyphicon-envelope"></span>. Klicke auf das Icon um eine
Kontaktanfrage an den Benutzer zu senden.
<li>Auf dem Profil des Benutzers findest du oben rechts unter
den Tabs ebenfalls das Icon <span class="glyphicon glyphicon-envelope"></span> um eine
Kontaktanfrage zu senden.
</ol>
</p>
<p>
<u><strong>Wie kann ich eine Liste meiner Kontakte
sehen?</strong></u>
</p>
<p>Eine Liste aller deiner Kontakte siehst du indem du im Menü
auf „Kontakte“ klickst.</p>
<p>
<u><strong>Kann ich meinen Kontakten eine persönliche
Nachricht schreiben?</strong></u>
</p>
<p>Nein. Private oder persönliche Nachrichten sind auf Socia
nicht möglich.</p>
<p>
<u><strong>Wie entferne ich Benutzer aus meiner
Kontaktliste?</strong></u>
</p>
<p>Um einen Benutzer aus deiner Kontaktliste zu entfernen hast du zwei Möglichkeiten:
<ol>
<li>In deiner Kontaktliste findest du rechts unter den
Optionen das Icon <span class="glyphicon glyphicon-remove"></span>. Klicke auf dieses Icon um den
Kontakt mit dem Benutzer zu beenden.
<li>Auf dem Profil des Benutzers findest du oben rechts unter
den Tabs ebenfalls das Icon <span class="glyphicon glyphicon-remove"></span> um den Kontakt
zu beenden.
</ol>
</p>
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
<a data-toggle="collapse" data-parent="#accordion" href="#profile">
<strong>Profil verwalten</strong>
</a>
</h4>
</div>
<div id="profile" class="panel-collapse collapse">
<div class="panel-body">
<p>
<u><strong>Wo kann ich meine Profilinformationen
bearbeiten?</strong></u>
</p>
<p>Um dein Profil zu bearbeiten hast du zwei Möglichkeiten.
<ol>
<li>Du kannst auf jeder beliebigen Socia-Seite oben rechts
auf deinen Namen klicken und „<b>Mein Profil bearbeiten</b>“
auswählen.
<li>Auf deinem Profil findest du oben rechts ein Tab mit dem
Icon <span class="glyphicon glyphicon-pencil"></span> um dein Profil zu bearbeiten.
</ol>
Folgende Informationen können geändert werden:
<ul>
<li>Email
<li>Studiengang
<li>Semester
<li>Avatar
</ul>
Beachte bitte, dass alle Informationen öffentlich sind!
</p>
<p>
<u><strong>Warum kann ich meinen Namen nicht ändern?</strong></u>
</p>
<p>Socia ist ein Netzwerk, in der Benutzer ihre wahren
Identitäten verwenden. Alle Namen werden vom LDAP
übernommen und können nicht geändert werden. Wenn euer Name falsch
angezeigt wird, kann das daran liegen, dass er im LDAP
falsch abgespeichert wurde. Sollte dies der Fall sein, wende dich
bitte an einen Administrator.</p>
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
<a data-toggle="collapse" data-parent="#accordion"
href="#newsstream"> <strong>Newsstream</strong>
</a>
</h4>
</div>
<div id="newsstream" class="panel-collapse collapse">
<div class="panel-body">
<p>
<u><strong>Was genau ist mein Newsstream?</strong></u>
</p>
<p>Die Startseite von Socia stellt deinen persönlichen Newsstream
dar. Er zeigt dir an, was alles um dich herum passiert. Folgende
Posts kannst du auf Deinem Newsstream sehen:
<ul>
<li>Deine Newsstream-Posts
<li>Deine Gruppen-Posts
<li>Deine Kurs-Posts
<li>Gruppen-Posts aller Gruppenmitglieder
<li>Kurs-Posts aller Mitglieder
<li>Kontakte, die dir etwas auf den Stream schreiben
<li>Kontakte, die sich etwas auf den Stream schreiben
</ul>
</p>
<p>
<u><strong>Was ist dein öffentlicher Newsstream?</strong></u>
</p>
<p>Der öffentliche Newsstream zeigt dir, was deine Kontakte auf
deinem Newsstream lesen können. Du findest ihm im Menü oben rechts
wenn du auf deinen Namen klickst. Zusehen sind alle Post die auf
deinem Newsstream hinterlassen werden, d.h.
<ul>
<li>Post, die du auf deinen Newsstream schreibst und
<li>Post, die deine Kontakte auf deinen Newsstream schreiben.
</ul>
</p>
<p>
<u><strong>Was siehst du alles auf dem Newsstream
eines Kurses?</strong></u>
</p>
<p>Auch ein Kurs besitzt einen Newsstream. Dort kannst du
Nachrichten für alle Kursmitglieder hinterlassen. Nur
Kursmitglieder werden diese Nachrichten lesen können. Folgende
Einträge siehst du auf der Seite:
<ul>
<li>Posts von Lehrenden auf dem Kursnewsstream
<li>Deine Posts auf den Kursnewsstream
<li>Posts anderer Kursmitglieder auf den Kursnewsstream
</ul>
</p>
<p>
<u><strong>Was siehst du alles auf dem Newsstream
einer geschlossenen Gruppe?</strong></u>
</p>
<p>Auch eine geschlossene Gruppe besitzt einen Newsstream. Dort
kannst du Nachrichten für alle Gruppenmitglieder hinterlassen. Nur
Gruppenmitglieder werden diese Nachrichten lesen können.
Folgende Einträge siehst du auf der Seite:
<ul>
<li>Deine Posts auf den Gruppennewsstream
<li>Posts anderer Gruppenmitglieder auf den Gruppennewsstream
</ul>
</p>
<p>
<u><strong>Was siehst du alles auf dem Newsstream
einer öffentlichen Gruppe?</strong></u>
</p>
<p>Auch eine öffentliche Gruppe besitzt einen Newsstream. Dort
kannst du Nachrichten für alle Gruppenmitglieder hinterlassen.
Neben den Gruppenmitgliedern werden diese Nachrichten
auch alle anderen Benutzer, die sich diese öffentliche Gruppe
ansehen, lesen können. Folgende Einträge siehst du auf der Seite:
<ul>
<li>Deine Posts auf den Gruppennewsstream
<li>Posts anderer Gruppenmitglieder auf dem Gruppennewsstream
</ul>
</p>
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
<a data-toggle="collapse" data-parent="#accordion" href="#menu">
<strong>Menü</strong>
</a>
</h4>
</div>
<div id="menu" class="panel-collapse collapse">
<div class="panel-body">
<p>
<u><strong>Was kann ich über das Hauptmenü alles
herausfinden?</strong></u>
</p>
<p>Mit Hilfe des Hauptmenüs kannst du auf verschiedene
Informationen der Seite zugreifen.</p>
<p>
Über das <b>Logo</b> gelangst Du auf die Startseite von Socia
(Dein Newsstream).
</p>
<p>
Unter <b>Freunde</b> findest du alle Personen mit denen du auf
Socia eine freundschaftliche Verbindung eingegangen bist, sowie
eine Auflistung alle offenen bzw. abgelehnten
Kontaktanfragen.
</p>
<p>
<b>Gruppen & Kurse</b> zeigt dir alle Gruppen und
Kurse an, denen du beigetreten bist und die du gegründet hast,
sowie alle offenen bzw. abgelehnten Gruppenanfragen.
</p>
<p>
Bei den <b>Neuigkeiten</b> siehts du Meldungen darüber, was es
Neues bei deinen Kontakten, Gruppen oder Kursen gibt.
</p>
<p>
Zusätzlich findest du ein <b>Suchfeld</b>, mit dem du nach
Benutzern, Gruppen und Kursen suchen kannst.
</p>
<p>
Unter <b>deinem Namen</b> hast du die Möglichkeit deinen
öffentlichen Newsstream anzusehen, dein Profil anzuzeigen und zu
bearbeiten sowie dich auszuloggen.
</p>
<p>
<u><strong>Was bedeutet die Zahl neben den
Neuigkeiten?</strong></u>
</p>
<p>Diese Zahl stellt dar wie viele neue Posts, Kommentare,
Kontaktanfragen, Dateien etc. du von einer bestimmten Gruppe,
einem Kurs oder einem Benutzer hast.</p>
<p>
<u><strong>Warum verschwindet die Zahl neben den
Neuigkeiten nicht, obwohl ich sie gelesen habe?</strong></u>
</p>
<p>Neuigkeiten werden nur gelöscht, wenn du auf sie selbst oder
unter „Neuigkeiten“ auf „Alle löschen“ klickst.</p>
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
<a data-toggle="collapse" data-parent="#accordion"
href="#postAndComment"> <strong>Posten und
Kommentieren</strong>
</a>
</h4>
</div>
<div id="postAndComment" class="panel-collapse collapse">
<div class="panel-body">
<p>
<u><strong>Was ist ein Post?</strong></u>
</p>
<p>Ein Post ist ein Beitrag zu einer Person, einer Gruppe oder
einem Kurs.</p>
<p>
<u><strong>Wie erstelle ich einen Post auf meinem
eigenen Newsstream?</strong></u>
</p>
<p>Es gibt zwei Wege um auf deinem Newsstream etwas zu posten.
<ol>
<li>Klicke auf der Startseite auf das Eingabefeld „<b>Erstelle
einen neuen Post ...</b>“ schreibe den gewünschten Text und klicke
anschließend auf den Button „<b>Posten</b>“.
<li>Klicke auf deinem Namen und öffne „<b>Mein
öffentlicher Newsstream</b>“. Auch hier lässt sich im Eingabefeld ein
Post schreiben.
</ol>
Bei jedem Post siehst du an welchem Tag und zu welcher Uhrzeit er
erstellt wurde. Nur deine Kontakte können diesen Post lesen. Sie
können ihn auf ihrer Startseite bzw. auf deinem Newsstream sehen und
ihn dort auch kommentieren. Du selbst kannst deinen eigenen Post auch
kommentieren. Solltest du Fragen haben kannst Du die Einzelheiten
bei „<b>Wie kann ich einen Post kommentieren?</b>“ nachlesen.
Weitere Informationen darüber wer deine Post und Kommentare lesen
kann, erfährst du unter „<b>Privatsphäre</b>“.
</p>
<p>
<u><strong>Wie erstelle ich einen Post auf einem
fremden Newsstream?</strong></u>
</p>
<p>
Gar nicht. Du kannst nur deinen Kontakten auf den Newsstream posten.
Wie du einen Kontakt hinzufügst, findest du unter „<b>Wie kann
ich Benutzer zu meiner Kontaktliste hinzufügen</b>“.
</p>
<p>
<u><strong>Wie erstelle ich einen Post auf dem
Newsstream eines Kontaktes?</strong></u>
</p>
<p>
Gehe dazu auf das Profil deines Kontaktes. Du landest automatisch
auf seinem öffentlichen Newsstream. Um einen Post zu
hinterlassen klicke auf das Eingabefeld „<b>Erstelle einen
neuen Post ...</b>“, schreibe deinen Text und klicke auf den
Button „Posten“.
</p>
<p>
<u><strong>Wie kann ich einen Post löschen, den ich
selber geschrieben habe?</strong></u>
</p>
<p>Mit den folgenden Schritten kannst du deinen eigenen Post
löschen:
<ol>
<li>Suche den Post, den du löschen möchtest.
<li>Klicke neben dem Post auf das Icon <span class="glyphicon glyphicon-trash"></span>.
<li>Klicke zur Bestätigung auf „Ja, löschen“.
</ol>
Beachte, dass neben dem Post auch alle Kommentare des Posts mit
gelöscht werden. Auf deinem eigenen Newsstream kannst Du neben
deinen eigenen auch alle Posts von anderen Benutzer löschen.
</p>
<p>
<u><strong>Kann ich einen Post bearbeiten, den ich
selber geschrieben habe?</strong></u>
</p>
<p>Nein, das geht nicht. Sollte etwas mit dem Text nicht
stimmen, dann lösche den Post und schreibe ihn neu.</p>
<p>
<u><strong>Wie kann ich einen Post kommentieren?</strong></u>
</p>
<p>
Um eines Post zu kommentieren (egal ob einen eigenen oder fremden
Post), musst Du unterhalb des Beitrages auf das Eingabefeld „<b>Erstelle
ein Kommentar…</b>“ klicken, Dein Kommentar eingeben und diesen
anschließend mit dem Button „<b>Kommentieren</b>“ bestätigen. Bei
jedem Kommentar siehst du an welchem Tag und zu welcher Uhrzeit er
erstellt wurde.
</p>
<p>
<u><strong>Wie kann ich ein Kommentar löschen, den ich
selber gepostet habe?</strong></u>
</p>
<p>Mit den folgenden Schritten kannst du dein Kommentar löschen:
<ol>
<li>Suche den eigenen erstellten Kommentar, den du löschen
möchtest.
<li>Klicke neben dem Kommentar auf das Icon <span class="glyphicon glyphicon-trash"></span>.
<li>Klicke zur Bestätigung auf „Ja, löschen“.
</ol>
</p>
<p>
<u><strong>Kann ich einen Kommentar bearbeiten, den
ich selber gepostet habe?</strong></u>
</p>
<p>Man kann Kommentare nicht bearbeiten. Sollte etwas mit dem
Text nicht stimmen, dann lösche den Kommentar und schreibe ihn neu.
</p>
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
<a data-toggle="collapse" data-parent="#accordion"
href="#groupsAndCourses"> <strong>Gruppen und Kurse</strong>
</a>
</h4>
</div>
<div id="groupsAndCourses" class="panel-collapse collapse">
<div class="panel-body">
<p>
<u><strong>Was ist bei Socia eine Gruppe?</strong></u>
</p>
<p>
Gruppen bieten den Studierenden und Lehrenden die Möglichkeit sich
über gemeinsame Interessen auszutauschen. Dies reicht von der
Klausurvorbereitung bis hin zur Planung einer Weihnachtsfeier.
Gruppen können von allen Benutzern erstellt werden. Es gibt
öffentliche und geschlossene Gruppen. In geschlossenen Gruppen
können die Inhalte nur von Mitgliedern eingesehen werden. In
öffentlichen Gruppen hingegen können alle Inhalte eingesehen,
jedoch ohne Beitritt keine eigenen Beiträge verfasst werden.
Gruppenmitglieder müssen zuvor genehmigt werden. Eine Gruppe
enthält ein Newsstream, einen Dateiupload und allgemeine
Informationen. Wird ein Beitrag geschrieben oder eine Datei
hochgeladen, dann erhalten alle Gruppenmitglieder diese
Neuigkeiten. Weitere Informationen erhältst du unter anderem bei „<b>Was
ist ein Gruppenadministrator?</b>“ und „<b>Privatsphäre</b>“.
</p>
<p>
<u><strong>Wie unterscheiden sich öffentliche und geschlossene Gruppen?</strong></u>
</p>
<p>
Öffentliche und geschlossene Gruppen sind sich ziemlich ähnlich.
Sie besitzen die gleichen Funktionalitäten. Der eigentliche
Unterschied besteht in der Sichtbarkeit der Inhalte. Bei
öffentlichen Gruppen können alle Inhalte angesehen und Dateien
runtergeladen werden. Bei geschlossenen Gruppen hingegen stehen
alle Funktionen und Inhalte erst nach dem Beitritt der Gruppe zur
Verfügung. Wenn du wissen möchtest wie man einer Gruppe beitritt,
findest du mehr unter „<b>Wie trete ich einer Gruppe bei?</b>“.
</p>
<p>
<u><strong>Warum sollte ich einer öffentlichen Gruppe beitreten?</strong></u>
</p>
<p>
Auch wenn auf den Inhalt von öffentlichen Gruppen ohne Beitritt zugegriffen werden kann,
können Posts in dieser Gruppe erst als Mitglied dieser Gruppe geschrieben werden.
Auch Inhalte über die globale Suche kann erst nach einem Beitritt
gefunden werden.</b>.
</p>
<p>
<u><strong>Was ist bei Socia ein Kurs?</strong></u>
</p>
<p>
Kurse bieten den Studierenden und Lehrenden die Möglichkeit
Kursmaterialien und Kursinformationen untereinander auszutauschen.
Kurse können nur von Lehrenden erstellt und Inhalte nur nach
Beitritt angesehen werden. Hierzu muss ein vom Lehrenden
bereitgestellter Token eingegeben werden. Ein Kurs enthält ein
Newsstream, einen Dateiupload und allgemeine Informationen. Wird
ein Beitrag geschrieben oder eine Datei hochgeladen, dann erhalten
alle Kursmitglieder diese Neuigkeit. Weitere Informationen erhältst
Du unter anderem bei „<b>Was ist ein Kursadministrator?</b>“ und „<b>Privatsphäre</b>“.
</p>
<p>
<u><strong>Wie unterscheiden sich Kurse von Gruppen?</strong></u>
</p>
<p>Ein Kurs ist im Grunde wie eine geschlossene Gruppe. Es gibt
folgende Unterschiede:
<ul>
<li>Kurse können nur von Lehrenden erstellt werden
<li>Um einem Kurs beizutreten muss ein Token eingegeben werden
<li>Studierende können Dateien nur herunterladen, aber nicht
hochladen.
</ul>
</p>
<p>
<u><strong>Wie erstelle ich eine Gruppe?</strong></u>
</p>
<p>Mit den folgenden Schritten kann eine Gruppe erstellt werden:
<ol>
<li>Klicke im Menü auf „<b>Gruppen & Kurse</b>“
<li>Klicke oben rechts auf den Tab mit dem Icon <span class="glyphicon glyphicon-plus"></span>
<li>Gebe Titel, Beschreibung und Typ der Gruppe ein
<li>Klicke auf den Button „<b>Gruppe erstellen</b>“
</ol>
Anschließend wirst du zur Gruppe weitergeleitet.
</p>
<p>
<u><strong>Wie erstelle ich einen Kurs?</strong></u>
</p>
<p>Mit den folgenden Schritten kann ein Kurs erstellt werden:
<ul>
<li>Klicke im Menü auf „<b>Gruppen & Kurse</b>“
<li>Klicke oben rechts auf den Tab mit das Icon <span class="glyphicon glyphicon-plus"></span>
<li>Gebe Titel, Beschreibung, Typ und Token der Gruppe ein
<li><b><u>Wichtig</b></u>: Bei Typ muss hier Kurs ausgewählt
werden
<li>Klicke auf den Button „<b>Gruppe erstellen</b>“
</ul>
Anschließend wirst du zum Kurs weitergeleitet.
</p>
<p>
<u><strong>Wie trete ich einer Gruppe bei?</strong></u>
</p>
<p>Wenn du nach der Suche deine gewünschte Gruppe gefunden hast,
hast du zwei Möglichkeiten einer Gruppe beizutreten:
<ol>
<li>Um Gruppen beizutreten findest du unter den Optionen auf
der rechten Seite für geschlossene Gruppen das Icon <span class="glyphicon glyphicon-envelope"></span>
und für öffentliche Gruppen das Icon <span class="glyphicon glyphicon-ok"></span>
<li>Bei den öffentlichen Gruppen hast du zusätzlich die
Möglichkeit auf der Gruppenseite durch Klick auf das
Icon <span class="glyphicon glyphicon-ok"></span> beizutreten.
</ol>
Bei geschlossenen Gruppen musst du warten, bis die Anfrage
bearbeitet wurde. Sowohl bei Annahme als auch bei Ablehnung erhältst
du eine Nachricht unter den Neuigkeiten.
</p>
<p>
<u><strong>Wie trete ich einem Kurs bei?</strong></u>
</p>
<p>Befolge folgende Schritte um einem Kurs beizutreten:
<ol>
<li>Unter den Suchergebnissen der Kurse findest du rechts
unter den Optionen das Icon <span class="glyphicon glyphicon-ok"></span> um einem Kurs
beizutreten
<li>Nach dem Klick auf das Icon öffnet sich ein Inputfeld um
den Token einzugeben
<li>Klicke auf den Button „<b>Senden</b>“
</ol>
</p>
<p>
<u><strong>Wie kann ich eine Liste meiner Gruppen und
Kurse sehen?</strong></u>
</p>
<p>
Um eine Liste all deiner beigetretener Gruppen und Kurse zu sehen
musst du im Menü auf „<b>Gruppen & Kurse</b>“ gehen.
</p>
<p>
<u><strong>Was ist ein Gruppenadministrator?</strong></u>
</p>
<p>Ein Gruppenadministrator ist der Benutzer, der die Gruppe
erstellt hat. Neben den Funktionen die ein Gruppenmitglied benutzen
kann, kann der Gruppenadministrator auch:
<ul>
<li>Die Beschreibung bearbeiten
<li>Unerwünschte Beiträge löschen
<li>Mitglieder entfernen
<li>Die Gruppe löschen
</ul>
</p>
<p>
<u><strong>Wie kann ich Beiträge von
Gruppenmitgliedern entfernen?</strong></u>
</p>
<p>Wenn du Gruppenadministrator bist kannst sämtliche Beiträge
löschen indem du auf das Icon <span class="glyphicon glyphicon-trash"></span> klickst und noch
einmal mit „Ja, löschen“ bestätigst.</p>
<p>
<u><strong>Wie kann ich Gruppenmitgliedern entfernen?</strong></u>
</p>
<p>Wenn Du Gruppenadministrator bist kannst Du Gruppenmitglieder
löschen.
<ol>
<li>Gehe auf Gruppe bearbeiten indem du oben rechts unter den
Tabs das Icon <span class="glyphicon glyphicon-pencil"></span> auswählst
<li>Im unteren Bereich findest du eine Liste aller
Gruppenmitglieder
<li>Klicke auf das Icon <span class="glyphicon glyphicon-remove"></span> neben dem Namen des
Mitgliedes das du aus der Gruppe entfernen willst.
</ol>
</p>
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
<a data-toggle="collapse" data-parent="#accordion"
href="#misc"> <strong>Privatsphäre und
Sicherheit</strong>
</a>
</h4>
</div>
<div id="misc" class="panel-collapse collapse">
<div class="panel-body">
<p>
<u><strong>Was bedeutet „Öffentlich“?</strong></u>
</p>
<p>
Der Begriff „<b>öffentlich</b>“ bezieht sich bei Socia auf zwei
Funktionen:
<ul>
<li>Bei der Gruppe zeigt es, dass die Gruppe für alle Personen
der Seite einzusehen ist, sowie die alle Dateien der Gruppe
runtergeladen werden können.
<li>Zum anderen gibt es im Menü oben rechts unter deinem Namen
den Punkt „<b>Dein öffentlicher Newsstream</b>“. Dieser Newsstream
zeigt dir deinen Newsstream so, wie ihn deine Kontakte sehen.
Öffentlich heißt nicht, dass die Beiträge alle Benutzer sehen
können. In HTWplus können deine Posts nur die entsprechenden Gruppenmitglieder oder deine Freunde lesen.
</ul>
</p>
<p>
<u><strong>Welche Daten werden von Socia
gespeichert?</strong></u>
</p>
<p>
Wir speichern nur das, was du in deinem Profil angibst
und an Beiträgen auf der Seite verfasst.
</p>
<p>
<u><strong>Was passiert mit Posts, Kommentaren und
Dateien die ich wieder lösche?</strong></u>
</p>
<p>Sie werden tatsälich gelöscht. Eine Wiederherstellung ist leider nicht möglich.</p>
<p>
<u><strong>Was passiert wenn ich einen Benutzer melde,
bleibe ich anonym?</strong></u>
</p>
<p>Wenn ein Benutzer gemeldet wird, dann prüfen wir den Fall und
entfernen gegebenenfalls alle Post und Kommentare die nicht dem
Standard und den Richtlinien von Socia entsprechen. Wir werden
den entsprechenden Benutzer benachrichtigen und verwarnen. Dabei
werden keinerlei Informationen darüber weitergegeben, wer den
Benutzer gemeldet hat.</p>
<p>
<u><strong>Was kann ich machen, wenn ich unerwünschte
Nachrichten bekomme?</strong></u>
</p>
<p>Wenn Du unerwünschte Nachrichten erhältst, hast du folgende
Möglichkeiten:
<ul>
<li>Du kannst auf deinem Newsstream Nachrichten nur bekommen,
wenn du mit dem Benutzer in Kontakt stehst. Solltest du unerwünschte
Nachrichten bekommen, dann lösche diese Person aus deiner
Kontaktliste.
<li>In geschlossenen Gruppen und Kursen verhält es sich wie mit dem
Newsstream. Solltest du als Gruppenadministrator unerwünschte
Nachrichten bekommen dann entferne die Posts vom Newsstream und
den Benutzer aus der Mitgliederliste der Gruppe. Sollte der
Benutzer eine neue Anfrage senden, dann kannst du sie einfach
ablehnen.
<li>Solltest Du kein Gruppenadministrator sein, dann bitten
wir dich diesen über die unerwünschten Nachrichten zu informieren.
<li>Auch bei öffentlichen Gruppen hast du die Möglichkeit die
Posts und den Benutzer als Gruppenadministrator zu löschen bzw.
den Gruppenadministrator zu informieren.
<li>Sollten die oben genannten Möglichkeiten nicht
funktionieren, kannst du dich auch <a href="@routes.Application.feedback()"><b>bei uns melden</b></a>.
</ul>
</p>
<p>
<u><strong>Wie kann ich meine eigene Sicherheit
gewährleisten?</strong></u>
</p>
<p>Folgende Maßnahmen solltest du für deine eigene Sicherheit
beachten:
<ul>
<li>Gebe dein Passwort nicht an andere Personen weiter
<li>Nimm nur Kontaktanfragen von Personen an, die du auch
kennst
<li>Nimm nur Gruppenanfragen von Personen an, die du in deiner
Gruppe haben möchtest
<li>Teile den Token für Kurse nur berechtigten Personen mit
<li>Stelle vor dem Senden sicher, dass der Inhalt deiner Posts
weder anstößig, beleidigend, rassistisch noch menschenunwürdig
ist.
</p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
} | socia-platform/socia | app/views/help.scala.html | HTML | mit | 48,566 |
---
layout: post
title: 'Jobs: diXa Project - Scientific Training & Dissemination Officer (Maternity
Cover) at EMBL-EBI'
date: '2013-07-16T14:25:00.001+01:00'
author: John Overington
tags:
- Staff and Recruitment
modified_time: '2013-07-25T12:51:30.033+01:00'
thumbnail: http://4.bp.blogspot.com/-lPxuyCF2IfE/UeVJo92noGI/AAAAAAAADEU/uGosHcChlZo/s72-c/logo.png
blogger_id: tag:blogger.com,1999:blog-2546008714740235720.post-5843588213981091960
blogger_orig_url: http://chembl.blogspot.com/2013/07/dixa-project-scientific-training.html
---
<!--[if !mso]>
<style>
v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style>
<![endif]--><!--[if gte mso 9]><xml>
<o:DocumentProperties>
<o:Revision>0</o:Revision>
<o:TotalTime>0</o:TotalTime>
<o:Pages>1</o:Pages>
<o:Words>249</o:Words>
<o:Characters>1423</o:Characters>
<o:Company>EMBL-EBI</o:Company>
<o:Lines>11</o:Lines>
<o:Paragraphs>3</o:Paragraphs>
<o:CharactersWithSpaces>1669</o:CharactersWithSpaces>
<o:Version>14.0</o:Version>
</o:DocumentProperties>
<o:OfficeDocumentSettings>
<o:AllowPNG/>
</o:OfficeDocumentSettings>
</xml><![endif]-->
<!--[if gte mso 9]><xml>
<w:WordDocument>
<w:View>Normal</w:View>
<w:Zoom>0</w:Zoom>
<w:TrackMoves>false</w:TrackMoves>
<w:TrackFormatting/>
<w:PunctuationKerning/>
<w:ValidateAgainstSchemas/>
<w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid>
<w:IgnoreMixedContent>false</w:IgnoreMixedContent>
<w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText>
<w:DoNotPromoteQF/>
<w:LidThemeOther>EN-GB</w:LidThemeOther>
<w:LidThemeAsian>JA</w:LidThemeAsian>
<w:LidThemeComplexScript>X-NONE</w:LidThemeComplexScript>
<w:Compatibility>
<w:BreakWrappedTables/>
<w:SnapToGridInCell/>
<w:WrapTextWithPunct/>
<w:UseAsianBreakRules/>
<w:DontGrowAutofit/>
<w:SplitPgBreakAndParaMark/>
<w:EnableOpenTypeKerning/>
<w:DontFlipMirrorIndents/>
<w:OverrideTableStyleHps/>
</w:Compatibility>
<m:mathPr>
<m:mathFont m:val="Cambria Math"/>
<m:brkBin m:val="before"/>
<m:brkBinSub m:val="--"/>
<m:smallFrac m:val="off"/>
<m:dispDef/>
<m:lMargin m:val="0"/>
<m:rMargin m:val="0"/>
<m:defJc m:val="centerGroup"/>
<m:wrapIndent m:val="1440"/>
<m:intLim m:val="subSup"/>
<m:naryLim m:val="undOvr"/>
</m:mathPr></w:WordDocument>
</xml><![endif]--><!--[if gte mso 9]><xml>
<w:LatentStyles DefLockedState="false" DefUnhideWhenUsed="true"
DefSemiHidden="true" DefQFormat="false" DefPriority="99"
LatentStyleCount="276">
<w:LsdException Locked="false" Priority="0" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Normal"/>
<w:LsdException Locked="false" Priority="9" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="heading 1"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 2"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 3"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 4"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 5"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 6"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 7"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 8"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 9"/>
<w:LsdException Locked="false" Priority="39" Name="toc 1"/>
<w:LsdException Locked="false" Priority="39" Name="toc 2"/>
<w:LsdException Locked="false" Priority="39" Name="toc 3"/>
<w:LsdException Locked="false" Priority="39" Name="toc 4"/>
<w:LsdException Locked="false" Priority="39" Name="toc 5"/>
<w:LsdException Locked="false" Priority="39" Name="toc 6"/>
<w:LsdException Locked="false" Priority="39" Name="toc 7"/>
<w:LsdException Locked="false" Priority="39" Name="toc 8"/>
<w:LsdException Locked="false" Priority="39" Name="toc 9"/>
<w:LsdException Locked="false" Priority="35" QFormat="true" Name="caption"/>
<w:LsdException Locked="false" Priority="10" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Title"/>
<w:LsdException Locked="false" Priority="1" Name="Default Paragraph Font"/>
<w:LsdException Locked="false" Priority="11" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Subtitle"/>
<w:LsdException Locked="false" Priority="22" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Strong"/>
<w:LsdException Locked="false" Priority="20" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Emphasis"/>
<w:LsdException Locked="false" Priority="59" SemiHidden="false"
UnhideWhenUsed="false" Name="Table Grid"/>
<w:LsdException Locked="false" UnhideWhenUsed="false" Name="Placeholder Text"/>
<w:LsdException Locked="false" Priority="1" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="No Spacing"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 1"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 1"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 1"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 1"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 1"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 1"/>
<w:LsdException Locked="false" UnhideWhenUsed="false" Name="Revision"/>
<w:LsdException Locked="false" Priority="34" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="List Paragraph"/>
<w:LsdException Locked="false" Priority="29" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Quote"/>
<w:LsdException Locked="false" Priority="30" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Intense Quote"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 1"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 1"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 1"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 1"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 1"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 1"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 1"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 1"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 2"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 2"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 2"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 2"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 2"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 2"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 2"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 2"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 2"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 2"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 2"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 2"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 2"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 2"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 3"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 3"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 3"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 3"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 3"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 3"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 3"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 3"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 3"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 3"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 3"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 3"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 3"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 3"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 4"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 4"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 4"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 4"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 4"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 4"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 4"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 4"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 4"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 4"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 4"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 4"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 4"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 4"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 5"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 5"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 5"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 5"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 5"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 5"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 5"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 5"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 5"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 5"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 5"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 5"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 5"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 5"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 6"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 6"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 6"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 6"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 6"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 6"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 6"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 6"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 6"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 6"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 6"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 6"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 6"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 6"/>
<w:LsdException Locked="false" Priority="19" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Subtle Emphasis"/>
<w:LsdException Locked="false" Priority="21" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Intense Emphasis"/>
<w:LsdException Locked="false" Priority="31" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Subtle Reference"/>
<w:LsdException Locked="false" Priority="32" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Intense Reference"/>
<w:LsdException Locked="false" Priority="33" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Book Title"/>
<w:LsdException Locked="false" Priority="37" Name="Bibliography"/>
<w:LsdException Locked="false" Priority="39" QFormat="true" Name="TOC Heading"/>
</w:LatentStyles>
</xml><![endif]-->
<!--[if gte mso 10]>
<style>
/* Style Definitions */
table.MsoNormalTable
{mso-style-name:"Table Normal";
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-priority:99;
mso-style-parent:"";
mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
mso-para-margin:0cm;
mso-para-margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:11.0pt;
font-family:Calibri;
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;}
</style>
<![endif]-->
<!--StartFragment-->
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-lPxuyCF2IfE/UeVJo92noGI/AAAAAAAADEU/uGosHcChlZo/s1600/logo.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://4.bp.blogspot.com/-lPxuyCF2IfE/UeVJo92noGI/AAAAAAAADEU/uGosHcChlZo/s1600/logo.png" /></a></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
The diXa project is looking to recruit a someone to provide part-time maternity cover for the Scientific Training &
Dissemination Officer in the Industry Support team which is based at the
European Bioinformatics Institute (EMBL-EBI) located in Hinxton, near Cambridge in the UK.<o:p></o:p></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
The diXa project is dedicated to developing and implementing
a robust and sustainable service infrastructure for data from EU-funded
research into non-animal tests for predicting chemical safety
(<a href="http://www.dixa-fp7.eu/">http://www.diXa-fp7.eu/</a>). EMBL-EBI is a partner in the diXa project with a
number of responsibilities.<o:p></o:p></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
The overall objectives for the position will be to deliver a
core set of project-related training and dissemination services to the
Toxicogenomics Research Community and to help foster effective use of resources
provided through the project working with colleagues at EMBL-EBI and the other
partner sites. The successful candidate will also liaise with other groups
involved in training and dissemination both at EMBL-EBI and at other training
partner sites. Training activities will have a strong industry focus but will
also include other stakeholders.<o:p></o:p></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
The key responsibilities for the position and the desired
qualifications and experience of the applicant can be reviewed on the diXa
project website.<o:p></o:p></div>
<div class="MsoNormal">
<a href="http://www.dixa-fp7.eu/news/dixa-vacancy">http://www.dixa-fp7.eu/news/dixa-vacancy</a><o:p></o:p></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
Please apply online through <a href="www.embl.org:jobs">www.embl.org/jobs</a><o:p></o:p></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
The application deadline is <b>29<span style="font-size: x-small;">th</span> July 2013.</b><o:p></o:p></div>
<!--EndFragment--> | chembl/chembl.github.io | _posts/2013-07-16-dixa-project-scientific-training.html | HTML | mit | 21,412 |
# A parallel WordCount. Depends on the 'wc' utility.
class WordCount < CloudCrowd::Action
# Count the words in a single book.
# Pretend that this takes longer than it really does, for demonstration purposes.
def process
sleep 5
(`wc -w #{input_path}`).match(/\A\s*(\d+)/)[1].to_i
end
# Sum the total word count.
def merge
input.inject(0) {|sum, count| sum + count }
end
end | documentcloud/cloud-crowd | actions/word_count.rb | Ruby | mit | 402 |
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/*
| -------------------------------------------------------------------
| DATABASE CONNECTIVITY SETTINGS
| -------------------------------------------------------------------
| This file will contain the settings needed to access your database.
|
| For complete instructions please consult the 'Database Connection'
| page of the User Guide.
|
| -------------------------------------------------------------------
| EXPLANATION OF VARIABLES
| -------------------------------------------------------------------
|
| ['dsn'] The full DSN string describe a connection to the database.
| ['hostname'] The hostname of your database server.
| ['username'] The username used to connect to the database
| ['password'] The password used to connect to the database
| ['database'] The name of the database you want to connect to
| ['dbdriver'] The database driver. e.g.: mysqli.
| Currently supported:
| cubrid, ibase, mssql, mysql, mysqli, oci8,
| odbc, pdo, postgre, sqlite, sqlite3, sqlsrv
| ['dbprefix'] You can add an optional prefix, which will be added
| to the table name when using the Query Builder class
| ['pconnect'] TRUE/FALSE - Whether to use a persistent connection
| ['db_debug'] TRUE/FALSE - Whether database errors should be displayed.
| ['cache_on'] TRUE/FALSE - Enables/disables query caching
| ['cachedir'] The path to the folder where cache files should be stored
| ['char_set'] The character set used in communicating with the database
| ['dbcollat'] The character collation used in communicating with the database
| NOTE: For MySQL and MySQLi databases, this setting is only used
| as a backup if your server is running PHP < 5.2.3 or MySQL < 5.0.7
| (and in table creation queries made with DB Forge).
| There is an incompatibility in PHP with mysql_real_escape_string() which
| can make your site vulnerable to SQL injection if you are using a
| multi-byte character set and are running versions lower than these.
| Sites using Latin-1 or UTF-8 database character set and collation are unaffected.
| ['swap_pre'] A default table prefix that should be swapped with the dbprefix
| ['encrypt'] Whether or not to use an encrypted connection.
|
| 'mysql' (deprecated), 'sqlsrv' and 'pdo/sqlsrv' drivers accept TRUE/FALSE
| 'mysqli' and 'pdo/mysql' drivers accept an array with the following options:
|
| 'ssl_key' - Path to the private key file
| 'ssl_cert' - Path to the public key certificate file
| 'ssl_ca' - Path to the certificate authority file
| 'ssl_capath' - Path to a directory containing trusted CA certificats in PEM format
| 'ssl_cipher' - List of *allowed* ciphers to be used for the encryption, separated by colons (':')
| 'ssl_verify' - TRUE/FALSE; Whether verify the server certificate or not ('mysqli' only)
|
| ['compress'] Whether or not to use client compression (MySQL only)
| ['stricton'] TRUE/FALSE - forces 'Strict Mode' connections
| - good for ensuring strict SQL while developing
| ['ssl_options'] Used to set various SSL options that can be used when making SSL connections.
| ['failover'] array - A array with 0 or more data for connections if the main should fail.
| ['save_queries'] TRUE/FALSE - Whether to "save" all executed queries.
| NOTE: Disabling this will also effectively disable both
| $this->db->last_query() and profiling of DB queries.
| When you run a query, with this setting set to TRUE (default),
| CodeIgniter will store the SQL statement for debugging purposes.
| However, this may cause high memory usage, especially if you run
| a lot of SQL queries ... disable this to avoid that problem.
|
| The $active_group variable lets you choose which connection group to
| make active. By default there is only one group (the 'default' group).
|
| The $query_builder variables lets you determine whether or not to load
| the query builder class.
*/
$active_group = 'default';
$query_builder = TRUE;
$db['default'] = array(
'dsn' => '',
'hostname' => 'localhost',
'username' => 'root',
'password' => '',
'database' => 'pedc',
'dbdriver' => 'mysqli',
'dbprefix' => '',
'pconnect' => FALSE,
'db_debug' => (ENVIRONMENT !== 'production'),
'cache_on' => FALSE,
'cachedir' => '',
'char_set' => 'utf8',
'dbcollat' => 'utf8_general_ci',
'swap_pre' => '',
'encrypt' => FALSE,
'compress' => FALSE,
'stricton' => FALSE,
'failover' => array(),
'save_queries' => TRUE
);
| carlodeguzman5/PEDC | application/config/database.php | PHP | mit | 4,522 |
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Enabling Replication in the SQL Layer</title>
<link rel="stylesheet" href="gettingStarted.css" type="text/css" />
<meta name="generator" content="DocBook XSL Stylesheets V1.73.2" />
<link rel="start" href="index.html" title="Berkeley DB Installation and Build Guide" />
<link rel="up" href="upgrade_52_toc.html" title="Chapter 10. Upgrading Berkeley DB 11.2.5.1 applications to Berkeley DB 11.2.5.2" />
<link rel="prev" href="upgrade_11gr2_52_rep_2site_strict.html" title="2SITE_STRICT Enabled by Default in Replication" />
<link rel="next" href="upgrade_11gr2_52_repmgr_channels.html" title="Repmgr Message Channels" />
</head>
<body>
<div xmlns="" class="navheader">
<div class="libver">
<p>Library Version 11.2.5.3</p>
</div>
<table width="100%" summary="Navigation header">
<tr>
<th colspan="3" align="center">Enabling Replication in the SQL Layer </th>
</tr>
<tr>
<td width="20%" align="left"><a accesskey="p" href="upgrade_11gr2_52_rep_2site_strict.html">Prev</a> </td>
<th width="60%" align="center">Chapter 10.
Upgrading Berkeley DB 11.2.5.1 applications to Berkeley DB 11.2.5.2
</th>
<td width="20%" align="right"> <a accesskey="n" href="upgrade_11gr2_52_repmgr_channels.html">Next</a></td>
</tr>
</table>
<hr />
</div>
<div class="sect1" lang="en" xml:lang="en">
<div class="titlepage">
<div>
<div>
<h2 class="title" style="clear: both"><a id="upgrade_11gr2_52_rep_sql"></a>Enabling Replication in the SQL Layer </h2>
</div>
</div>
</div>
<div class="toc">
<dl>
<dt>
<span class="sect2">
<a href="upgrade_11gr2_52_rep_sql.html#idp962696">New Pragmas</a>
</span>
</dt>
</dl>
</div>
<p>
Replication can now be enabled and configured in the SQL layer
using pragmas. The pragmas
<code class="literal">replication_local_site</code>,
<code class="literal">replication_initial_master</code>, and
<code class="literal">replication_remote_site</code> can be used to configure
the replication group. Note that when the BDB SQL replicated
application is initially started, a specific master site must be
explicitly designated. After configuring the replication group,
start replication using <code class="literal">PRAGMA replication=ON</code>.
</p>
<p>
To display replication statistics in the dbsql shell, use:
</p>
<pre class="programlisting">dbsql> .stat :rep</pre>
<div class="sect2" lang="en" xml:lang="en">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a id="idp962696"></a>New Pragmas</h3>
</div>
</div>
</div>
<p>
For more details on the replication pragmas see
<a href="../bdb-sql/reppragma.html" class="olink">Replication PRAGMAs</a> in the <em class="citetitle">Berkeley DB Getting Started with the SQL APIs</em> guide.
</p>
<div class="itemizedlist">
<ul type="disc">
<li>
<code class="literal">PRAGMA replication=ON|OFF</code>
</li>
<li>
<code class="literal">PRAGMA replication_initial_master=ON|OFF</code>
</li>
<li>
<code class="literal">PRAGMA replication_local_site="hostname:port"</code>
</li>
<li>
<code class="literal">PRAGMA replication_remote_site="hostname:port"</code>
</li>
<li>
<code class="literal">PRAGMA replication_remove_site="host:port"</code>
</li>
<li>
<code class="literal">PRAGMA replication_verbose_output=ON|OFF</code>
</li>
<li>
<code class="literal">PRAGMA replication_verbose_file=filename</code>
</li>
</ul>
</div>
</div>
</div>
<div class="navfooter">
<hr />
<table width="100%" summary="Navigation footer">
<tr>
<td width="40%" align="left"><a accesskey="p" href="upgrade_11gr2_52_rep_2site_strict.html">Prev</a> </td>
<td width="20%" align="center">
<a accesskey="u" href="upgrade_52_toc.html">Up</a>
</td>
<td width="40%" align="right"> <a accesskey="n" href="upgrade_11gr2_52_repmgr_channels.html">Next</a></td>
</tr>
<tr>
<td width="40%" align="left" valign="top">2SITE_STRICT Enabled by Default in Replication </td>
<td width="20%" align="center">
<a accesskey="h" href="index.html">Home</a>
</td>
<td width="40%" align="right" valign="top"> Repmgr Message Channels </td>
</tr>
</table>
</div>
</body>
</html>
| iadix/iadixcoin | db-5.3.28.NC/docs/installation/upgrade_11gr2_52_rep_sql.html | HTML | mit | 5,337 |
## Cutting a release steps:
For this package specifically, we try to maintain what you see in GH is what you get in npm. This requires latest dist to be checked into master before a release, even though the release process may not come from GH.
Steps:
1. checkout
2. restore dependencies (`npm ci`)
3. update version (`npm version -m 'chore(release): prepare release %s'`)
4. push
5. publish to npm
```shell
# 1
git clone https://github.com/aurelia/webpack-plugin.git
# 2
npm ci
# 3
npm version [major | minor | patch | etc...] -m 'chore(release): prepare release XXXX'
# 4
git push
git push --tag
# 5
npm publish
```
| aurelia/webpack-plugin | MAINTAINER.md | Markdown | mit | 626 |
define(function() {
return function() {
return {
restrict: 'A',
scope: true,
link: function(scope, lElement, attrs) {
lElement.addClass('focus').focus();
}
}
}
});
| lhtrieu87/angular-yo-require-karma | app/scripts/directives/focus.js | JavaScript | mit | 187 |
Subsets and Splits