answer stringlengths 15 1.25M |
|---|
// <auto-generated>
// This code was generated by a tool.
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
namespace Abide.HaloLibrary.Halo2.Retail.Tag.Generated
{
using System;
using Abide.HaloLibrary;
using Abide.HaloLibrary.Halo2.Retail.Tag;
<summary>
Represents the generated <API key> tag block.
</summary>
internal sealed class <API key> : Block
{
<summary>
Initializes a new instance of the <see cref="<API key>"/> class.
</summary>
public <API key>()
{
this.Fields.Add(new ExplanationField("MODE-n-STATE GRAPH", ""));
this.Fields.Add(new BlockField<AnimationModeBlock>("modes|AABBCC", 512));
this.Fields.Add(new ExplanationField("SPECIAL CASE ANIMS", ""));
this.Fields.Add(new BlockField<<API key>>("vehicle suspension|CCAABB", 32));
this.Fields.Add(new BlockField<<API key>>("object overlays|CCAABB", 32));
}
<summary>
Gets and returns the name of the <API key> tag block.
</summary>
public override string BlockName
{
get
{
return "<API key>";
}
}
<summary>
Gets and returns the display name of the <API key> tag block.
</summary>
public override string DisplayName
{
get
{
return "<API key>";
}
}
<summary>
Gets and returns the maximum number of elements allowed of the <API key> tag block.
</summary>
public override int MaximumElementCount
{
get
{
return 1;
}
}
<summary>
Gets and returns the alignment of the <API key> tag block.
</summary>
public override int Alignment
{
get
{
return 4;
}
}
}
} |
package se.nordicehealth.servlet.core.stats.containers;
import static org.junit.Assert.*;
import java.util.Arrays;
import java.util.List;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import se.nordicehealth.servlet.core.stats.containers.MultipleOption;
public class MultipleOptionTest {
MultipleOption mo;
int id = 1;
int option1 = 1;
int option2 = 2;
int option5 = 5;
List<Integer> options;
@Before
public void setUp() throws Exception {
options = Arrays.asList(option1, option2, option5);
mo = new MultipleOption(id, options);
}
@Test
public void testQuestion() {
Assert.assertEquals(id, mo.question());
}
@Test
public void <API key>() {
List<Object> l = mo.<API key>();
Assert.assertEquals(options.size(), l.size());
Assert.assertEquals(true, l.get(0) instanceof Integer);
Assert.assertEquals(option1, ((Integer) l.get(0)).intValue());
Assert.assertEquals(option2, ((Integer) l.get(1)).intValue());
Assert.assertEquals(option5, ((Integer) l.get(2)).intValue());
try {
Integer i = (Integer) l.get(3);
fail("Index 1 should throw <API key> but it returned '"+i+"'");
} catch (<API key> ignored) { }
try {
l.add(10);
fail("List should not be modifiable");
} catch (<API key> ignored) { }
}
} |
$(function () {
function footerPosition() {
$("index-footer").removeClass("fixed-bottom");
var contentHeight = document.body.scrollHeight,
winHeight = window.innerHeight;
if (contentHeight < winHeight) {
//footerfixed-bottom
$("footer").addClass("fixed-bottom");
}
}
footerPosition();
$(window).resize(footerPosition);
});
'use strict';
document.addEventListener('DOMContentLoaded', function () {
// Toggles
var $burgers = getAll('.burger');
if ($burgers.length > 0) {
$burgers.forEach(function ($el) {
$el.addEventListener('click', function () {
var target = $el.dataset.target;
var $target = document.getElementById(target);
$el.classList.toggle('is-active');
$target.classList.toggle('is-active');
});
});
}
// Modals
var $html = document.documentElement;
var $modals = getAll('.modal');
var $modalButtons = getAll('.modal-button');
var $modalCloses = getAll('.modal-background, .modal-close, .modal-card-head .delete, .modal-card-foot .button');
if ($modalButtons.length > 0) {
$modalButtons.forEach(function ($el) {
$el.addEventListener('click', function () {
var target = $el.dataset.target;
var $target = document.getElementById(target);
$html.classList.add('is-clipped');
$target.classList.add('is-active');
});
});
}
if ($modalCloses.length > 0) {
$modalCloses.forEach(function ($el) {
$el.addEventListener('click', function () {
$html.classList.remove('is-clipped');
closeModals();
});
});
}
document.addEventListener('keydown', function (e) {
if (e.keyCode === 27) {
$html.classList.remove('is-clipped');
closeModals();
}
});
function closeModals() {
$modals.forEach(function ($el) {
$el.classList.remove('is-active');
});
}
// Clipboard
var $highlights = getAll('.highlight');
var itemsProcessed = 0;
if ($highlights.length > 0) {
$highlights.forEach(function ($el) {
var copy = '<button class="copy">Copy</button>';
var expand = '<button class="expand">Expand</button>';
$el.insertAdjacentHTML('beforeend', copy);
if ($el.firstElementChild.scrollHeight > 480 && $el.firstElementChild.clientHeight <= 480) {
$el.insertAdjacentHTML('beforeend', expand);
}
itemsProcessed++;
if (itemsProcessed === $highlights.length) {
<API key>();
}
});
}
function <API key>() {
var $highlightButtons = getAll('.highlight .copy, .highlight .expand');
$highlightButtons.forEach(function ($el) {
$el.addEventListener('mouseenter', function () {
$el.parentNode.style.boxShadow = '0 0 0 1px #ed6c63';
});
$el.addEventListener('mouseleave', function () {
$el.parentNode.style.boxShadow = 'none';
});
});
var $highlightExpands = getAll('.highlight .expand');
$highlightExpands.forEach(function ($el) {
$el.addEventListener('click', function () {
$el.parentNode.firstElementChild.style.maxHeight = 'none';
});
});
}
// Functions
function getAll(selector) {
return Array.prototype.slice.call(document.querySelectorAll(selector), 0);
}
});
const ColorScheme = [
"rgb(236, 204, 104)", "rgb(255, 127, 80)", "rgb(255, 107, 129)", "rgb(164, 176, 190)",
"rgb(255, 165, 2)", "rgb(255, 99, 72)", "rgb(255, 71, 87)", "rgb(116, 125, 140)",
"rgb(123, 237, 159)", "rgb(112, 161, 255)", "rgb(83, 82, 237)", "rgb(223, 228, 234)",
"rgb(46, 213, 115)", "rgb(30, 144, 255)", "rgb(55, 66, 250)", "rgb(206, 214, 224)",
]
var getRandomColor = function () {
return ColorScheme[Math.floor(Math.random() * ColorScheme.length)]
}
var getRandomColorSets = function (num) {
var colorData = []
for (var i = 0; i < num; i++) {
colorData.push(getRandomColor())
}
return colorData
}
var genChart = function (chartId, chartType, config) {
/**
charId : id canvas
config : dict
congig = {
title:
labels :datalabel
data_title: data
data:
x_label : xlable
y_label : ylable
}
**/
data = {
labels: config.labels,
datasets: [{
label: config.data_title,
data: config.data,
backgroundColor: getRandomColorSets(config.data.length),
steppedLine: false,
fill: false,
}]
}
if (chartType == 'doughnut') {
options = {
title: {
display: true,
positon: 'top',
text: config.title,
},
legend: {
display: true,
position: 'bottom',
},
tooltip: {
enabled: false,
},
scaleOverlay: true,
}
if (config.labels.length > 3) {
options.legend.display = false
}
}
if (chartType == 'line') {
data.datasets[0].backgroundColor = getRandomColor()
data.datasets[0].borderColor = getRandomColor()
options = {
elements: {
point: {
radius: 2
}
},
responsive: true,
title: {
display: true,
text: config.title,
},
hover: {
mode: 'nearest',
intersect: true
},
legend: {
display: true,
},
scales: {
xAxes: [{
display: true,
scaleLabel: {
display: true,
labelString: config.x_label,
}
}],
yAxes: [{
display: true,
ticks: { beginAtZero: true },
scaleLabel: {
display: true,
labelString: config.y_label,
}
}]
}
}
}
if (chartType == 'bar') {
options = {
title: {
display: true,
text: config.title,
},
legend: {
display: false,
},
scales: {
xAxes: [{
display: true,
scaleLabel: {
display: true,
labelString: config.x_label,
}
}],
yAxes: [{
scaleLabel: {
display: true,
labelString: config.y_label,
},
ticks: {
beginAtZero: true,
stepSize: 1,
suggestedMax: 7
}
}]
}
}
}
var ctx = $('#' + chartId)
chart = new Chart(ctx, { type: chartType, data: data, options: options })
chart.update();
} |
import { <API key> } from "../../../../src/js/Applications/Background/Routers/Runtime";
describe("<API key>", () => {
it("", () => {
<API key>({ version: "xxx" });
});
}); |
BukkitUtilities - A reusable library for Bukkit.
=================================
BukkitUtilities is a library for the Minecraft wrapper [Bukkit](http://bukkit.org/) that enables rapid development of plugins by providing classes and interfaces for common tasks.
The aim of the library is to reduce the amount of boiler plate code which is duplicated between plugins and provide a consistent approach to a number of problems. At the moment it is used exclusively by all the plugins that I maintain or develop.
## Features
- Basic logging (ConsoleLogger also implements localisation)
- Localisation, allowing users to override and provide their own localisations.
- YAMLStorage wrapper around YAMLConfiguration for setting default configuration settings.
- SQLStorage custom implementation of EBean in Bukkit.
- Extendable basic plugin configuration.
- Command handling, including a CommandManager for nested commands.
- ColourFormatter for replacing colour names with colour codes.
- TimeFormatter for converting long to human readable time and back again.
- Basic metrics implementation.
- Automatic update checking based on referring to a Maven repository.
BukkitUtilities is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
BukkitUtilities is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
## Documentation
Many of the features specific to BukkitUtilities such as localisation, updater and database support are documented [here on the wiki](https://github.com/grandwazir/BukkitUtilities/wiki), rather than duplicate the same information several times over plugins which use the library. Please refer to this documentation rather than writing your own if you are using the library in your own plugin.
[JavaDocs](http:
## Installation
The likelihood is if you are using a plugin which requires BukkitUtilities, it has been included with the plugin and you do not need to download this separately. This is the preferred method of distribution at this time.
If however you wish to use BukkitUtilities in your own plugin, the best way to get a copy is add the following to the pom.xml of your Maven project. This will automatically download the dependency when you next compile your plugin.
<repositories>
<repository>
<id>my-repo</id>
<url>http://repository.james.richardson.name</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>name.richardson.james.bukkit</groupId>
<artifactId>bukkit-utilities</artifactId>
<version>RELEASE</version>
</dependency>
</dependencies>
Alternatively if you do not wish to use Maven you can download the latest version from [GitHub](https:
## Reporting issues
If you are a server administrator and you are encountering an issue with a plugin that uses BukkitUtilities, you should contact the author of that plugin directly for support. If you are a plugin developer and you want to make a bug report or feature request please do so using the [issue tracking](https://github.com/grandwazir/BukkitUtilities/issues) on GitHub. |
using System;
using System.Net;
using System.Threading;
namespace SocialParser.Sourcess
{
public abstract class <API key>:MetricsSource
{
protected WebClient webClient;
private DateTime lastAgentChangeTime;
private TimeSpan agentChangeTime;
protected Random rnd;
protected int minRequestDelay;
protected int maxRequestDelay;
public override TimeSpan ElapsedWhaitTime => TimeSpan.FromSeconds(maxRequestDelay/1.5);
protected <API key>()
{
webClient = new WebClient();
agentChangeTime = TimeSpan.FromMinutes(15);
rnd = new Random();
minRequestDelay = ProxyManager.IsDefined ? 5 : 10;
maxRequestDelay = ProxyManager.IsDefined ? 10 : 15;
SetUserAgent();
SetProxy();
}
public override Metrics GetMetrics(string href)
{
base.GetMetrics(href);
TryAvoidBan();
if (IsFromApi(href))
{
return GetMetricsFromApi(href);
}
Thread.Sleep(TimeSpan.FromSeconds(rnd.Next(minRequestDelay, maxRequestDelay)));
CheckUserAgent();
return GetMetricsFromWeb(href);
}
protected abstract bool IsFromApi(string href);
protected abstract Metrics GetMetricsFromApi(string href);
private void SetProxy()
{
if (ProxyManager.IsDefined)
webClient.Proxy = ProxyManager.CurrentProxy;
}
private void ClearProxy()
{
webClient.Proxy = null;
}
protected abstract Metrics GetMetricsFromWeb(string href);
protected abstract void TryAvoidBan();
private void CheckUserAgent()
{
if (DateTime.Now - lastAgentChangeTime > agentChangeTime)
SetUserAgent();
}
private void SetUserAgent()
{
webClient.Headers.Clear();
webClient.Headers.Add("user-agent", UserAgentManager.GetRandomAgent());
lastAgentChangeTime = DateTime.Now;
}
protected string GetHtml(Uri postInfoUri)
{
while (true)
{
int counter = 0;
// return webClient.DownloadString(postInfoUri);
while (counter < 5)
{
try
{
return webClient.DownloadString(postInfoUri);
}
catch (WebException)
{
counter++;
}
}
bool isProxyEnd = !ProxyManager.ChangeProxy();
if (isProxyEnd)
{
ClearProxy();
return webClient.DownloadString(postInfoUri);
}
SetProxy();
}
}
}
} |
package io.uve.yypush.json;
import com.fasterxml.jackson.databind.<API key>;
import com.fasterxml.jackson.databind.ObjectMapper;
/**
*
* @author yangyang21@staff.weibo.com(yangyang)
*
*/
public class JsonReader {
private static final ObjectMapper mapper = new ObjectMapper();
static {
mapper.configure(<API key>.<API key>, false);
}
public static ObjectMapper getObjectMapper() {
return mapper;
}
} |
#include <stdio.h>
main ()
{
int arr[3][3] = {
{1, 2, 3},
{4, 5, 6},
{7, 8, 9}
};
int *pa;
int i, j, k;
printf ("\nBefore...\n");
pa = (int*)arr;
for (i = 0; i < 9; i++) {
printf ("%d, ", *pa++);
if (!((i+1) % 3)) printf ("\n");
}
printf ("\nAfter...\n");
pa = (int*)arr;
k = 0;
for (i = 0; i < 9; i++) {
j = i * 3 - k;
printf ("%d, ", *(pa+j));
if (!((i+1) % 3)) {
printf ("\n");
k += 8;
}
}
} |
from contrib.rfc3736.builder import *
from contrib.rfc3736.constants import *
from contrib.rfc3736.dhcpv6 import DHCPv6Helper
from scapy.all import *
from veripy.assertions import *
class <API key>(DHCPv6Helper):
def run(self):
q = self.<API key>(self.node(1), self.target(1))
self.logger.info("Building a DHCPv6 Reply message...")
p = IPv6(src=str(self.node(1).link_local_ip()), dst=str(self.target(1).link_local_ip()))/\
UDP(sport=q.dport, dport=q.sport)/\
self.build_dhcpv6_reply(q, self.node(1), self.target(1), ias=False, dns_servers=[str(self.node(3).global_ip())], pref=False, server_id=False)
self.logger.info("Sending the DHCPv6 Reply message...")
self.node(1).send(p)
self.node(1).clear_received()
self.logger.info("Sending unexpected message...")
self.node(1).send(self.packet(p[0]))
r1 = self.node(1).iface(0).received(src=(self.target(1).link_local_ip()))
assertEqual(0, len(r1), "did not expect to receive any packets")
class <API key>(<API key>):
"""
Solicit Message
Verify that a client device properly discards all Solicit, Request, Confirm, Renew,
Rebind, Decline, Release, Information Request, Relay Forward and Relay Reply messages.
@private
Source: IPv6 Ready DHCPv6 Interoperability Test Suite (Section 7.1.8)
"""
def packet(self, q):
return IPv6(src=str(self.node(1).link_local_ip()), dst=str(self.target(1).link_local_ip()))/\
UDP(sport=q[UDP].dport, dport=q[UDP].sport)/\
self.<API key>(self.target(1))
class <API key>(<API key>):
"""
Request Message
Verify that a client device properly discards all Solicit, Request, Confirm, Renew,
Rebind, Decline, Release, Information Request, Relay Forward and Relay Reply messages.
@private
Source: IPv6 Ready DHCPv6 Interoperability Test Suite (Section 7.1.8)
"""
def packet(self, q):
return IPv6(src=str(self.node(1).link_local_ip()), dst=str(self.target(1).link_local_ip()))/\
UDP(sport=q[UDP].dport, dport=q[UDP].sport)/\
self.build_dhcpv6_reply(q, self.node(1), self.target(1), ias=False, dns_servers=[str(self.node(3).global_ip())], pref=False, server_id=False)
class <API key>(<API key>):
"""
Confirm Message
Verify that a client device properly discards all Solicit, Request, Confirm, Renew,
Rebind, Decline, Release, Information Request, Relay Forward and Relay Reply messages.
@private
Source: IPv6 Ready DHCPv6 Interoperability Test Suite (Section 7.1.8)
"""
def packet(self, q):
return IPv6(src=str(self.node(1).link_local_ip()), dst=str(self.target(1).link_local_ip()))/\
UDP(sport=q[UDP].dport, dport=q[UDP].sport)/\
self.build_dhcpv6_reply(q, self.node(1), self.target(1), ias=False, dns_servers=[str(self.node(3).global_ip())], pref=False, server_id=False)
class <API key>(<API key>):
"""
Renew Message
Verify that a client device properly discards all Solicit, Request, Confirm, Renew,
Rebind, Decline, Release, Information Request, Relay Forward and Relay Reply messages.
@private
Source: IPv6 Ready DHCPv6 Interoperability Test Suite (Section 7.1.8)
"""
def packet(self, q):
return IPv6(src=str(self.node(1).link_local_ip()), dst=str(self.target(1).link_local_ip()))/\
UDP(sport=q[UDP].dport, dport=q[UDP].sport)/\
self.build_dhcpv6_reply(q, self.node(1), self.target(1), ias=False, dns_servers=[str(self.node(3).global_ip())], pref=False, server_id=False)
class <API key>(<API key>):
"""
Rebind Message
Verify that a client device properly discards all Solicit, Request, Confirm, Renew,
Rebind, Decline, Release, Information Request, Relay Forward and Relay Reply messages.
@private
Source: IPv6 Ready DHCPv6 Interoperability Test Suite (Section 7.1.8)
"""
def packet(self, q):
return IPv6(src=str(self.node(1).link_local_ip()), dst=str(self.target(1).link_local_ip()))/\
UDP(sport=q[UDP].dport, dport=q[UDP].sport)/\
self.build_dhcpv6_reply(q, self.node(1), self.target(1), ias=False, dns_servers=[str(self.node(3).global_ip())], pref=False, server_id=False)
class <API key>(<API key>):
"""
Decline Message
Verify that a client device properly discards all Solicit, Request, Confirm, Renew,
Rebind, Decline, Release, Information Request, Relay Forward and Relay Reply messages.
@private
Source: IPv6 Ready DHCPv6 Interoperability Test Suite (Section 7.1.8)
"""
def packet(self, q):
return IPv6(src=str(self.node(1).link_local_ip()), dst=str(self.target(1).link_local_ip()))/\
UDP(sport=q[UDP].dport, dport=q[UDP].sport)/\
self.build_dhcpv6_reply(q, self.node(1), self.target(1), ias=False, dns_servers=[str(self.node(3).global_ip())], pref=False, server_id=False)
class <API key>(<API key>):
"""
Release Message
Verify that a client device properly discards all Solicit, Request, Confirm, Renew,
Rebind, Decline, Release, Information Request, Relay Forward and Relay Reply messages.
@private
Source: IPv6 Ready DHCPv6 Interoperability Test Suite (Section 7.1.8)
"""
def packet(self, q):
return IPv6(src=str(self.node(1).link_local_ip()), dst=str(self.target(1).link_local_ip()))/\
UDP(sport=q[UDP].dport, dport=q[UDP].sport)/\
self.build_dhcpv6_reply(q, self.node(1), self.target(1), ias=False, dns_servers=[str(self.node(3).global_ip())], pref=False, server_id=False)
class <API key>(<API key>):
"""
Information Request Message
Verify that a client device properly discards all Solicit, Request, Confirm, Renew,
Rebind, Decline, Release, Information Request, Relay Forward and Relay Reply messages.
@private
Source: IPv6 Ready DHCPv6 Interoperability Test Suite (Section 7.1.8)
"""
def packet(self, q):
return IPv6(src=str(self.node(1).link_local_ip()), dst=str(self.target(1).link_local_ip()))/\
UDP(sport=q[UDP].dport, dport=q[UDP].sport)/\
self.build_dhcpv6_reply(q, self.node(1), self.target(1), ias=False, dns_servers=[str(self.node(3).global_ip())], pref=False, server_id=False)
class <API key>(<API key>):
"""
Relay Forward Message
Verify that a client device properly discards all Solicit, Request, Confirm, Renew,
Rebind, Decline, Release, Information Request, Relay Forward and Relay Reply messages.
@private
Source: IPv6 Ready DHCPv6 Interoperability Test Suite (Section 7.1.8)
"""
def packet(self, q):
return IPv6(src=str(self.node(1).link_local_ip()), dst=str(self.target(1).link_local_ip()))/\
UDP(sport=q[UDP].dport, dport=q[UDP].sport)/\
self.build_dhcpv6_reply(q, self.node(1), self.target(1), ias=False, dns_servers=[str(self.node(3).global_ip())], pref=False, server_id=False)
class <API key>(<API key>):
"""
Relay Reply Message
Verify that a client device properly discards all Solicit, Request, Confirm, Renew,
Rebind, Decline, Release, Information Request, Relay Forward and Relay Reply messages.
@private
Source: IPv6 Ready DHCPv6 Interoperability Test Suite (Section 7.1.8)
"""
def packet(self, q):
return IPv6(src=str(self.node(1).link_local_ip()), dst=str(self.target(1).link_local_ip()))/\
UDP(sport=q[UDP].dport, dport=q[UDP].sport)/\
self.build_dhcpv6_reply(q, self.node(1), self.target(1), ias=False, dns_servers=[str(self.node(3).global_ip())], pref=False, server_id=False) |
let express = require("express"),
router = express.Router(),
bodyParser = require("body-parser"),
events = require("./api/eventRouter").router,
auth = require("./api/authRouter").router,
users = require("./api/userRouter").router;
router.all("*", bodyParser.json());
router.use([events, auth, users]);
exports.router = router; |
<?php
require_once(__DIR__ . '/../autoload.php');
$wp=new \QXS\WorkerPool\WorkerPool();
$wp->setWorkerPoolSize(4)
->create(new \QXS\WorkerPool\ClosureWorker(
/**
* The Worker::run() Method
* @param mixed $input the input from the WorkerPool::run() Method
* @param \QXS\WorkerPool\Semaphore $semaphore the semaphore to synchronize calls accross all workers
* @param \ArrayObject $storage a persistent storge for the current child process
*/
function($input, $semaphore, $storage) {
$storage->append($input);
echo "[".getmypid()."]"." hi $input\n";
sleep(rand(1,3)); // this is the working load!
return $input;
},
/**
* The Worker::onProcessCreate() Method
* @param \QXS\WorkerPool\Semaphore $semaphore the semaphore to synchronize calls accross all workers
* @param \ArrayObject $storage a persistent storge for the current child process
*/
function($semaphore, $storage) {
echo "[".getmypid()."]"." child has been created\n";
},
/**
* The Worker::onProcessDestroy() Method
* @param \QXS\WorkerPool\Semaphore $semaphore the semaphore to synchronize calls accross all workers
* @param \ArrayObject $storage a persistent storge for the current child process
*/
function($semaphore, $storage) {
$semaphore->synchronizedBegin();
echo "[".getmypid()."]"." child will be destroyed, see its history\n";
foreach($storage as $val) {
echo "\t$val\n";
}
$semaphore->synchronizedEnd();
}
)
);
for($i=0; $i<10; $i++) {
$wp->run($i);
}
$wp->waitForAllWorkers(); // wait for all workers
foreach($wp as $val) {
echo "Parent has retrieved: ".$val['data']."\n";
} |
<?php
?>
</div>
</main>
<?php wp_footer() ?>
</body>
</html> |
#!/bin/sh
#``Renaming Faces for CCNx''
# This file is part of ``Renaming Faces for CCNx''.
# ``Renaming Faces for CCNx'' is free software: you can redistribute it and/or modify
# the Free Software Foundation.
# ``Renaming Faces for CCNx'' is distributed in the hope that it will be useful,
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
JAR_FILE=ccn.jar
JAVA_HOME=${JAVA_HOME:=/usr}
JAVAC=$JAVA_HOME/bin/javac
SCRIPT_DIR=`dirname $0` |
import gtk
from plugin_base.find_extension import FindExtension
class SizeFindFiles(FindExtension):
"""Size extension for find files tool"""
def __init__(self, parent):
FindExtension.__init__(self, parent)
# create container
table = gtk.Table(2, 4, False)
table.set_border_width(5)
table.set_col_spacings(5)
# create interface
self._adjustment_max = gtk.Adjustment(value=50.0, lower=0.0, upper=100000.0, step_incr=0.1, page_incr=10.0)
self._adjustment_min = gtk.Adjustment(value=0.0, lower=0.0, upper=10.0, step_incr=0.1, page_incr=10.0)
label = gtk.Label('<b>{0}</b>'.format(_('Match file size')))
label.set_alignment(0.0, 0.5)
label.set_use_markup(True)
label_min = gtk.Label(_('Minimum:'))
label_min.set_alignment(0, 0.5)
label_min_unit = gtk.Label(_('MB'))
label_max = gtk.Label(_('Maximum:'))
label_max.set_alignment(0, 0.5)
label_max_unit = gtk.Label(_('MB'))
self._entry_max = gtk.SpinButton(adjustment=self._adjustment_max, digits=2)
self._entry_min = gtk.SpinButton(adjustment=self._adjustment_min, digits=2)
self._entry_max.connect('value-changed', self._max_value_changed)
self._entry_min.connect('value-changed', self._min_value_changed)
self._entry_max.connect('activate', self._parent.find_files)
self._entry_min.connect('activate', lambda entry: self._entry_max.grab_focus())
# pack interface
table.attach(label, 0, 3, 0, 1, xoptions=gtk.FILL)
table.attach(label_min, 0, 1, 1, 2, xoptions=gtk.FILL)
table.attach(self._entry_min, 1, 2, 1, 2, xoptions=gtk.FILL)
table.attach(label_min_unit, 2, 3, 1, 2, xoptions=gtk.FILL)
table.attach(label_max, 0, 1, 2, 3, xoptions=gtk.FILL)
table.attach(self._entry_max, 1, 2, 2, 3, xoptions=gtk.FILL)
table.attach(label_max_unit, 2, 3, 2, 3, xoptions=gtk.FILL)
self.vbox.pack_start(table, False, False, 0)
def _max_value_changed(self, entry):
"""Assign value to adjustment handler"""
self._adjustment_min.set_upper(entry.get_value())
def _min_value_changed(self, entry):
"""Assign value to adjustment handler"""
self._adjustment_max.set_lower(entry.get_value())
def get_title(self):
"""Return i18n title for extension"""
return _('Size')
def is_path_ok(self, path):
"""Check is specified path fits the cirteria"""
size = self._parent._provider.get_stat(path).size
size_max = self._entry_max.get_value() * 1048576
size_min = self._entry_min.get_value() * 1048576
return size_min < size < size_max |
package edu.txstate.its.gato;
import info.magnolia.ui.form.field.definition.<API key>;
/**
* <API key>.
*/
public class <API key> extends <API key> {
public <API key>() {
//filteringMode = 2 means that the user can type something in the
//select box and it will show options that start with the the text
//the user typed. Might want to change it to 1 (contains)
setFilteringMode(2);
}
} |
#ifndef <API key>
#define <API key>
#include "plMessage.h"
class PLASMA_DLL plCursorChangeMsg : public plMessage {
CREATABLE(plCursorChangeMsg, kCursorChangeMsg, plMessage)
public:
enum {
kNoChange, kCursorUp, kCursorLeft, kCursorRight,
kCursorDown, kCursorPoised, kCursorClicked, kCursorUnClicked,
kCursorHidden, kCursorOpen, kCursorGrab, kCursorArrow,
kNullCursor
};
protected:
int fType, fPriority;
public:
plCursorChangeMsg() : fType(kNoChange), fPriority(0) { }
virtual void read(hsStream* S, plResManager* mgr);
virtual void write(hsStream* S, plResManager* mgr);
protected:
virtual void IPrcWrite(pfPrcHelper* prc);
virtual void IPrcParse(const pfPrcTag* tag, plResManager* mgr);
public:
int getType() const { return fType; }
int getPriority() const { return fPriority; }
void setType(int value) { fType = value; }
void setPriority(int value) { fPriority = value; }
};
#endif |
#include <qmath.h>
#include "finExecAlg.h"
finExecAlg::finExecAlg()
{
/* Do Nothing because you should not call this constructor. */
return;
}
finErrorCode finExecAlg::<API key>(const QStringList &strlist, finExecVariable *outvar)
{
int curcol = 0;
outvar->setType(finExecVariable::TP_ARRAY);
if ( strlist.isEmpty() )
return finErrorKits::EC_REACH_BOTTOM;
outvar->preallocArrayLength(strlist.length());
foreach ( QString stritem, strlist ) {
finExecVariable *colvar = outvar->getVariableItemAt(curcol);
bool numok = false;
double valitem = stritem.toDouble(&numok);
if ( !numok )
valitem = 0.0;
colvar->setType(finExecVariable::TP_NUMERIC);
colvar->setNumericValue(valitem);
curcol++;
}
return finErrorKits::EC_SUCCESS;
}
finErrorCode finExecAlg::<API key>(const QStringList &strlist, finExecVariable *outvar)
{
int curcol = 0;
outvar->setType(finExecVariable::TP_ARRAY);
if ( strlist.isEmpty() )
return finErrorKits::EC_REACH_BOTTOM;
outvar->preallocArrayLength(strlist.length());
foreach ( QString stritem, strlist ) {
finExecVariable *colvar = outvar->getVariableItemAt(curcol);
colvar->setType(finExecVariable::TP_STRING);
colvar->setStringValue(stritem);
curcol++;
}
return finErrorKits::EC_SUCCESS;
}
finErrorCode finExecAlg::<API key>(const QStringList &strlist, finExecVariable *outvar)
{
int curcol = 0;
outvar->setType(finExecVariable::TP_ARRAY);
if ( strlist.isEmpty() )
return finErrorKits::EC_REACH_BOTTOM;
outvar->preallocArrayLength(strlist.length());
foreach ( QString stritem, strlist ) {
finExecVariable *colvar = outvar->getVariableItemAt(curcol);
bool numok = false;
double valitem = stritem.toDouble(&numok);
if ( numok ) {
colvar->setType(finExecVariable::TP_NUMERIC);
colvar->setNumericValue(valitem);
} else if ( stritem.isEmpty() ) {
colvar->setType(finExecVariable::TP_NULL);
} else {
colvar->setType(finExecVariable::TP_STRING);
colvar->setStringValue(stritem);
}
curcol++;
}
return finErrorKits::EC_SUCCESS;
}
static inline finErrorCode <API key>(finExecVariable *invar, QStringList *strlist)
{
if ( invar == nullptr || invar->getType() == finExecVariable::TP_NULL ) {
strlist->append(QString());
return finErrorKits::EC_NORMAL_WARN;
} else if ( invar->getType() == finExecVariable::TP_STRING || invar->getType() == finExecVariable::TP_IMAGE ) {
strlist->append(QString("0"));
return finErrorKits::EC_NORMAL_WARN;
} else if ( invar->getType() == finExecVariable::TP_NUMERIC ) {
strlist->append(QString::number(invar->getNumericValue()));
return finErrorKits::EC_SUCCESS;
} else {
return finErrorKits::EC_INVALID_PARAM;
}
}
finErrorCode finExecAlg::<API key>(finExecVariable *invar, QStringList *strlist)
{
strlist->clear();
if ( invar == nullptr || invar->getType() != finExecVariable::TP_ARRAY )
return <API key>(invar, strlist);
int itemcnt = invar->getArrayLength();
for ( int i = 0; i < itemcnt; i++ ) {
finExecVariable *itemvar = invar->getVariableItemAt(i);
<API key>(itemvar, strlist);
}
return finErrorKits::EC_SUCCESS;
}
static inline finErrorCode _appendVarToStrList(finExecVariable *invar, QStringList *strlist)
{
if ( invar == nullptr || invar->getType() == finExecVariable::TP_NULL ||
invar->getType() == finExecVariable::TP_IMAGE ) {
strlist->append(QString());
return finErrorKits::EC_NORMAL_WARN;
} else if ( invar->getType() == finExecVariable::TP_STRING ) {
strlist->append(invar->getStringValue());
return finErrorKits::EC_SUCCESS;
} else if ( invar->getType() == finExecVariable::TP_NUMERIC ) {
strlist->append(QString::number(invar->getNumericValue()));
return finErrorKits::EC_SUCCESS;
} else {
return finErrorKits::EC_INVALID_PARAM;
}
}
finErrorCode finExecAlg::<API key>(finExecVariable *invar, QStringList *strlist)
{
strlist->clear();
if ( invar == nullptr || invar->getType() != finExecVariable::TP_ARRAY )
return _appendVarToStrList(invar, strlist);
int itemcnt = invar->getArrayLength();
for ( int i = 0; i < itemcnt; i++ ) {
finExecVariable *itemvar = invar->getVariableItemAt(i);
_appendVarToStrList(itemvar, strlist);
}
return finErrorKits::EC_SUCCESS;
}
finErrorCode finExecAlg::<API key>(const QString &csstr, finExecVariable *outvar)
{
QString trimstr = csstr.trimmed();
if ( trimstr.isEmpty() ) {
outvar->setType(finExecVariable::TP_ARRAY);
return finErrorKits::EC_REACH_BOTTOM;
}
return <API key>(trimstr.split(','), outvar);
}
finErrorCode finExecAlg::<API key>(const QString &csstr, finExecVariable *outvar)
{
QString trimstr = csstr.trimmed();
if ( trimstr.isEmpty() ) {
outvar->setType(finExecVariable::TP_ARRAY);
return finErrorKits::EC_REACH_BOTTOM;
}
return <API key>(trimstr.split(','), outvar);
}
finErrorCode finExecAlg::csStringToArrayVar(const QString &csstr, finExecVariable *outvar)
{
QString trimstr = csstr.trimmed();
if ( trimstr.isEmpty() ) {
outvar->setType(finExecVariable::TP_ARRAY);
return finErrorKits::EC_REACH_BOTTOM;
}
return <API key>(trimstr.split(','), outvar);
}
QString finExecAlg::<API key>(finExecVariable *invar)
{
QStringList strlist;
finErrorCode errcode = <API key>(invar, &strlist);
if ( finErrorKits::isErrorResult(errcode) )
return QString();
return strlist.join(',');
}
QString finExecAlg::arrayVarToCsString(finExecVariable *invar)
{
QStringList strlist;
finErrorCode errcode = <API key>(invar, &strlist);
if ( finErrorKits::isErrorResult(errcode) )
return QString();
return strlist.join(',');
}
static inline finErrorCode _appendVarToNumList(finExecVariable *invar, QList<double> *list)
{
if ( invar == nullptr || invar->getType() == finExecVariable::TP_NULL ) {
return finErrorKits::EC_NORMAL_WARN;
} else if ( invar->getType() == finExecVariable::TP_STRING || invar->getType() == finExecVariable::TP_IMAGE ) {
list->append(0.0);
return finErrorKits::EC_NORMAL_WARN;
} else if ( invar->getType() == finExecVariable::TP_NUMERIC ) {
list->append(invar->getNumericValue());
return finErrorKits::EC_SUCCESS;
} else {
return finErrorKits::EC_INVALID_PARAM;
}
}
finErrorCode finExecAlg::numArrayVarToList(finExecVariable *invar, QList<double> *list)
{
list->clear();
if ( invar == nullptr || invar->getType() != finExecVariable::TP_ARRAY )
return _appendVarToNumList(invar, list);
int itemcnt = invar->getArrayLength();
for ( int i = 0; i < itemcnt; i++ ) {
finExecVariable *itemvar = invar->getVariableItemAt(i);
_appendVarToNumList(itemvar, list);
}
return finErrorKits::EC_SUCCESS;
}
finErrorCode finExecAlg::numMatVarToList(finExecVariable *invar, QList<QList<double>> *list)
{
list->clear();
if ( invar == nullptr || invar->getType() != finExecVariable::TP_ARRAY ) {
QList<double> tmplist;
finErrorCode errcode = _appendVarToNumList(invar, &tmplist);
list->append(tmplist);
return errcode;
}
int itemcnt = invar->getArrayLength();
for ( int i = 0; i < itemcnt; i++ ) {
finExecVariable *itemvar = invar->getVariableItemAt(i);
QList<double> itemlist;
numArrayVarToList(itemvar, &itemlist);
list->append(itemlist);
}
return finErrorKits::EC_SUCCESS;
}
finErrorCode finExecAlg::listToNumArrayVar(const QList<double> &list, finExecVariable *outvar)
{
outvar->setType(finExecVariable::TP_ARRAY);
outvar->preallocArrayLength(list.length());
int idx = 0;
foreach ( double val, list ) {
finExecVariable *itemvar = outvar->getVariableItemAt(idx);
itemvar->setType(finExecVariable::TP_NUMERIC);
itemvar->setNumericValue(val);
idx++;
}
return finErrorKits::EC_SUCCESS;
}
finErrorCode finExecAlg::listToNumMatVar(const QList<QList<double>> &list, finExecVariable *outvar)
{
outvar->setType(finExecVariable::TP_ARRAY);
outvar->preallocArrayLength(list.length());
int idx = 0;
foreach ( const QList<double> &sublist, list ) {
finExecVariable *itemvar = outvar->getVariableItemAt(idx);
listToNumArrayVar(sublist, itemvar);
idx++;
}
return finErrorKits::EC_SUCCESS;
}
finErrorCode finExecAlg::listMatrixToArray(const QList< QList<double> > &inlist, QList<double> *outlist)
{
if ( outlist == nullptr )
return finErrorKits::EC_NULL_POINTER;
outlist->clear();
foreach ( const QList<double> &sublist, inlist ) {
foreach ( double item, sublist ) {
outlist->append(item);
}
}
return finErrorKits::EC_SUCCESS;
}
static finErrorCode _appendSubVar(finExecVariable *outvar, finExecVariable *subvar, int startpos, int *endpos)
{
if ( subvar == nullptr || subvar->getType() == finExecVariable::TP_NULL ) {
*endpos = startpos;
return finErrorKits::EC_NORMAL_WARN;
}
if ( subvar->getType() != finExecVariable::TP_ARRAY ) {
outvar->preallocArrayLength(startpos + 1);
finExecVariable *outitem = outvar->getVariableItemAt(startpos);
if ( outitem == nullptr )
return finErrorKits::EC_OUT_OF_MEMORY;
outitem->copyVariable(subvar);
*endpos = startpos + 1;
return finErrorKits::EC_SUCCESS;
}
finErrorCode errcode;
int sublen = subvar->getArrayLength();
outvar->preallocArrayLength(startpos + sublen);
for ( int i = 0; i < sublen; i++ ) {
finExecVariable *initem = subvar->getVariableItemAt(i);
finExecVariable *outitem = outvar->getVariableItemAt(startpos + i);
if ( initem == nullptr || outitem == nullptr )
return finErrorKits::EC_OUT_OF_MEMORY;
errcode = outitem->copyVariable(initem);
if ( finErrorKits::isErrorResult(errcode) )
return errcode;
}
*endpos = startpos + sublen;
return finErrorKits::EC_SUCCESS;
}
finErrorCode finExecAlg::varMatrixToArray(finExecVariable *invar, finExecVariable *outvar)
{
if ( invar == nullptr || outvar == nullptr )
return finErrorKits::EC_NULL_POINTER;
int pos = 0;
outvar->setType(finExecVariable::TP_ARRAY);
if ( invar->getType() != finExecVariable::TP_ARRAY )
return _appendSubVar(outvar, invar, 0, &pos);
finErrorCode errcode;
int rowcnt = invar->getArrayLength();
for ( int rowidx = 0; rowidx < rowcnt; rowidx++ ) {
finExecVariable *inrowvar = invar->getVariableItemAt(rowidx);
errcode = _appendSubVar(outvar, inrowvar, pos, &pos);
if ( finErrorKits::isErrorResult(errcode) )
return errcode;
}
return finErrorKits::EC_SUCCESS;
}
finErrorCode finExecAlg::varArrayCut(finExecVariable *invar, int from, int to, finExecVariable *outvar)
{
if ( invar == nullptr || outvar == nullptr )
return finErrorKits::EC_NULL_POINTER;
if ( invar->getType() != finExecVariable::TP_ARRAY )
return finErrorKits::EC_INVALID_PARAM;
int inlen = invar->getArrayLength();
from = (from < 0 ? 0 : from);
to = ((to > inlen || to < 0) ? inlen : to);
int realfrom = (from < to ? from : to);
int realto = (from < to ? to : from);
finErrorCode errcode;
outvar->setType(finExecVariable::TP_ARRAY);
outvar->preallocArrayLength(realto - realfrom);
for (int outi = 0, ini = from; ini < to; outi++, ini++) {
finExecVariable *initem = invar->getVariableItemAt(ini);
finExecVariable *outitem = outvar->getVariableItemAt(outi);
if ( initem == nullptr || outitem == nullptr )
return finErrorKits::EC_OUT_OF_MEMORY;
errcode = outitem->copyVariable(initem);
if ( finErrorKits::isErrorResult(errcode) )
return errcode;
}
return finErrorKits::EC_SUCCESS;
}
finErrorCode finExecAlg::varArrayJoin(const QList<finExecVariable *> &invarlist, finExecVariable *outvar)
{
if ( outvar == nullptr )
return finErrorKits::EC_NULL_POINTER;
int pos = 0;
outvar->setType(finExecVariable::TP_ARRAY);
foreach ( finExecVariable *invar, invarlist ) {
finErrorCode errcode = _appendSubVar(outvar, invar, pos, &pos);
if ( finErrorKits::isErrorResult(errcode) )
return errcode;
}
return finErrorKits::EC_SUCCESS;
}
finErrorCode finExecAlg::listArrayNeg(const QList<double> &inlist, QList<double> *outlist)
{
if ( outlist == nullptr )
return finErrorKits::EC_NULL_POINTER;
outlist->clear();
foreach ( double val, inlist) {
outlist->append(-val);
}
return finErrorKits::EC_SUCCESS;
}
finErrorCode finExecAlg::listArrayAdd(const QList<double> &inlist1, const QList<double> &inlist2,
QList<double> *outlist)
{
if ( outlist == nullptr )
return finErrorKits::EC_NULL_POINTER;
if ( inlist1.length() != inlist2.length() )
return finErrorKits::EC_INVALID_PARAM;
int len = inlist1.length();
outlist->clear();
for ( int i = 0; i < len; i++ ) {
double val1 = inlist1.at(i);
double val2 = inlist2.at(i);
outlist->append(val1 + val2);
}
return finErrorKits::EC_SUCCESS;
}
finErrorCode finExecAlg::listArraySub(const QList<double> &inlist1, const QList<double> &inlist2,
QList<double> *outlist)
{
if ( outlist == nullptr )
return finErrorKits::EC_NULL_POINTER;
if ( inlist1.length() != inlist2.length() )
return finErrorKits::EC_INVALID_PARAM;
int len = inlist1.length();
outlist->clear();
for ( int i = 0; i < len; i++ ) {
double val1 = inlist1.at(i);
double val2 = inlist2.at(i);
outlist->append(val1 - val2);
}
return finErrorKits::EC_SUCCESS;
}
finErrorCode finExecAlg::listArraySum(const QList<double> &inlist, double *outval)
{
if ( outval == nullptr )
return finErrorKits::EC_NULL_POINTER;
double sumval = 0.0;
foreach ( double val, inlist ) {
sumval += val;
}
*outval = sumval;
return finErrorKits::EC_SUCCESS;
}
finErrorCode finExecAlg::listArrayAvg(const QList<double> &inlist, double *outval)
{
if ( outval == nullptr )
return finErrorKits::EC_NULL_POINTER;
if ( inlist.length() == 0 ) {
*outval = 0.0;
return finErrorKits::EC_NORMAL_WARN;
}
double sumval = 0.0;
finErrorCode errcode = listArraySum(inlist, &sumval);
if ( finErrorKits::isErrorResult(errcode) )
return errcode;
*outval = sumval / inlist.length();
return finErrorKits::EC_SUCCESS;
}
finErrorCode finExecAlg::listVectorNorm(const QList<double> &inlist, double *outval)
{
if ( outval == nullptr )
return finErrorKits::EC_NULL_POINTER;
double norm2 = 0.0;
foreach ( double val, inlist ) {
norm2 += val * val;
}
*outval = sqrt(norm2);
return finErrorKits::EC_SUCCESS;
}
finErrorCode finExecAlg::listVectorNorm1(const QList<double> &inlist, double *outval)
{
if ( outval == nullptr )
return finErrorKits::EC_NULL_POINTER;
double norm = 0.0;
foreach ( double val, inlist ) {
norm += fabs(val);
}
*outval = norm;
return finErrorKits::EC_SUCCESS;
}
finErrorCode finExecAlg::listVectorNormP(const QList<double> &inlist, double p, double *outval)
{
if ( outval == nullptr )
return finErrorKits::EC_NULL_POINTER;
double normp = 0.0;
foreach ( double val, inlist ) {
normp += pow(fabs(val), p);
}
*outval = pow(normp, 1.0 / p);
return finErrorKits::EC_SUCCESS;
}
finErrorCode finExecAlg::listVectorNormInf(const QList<double> &inlist, double *outval)
{
if ( outval == nullptr )
return finErrorKits::EC_NULL_POINTER;
double normmax = 0.0;
foreach ( double val, inlist ) {
if ( fabs(val) > normmax )
normmax = fabs(val);
}
*outval = normmax;
return finErrorKits::EC_SUCCESS;
}
finErrorCode finExecAlg::listVectorNormalize(const QList<double> &inlist, QList<double> *outlist)
{
if ( outlist == nullptr )
return finErrorKits::EC_NULL_POINTER;
double norm = 1.0;
finErrorCode errcode = listVectorNorm(inlist, &norm);
if ( finErrorKits::isErrorResult(errcode) )
norm = 1.0;
outlist->clear();
foreach ( double val, inlist ) {
outlist->append(val/norm);
}
return finErrorKits::EC_SUCCESS;
}
finErrorCode finExecAlg::listVectorDot(const QList<double> &inlist1, const QList<double> &inlist2, double *outval)
{
if ( outval == nullptr )
return finErrorKits::EC_NULL_POINTER;
int len = inlist1.length();
if ( len > inlist2.length() )
len = inlist2.length();
double retval = 0.0;
for ( int i = 0; i < len; i++ ) {
double val1 = inlist1.at(i);
double val2 = inlist2.at(i);
retval += val1 * val2;
}
*outval = retval;
return finErrorKits::EC_SUCCESS;
}
finErrorCode finExecAlg::varArrayNeg(finExecVariable *invar, finExecVariable *outvar)
{
if ( invar == nullptr || outvar == nullptr )
return finErrorKits::EC_NULL_POINTER;
if ( !invar->isNumericArray() )
return finErrorKits::EC_INVALID_PARAM;
QList<double> inlist, outlist;
numArrayVarToList(invar, &inlist);
finErrorCode errcode = listArrayNeg(inlist, &outlist);
if ( finErrorKits::isErrorResult(errcode) )
return errcode;
return listToNumArrayVar(outlist, outvar);
}
finErrorCode finExecAlg::varArrayAdd(finExecVariable *invar1, finExecVariable *invar2, finExecVariable *outvar)
{
if ( invar1 == nullptr || invar2 == nullptr || outvar == nullptr )
return finErrorKits::EC_NULL_POINTER;
int varlen1 = 0, varlen2 = 0;
bool isary1 = invar1->isNumericArray(&varlen1);
bool isary2 = invar2->isNumericArray(&varlen2);
if ( !isary1 || !isary2 )
return finErrorKits::EC_INVALID_PARAM;
if ( varlen1 != varlen2 )
return finErrorKits::EC_INVALID_PARAM;
QList<double> inlist1, inlist2, outlist;
numArrayVarToList(invar1, &inlist1);
numArrayVarToList(invar2, &inlist2);
finErrorCode errcode = listArrayAdd(inlist1, inlist2, &outlist);
if ( finErrorKits::isErrorResult(errcode) )
return errcode;
return listToNumArrayVar(outlist, outvar);
}
finErrorCode finExecAlg::varArraySub(finExecVariable *invar1, finExecVariable *invar2, finExecVariable *outvar)
{
if ( invar1 == nullptr || invar2 == nullptr || outvar == nullptr )
return finErrorKits::EC_NULL_POINTER;
int varlen1 = 0, varlen2 = 0;
bool isary1 = invar1->isNumericArray(&varlen1);
bool isary2 = invar2->isNumericArray(&varlen2);
if ( !isary1 || !isary2 )
return finErrorKits::EC_INVALID_PARAM;
if ( varlen1 != varlen2 )
return finErrorKits::EC_INVALID_PARAM;
QList<double> inlist1, inlist2, outlist;
numArrayVarToList(invar1, &inlist1);
numArrayVarToList(invar2, &inlist2);
finErrorCode errcode = listArraySub(inlist1, inlist2, &outlist);
if ( finErrorKits::isErrorResult(errcode) )
return errcode;
return listToNumArrayVar(outlist, outvar);
}
finErrorCode finExecAlg::varArraySum(finExecVariable *invar, finExecVariable *outvar)
{
if ( invar == nullptr || outvar == nullptr )
return finErrorKits::EC_NULL_POINTER;
if ( !invar->isNumericArray() )
return finErrorKits::EC_INVALID_PARAM;
QList<double> inlist;
numArrayVarToList(invar, &inlist);
double outval = 0.0;
finErrorCode errcode = listArraySum(inlist, &outval);
if ( finErrorKits::isErrorResult(errcode) )
return errcode;
outvar->setType(finExecVariable::TP_NUMERIC);
outvar->setNumericValue(outval);
return finErrorKits::EC_SUCCESS;
}
finErrorCode finExecAlg::varArrayAvg(finExecVariable *invar, finExecVariable *outvar)
{
if ( invar == nullptr || outvar == nullptr )
return finErrorKits::EC_NULL_POINTER;
if ( !invar->isNumericArray() )
return finErrorKits::EC_INVALID_PARAM;
QList<double> inlist;
numArrayVarToList(invar, &inlist);
double outval = 0.0;
finErrorCode errcode = listArrayAvg(inlist, &outval);
if ( finErrorKits::isErrorResult(errcode) )
return errcode;
outvar->setType(finExecVariable::TP_NUMERIC);
outvar->setNumericValue(outval);
return finErrorKits::EC_SUCCESS;
}
finErrorCode finExecAlg::varVectorNorm(finExecVariable *invar, finExecVariable *outvar)
{
if ( invar == nullptr || outvar == nullptr )
return finErrorKits::EC_NULL_POINTER;
if ( !invar->isNumericArray() )
return finErrorKits::EC_INVALID_PARAM;
QList<double> inlist;
numArrayVarToList(invar, &inlist);
double outval = 0.0;
finErrorCode errcode = listVectorNorm(inlist, &outval);
if ( finErrorKits::isErrorResult(errcode) )
return errcode;
outvar->setType(finExecVariable::TP_NUMERIC);
outvar->setNumericValue(outval);
return finErrorKits::EC_SUCCESS;
}
finErrorCode finExecAlg::varVectorNorm1(finExecVariable *invar, finExecVariable *outvar)
{
if ( invar == nullptr || outvar == nullptr )
return finErrorKits::EC_NULL_POINTER;
if ( !invar->isNumericArray() )
return finErrorKits::EC_INVALID_PARAM;
QList<double> inlist;
numArrayVarToList(invar, &inlist);
double outval = 0.0;
finErrorCode errcode = listVectorNorm1(inlist, &outval);
if ( finErrorKits::isErrorResult(errcode) )
return errcode;
outvar->setType(finExecVariable::TP_NUMERIC);
outvar->setNumericValue(outval);
return finErrorKits::EC_SUCCESS;
}
finErrorCode finExecAlg::varVectorNormP(finExecVariable *invar, finExecVariable *pvar, finExecVariable *outvar)
{
if ( invar == nullptr || pvar == nullptr || outvar == nullptr )
return finErrorKits::EC_NULL_POINTER;
if ( !invar->isNumericArray() )
return finErrorKits::EC_INVALID_PARAM;
if ( pvar->getType() != finExecVariable::TP_NUMERIC )
return finErrorKits::EC_INVALID_PARAM;
QList<double> inlist;
numArrayVarToList(invar, &inlist);
double p = pvar->getNumericValue();
double outval = 0.0;
finErrorCode errcode = listVectorNormP(inlist, p, &outval);
if ( finErrorKits::isErrorResult(errcode) )
return errcode;
outvar->setType(finExecVariable::TP_NUMERIC);
outvar->setNumericValue(outval);
return finErrorKits::EC_SUCCESS;
}
finErrorCode finExecAlg::varVectorNormInf(finExecVariable *invar, finExecVariable *outvar)
{
if ( invar == nullptr || outvar == nullptr )
return finErrorKits::EC_NULL_POINTER;
if ( !invar->isNumericArray() )
return finErrorKits::EC_INVALID_PARAM;
QList<double> inlist;
numArrayVarToList(invar, &inlist);
double outval = 0.0;
finErrorCode errcode = listVectorNormInf(inlist, &outval);
if ( finErrorKits::isErrorResult(errcode) )
return errcode;
outvar->setType(finExecVariable::TP_NUMERIC);
outvar->setNumericValue(outval);
return finErrorKits::EC_SUCCESS;
}
finErrorCode finExecAlg::varVectorNormalize(finExecVariable *invar, finExecVariable *outvar)
{
if ( invar == nullptr || outvar == nullptr )
return finErrorKits::EC_NULL_POINTER;
if ( !invar->isNumericArray() )
return finErrorKits::EC_INVALID_PARAM;
QList<double> inlist, outlist;
numArrayVarToList(invar, &inlist);
finErrorCode errcode = listVectorNormalize(inlist, &outlist);
if ( finErrorKits::isErrorResult(errcode) )
return errcode;
return listToNumArrayVar(outlist, outvar);
}
finErrorCode finExecAlg::varVectorDot(finExecVariable *invar1, finExecVariable *invar2, finExecVariable *outvar)
{
if ( invar1 == nullptr || invar2 == nullptr || outvar == nullptr )
return finErrorKits::EC_NULL_POINTER;
int varlen1 = 0, varlen2 = 0;
bool isary1 = invar1->isNumericArray(&varlen1);
bool isary2 = invar2->isNumericArray(&varlen2);
if ( !isary1 || !isary2 )
return finErrorKits::EC_INVALID_PARAM;
if ( varlen1 != varlen2 )
return finErrorKits::EC_INVALID_PARAM;
QList<double> inlist1, inlist2;
numArrayVarToList(invar1, &inlist1);
numArrayVarToList(invar2, &inlist2);
double outval = 0.0;
finErrorCode errcode = listVectorDot(inlist1, inlist2, &outval);
if ( finErrorKits::isErrorResult(errcode) )
return errcode;
outvar->setType(finExecVariable::TP_NUMERIC);
outvar->setNumericValue(outval);
return finErrorKits::EC_SUCCESS;
}
finErrorCode finExecAlg::listMatTranspose(const QList<QList<double>> &inlist, QList<QList<double>> *outlist)
{
if ( outlist == nullptr )
return finErrorKits::EC_NULL_POINTER;
int outrow = 0, outcol = inlist.length();
foreach ( const QList<double> &sublist, inlist ) {
if ( sublist.length() > outrow )
outrow = sublist.length();
}
outlist->clear();
for ( int r = 0; r < outrow; r++ ) {
QList<double> outsublist;
for ( int c = 0; c < outcol; c++ ) {
double val = 0.0;
const QList<double> &insublist = inlist.at(c);
if ( r < insublist.length() )
val = insublist.at(r);
outsublist.append(val);
}
outlist->append(outsublist);
}
return finErrorKits::EC_SUCCESS;
}
finErrorCode finExecAlg::listMatAdd(const QList<QList<double>> &inlist1, const QList<QList<double>> &inlist2,
QList<QList<double>> *outlist)
{
if ( outlist == nullptr )
return finErrorKits::EC_NULL_POINTER;
if ( inlist1.length() != inlist2.length() )
return finErrorKits::EC_INVALID_PARAM;
int len = inlist1.length();
outlist->clear();
for ( int i = 0; i < len; i++ ) {
const QList<double> &insublist1 = inlist1.at(i);
const QList<double> &insublist2 = inlist2.at(i);
QList<double> outsublist;
finErrorCode errcode = listArrayAdd(insublist1, insublist2, &outsublist);
if ( finErrorKits::isErrorResult(errcode) )
return errcode;
outlist->append(outsublist);
}
return finErrorKits::EC_SUCCESS;
}
finErrorCode finExecAlg::listMatSub(const QList<QList<double>> &inlist1, const QList<QList<double>> &inlist2,
QList<QList<double>> *outlist)
{
if ( outlist == nullptr )
return finErrorKits::EC_NULL_POINTER;
if ( inlist1.length() != inlist2.length() )
return finErrorKits::EC_INVALID_PARAM;
int len = inlist1.length();
outlist->clear();
for ( int i = 0; i < len; i++ ) {
const QList<double> &insublist1 = inlist1.at(i);
const QList<double> &insublist2 = inlist2.at(i);
QList<double> outsublist;
finErrorCode errcode = listArraySub(insublist1, insublist2, &outsublist);
if ( finErrorKits::isErrorResult(errcode) )
return errcode;
outlist->append(outsublist);
}
return finErrorKits::EC_SUCCESS;
}
finErrorCode finExecAlg::listMatDot(const QList<QList<double>> &inlist1, const QList<QList<double>> &inlist2,
QList<QList<double>> *outlist)
{
if ( outlist == nullptr )
return finErrorKits::EC_NULL_POINTER;
finErrorCode errcode;
QList<QList<double>> inlist2t;
errcode = listMatTranspose(inlist2, &inlist2t);
if ( finErrorKits::isErrorResult(errcode) )
return errcode;
outlist->clear();
foreach ( const QList<double> &in1row, inlist1 ) {
QList<double> outrow;
foreach ( const QList<double> &in2col, inlist2t ) {
int len = in1row.length();
if ( len != in2col.length() )
return finErrorKits::EC_INVALID_PARAM;
double itemval = 0.0;
for ( int i = 0; i < len; i++ ) {
double in1item = in1row.at(i);
double in2item = in2col.at(i);
itemval += in1item * in2item;
}
outrow.append(itemval);
}
outlist->append(outrow);
}
return finErrorKits::EC_SUCCESS;
}
finErrorCode finExecAlg::varMatTranspose(finExecVariable *invar, finExecVariable *outvar)
{
if ( invar == nullptr || outvar == nullptr )
return finErrorKits::EC_NULL_POINTER;
if ( !invar->isNumericMatrix() )
return finErrorKits::EC_INVALID_PARAM;
QList<QList<double>> inlist, outlist;
numMatVarToList(invar, &inlist);
finErrorCode errcode = listMatTranspose(inlist, &outlist);
if ( finErrorKits::isErrorResult(errcode) )
return errcode;
return listToNumMatVar(outlist, outvar);
}
finErrorCode finExecAlg::varMatAdd(finExecVariable *invar1, finExecVariable *invar2, finExecVariable *outvar)
{
if ( invar1 == nullptr || invar2 == nullptr || outvar == nullptr )
return finErrorKits::EC_NULL_POINTER;
int varrow1 = 0, varcol1 = 0, varrow2 = 0, varcol2 = 0;
bool ismat1 = invar1->isNumericMatrix(&varrow1, &varcol1);
bool ismat2 = invar2->isNumericMatrix(&varrow2, &varcol2);
if ( !ismat1 || !ismat2 )
return finErrorKits::EC_INVALID_PARAM;
if ( varrow1 != varrow2 || varcol1 != varcol2 )
return finErrorKits::EC_INVALID_PARAM;
QList<QList<double>> inlist1, inlist2, outlist;
numMatVarToList(invar1, &inlist1);
numMatVarToList(invar2, &inlist2);
finErrorCode errcode = listMatAdd(inlist1, inlist2, &outlist);
if ( finErrorKits::isErrorResult(errcode) )
return errcode;
return listToNumMatVar(outlist, outvar);
}
finErrorCode finExecAlg::varMatSub(finExecVariable *invar1, finExecVariable *invar2, finExecVariable *outvar)
{
if ( invar1 == nullptr || invar2 == nullptr || outvar == nullptr )
return finErrorKits::EC_NULL_POINTER;
int varrow1 = 0, varcol1 = 0, varrow2 = 0, varcol2 = 0;
bool ismat1 = invar1->isNumericMatrix(&varrow1, &varcol1);
bool ismat2 = invar2->isNumericMatrix(&varrow2, &varcol2);
if ( !ismat1 || !ismat2 )
return finErrorKits::EC_INVALID_PARAM;
if ( varrow1 != varrow2 || varcol1 != varcol2 )
return finErrorKits::EC_INVALID_PARAM;
QList<QList<double>> inlist1, inlist2, outlist;
numMatVarToList(invar1, &inlist1);
numMatVarToList(invar2, &inlist2);
finErrorCode errcode = listMatSub(inlist1, inlist2, &outlist);
if ( finErrorKits::isErrorResult(errcode) )
return errcode;
return listToNumMatVar(outlist, outvar);
}
finErrorCode finExecAlg::varMatDot(finExecVariable *invar1, finExecVariable *invar2, finExecVariable *outvar)
{
if ( invar1 == nullptr || invar2 == nullptr || outvar == nullptr )
return finErrorKits::EC_NULL_POINTER;
int varrow1 = 0, varcol1 = 0, varrow2 = 0, varcol2 = 0;
bool ismat1 = invar1->isNumericMatrix(&varrow1, &varcol1);
bool ismat2 = invar2->isNumericMatrix(&varrow2, &varcol2);
if ( !ismat1 || !ismat2 )
return finErrorKits::EC_INVALID_PARAM;
if ( varcol1 != varrow2 )
return finErrorKits::EC_INVALID_PARAM;
QList< QList<double> > inlist1, inlist2, outlist;
numMatVarToList(invar1, &inlist1);
numMatVarToList(invar2, &inlist2);
finErrorCode errcode = listMatDot(inlist1, inlist2, &outlist);
if ( finErrorKits::isErrorResult(errcode) )
return errcode;
return listToNumMatVar(outlist, outvar);
} |
package com.mx.fic.inventory.endpoint.ws;
import java.util.List;
import javax.ejb.EJB;
import javax.ws.rs.Consumes;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.mx.fic.inventory.business.TimeUnitBeanLocal;
import com.mx.fic.inventory.business.exception.<API key>;
import com.mx.fic.inventory.dto.TimeUnitDTO;
import com.mx.fic.inventory.endpoint.response.Message;
import com.mx.fic.inventory.endpoint.response.TimeUnitResponse;
@Path("/timeUnit")
public class TimeUnitWS {
@EJB(mappedName="TimeUnitBean")
TimeUnitBeanLocal timeUnitBean;
private static final Logger logger = LoggerFactory.getLogger(TimeUnitWS.class);
@POST
@Path("saveTimeUnit")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
public Response saveTimeUnit(final TimeUnitDTO timeUnitDTO) throws <API key>{
logger.info("Entra a guardar la unidad de tiempo => "+ timeUnitDTO);
TimeUnitResponse response = new TimeUnitResponse();
Message message = new Message();
logger.info("saveTimeUnit");
try{
if((timeUnitDTO!= null && timeUnitDTO.getName()!=null) &&
timeUnitDTO.getCompanyId()!=null){
timeUnitBean.save(timeUnitDTO);
message.setCode(200);
message.setMessage("exito");
}else{
message.setCode(400);
message.setMessage("error => Elementos requeridos vienen nulos, favor de validar");
}
} catch (<API key> e) {
message.setCode(500);
message.setMessage("error => Error interno");
logger.error("Persistence=> " + e);
} catch (Exception e){
message.setCode(500);
message.setMessage("error => Error interno");
logger.error("Exception => " + e);
}
response.setMessage(message);
return Response.status(message.getCode()).entity(response).build();
}
@POST
@Path("<API key>/{companyId}")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
public Response <API key>(@PathParam("companyId") Integer companyId){
logger.info("Entra a obtener la unidad de tiempo de la compañía => "+ companyId);
TimeUnitResponse response = new TimeUnitResponse();
List<TimeUnitDTO> timeUnitDTOLst = null;
Message message = new Message();
try{
if(companyId!=null){
timeUnitDTOLst = timeUnitBean.getAllByCompany(companyId);
response.setTimeUnitDTOLst(timeUnitDTOLst);
message.setCode(200);
message.setMessage("exito");
}else{
message.setCode(400);
message.setMessage("error => Es requerido el id de la compañía");
}
}catch(<API key> e){
message.setCode(500);
message.setMessage("error => Error interno");
logger.error("Persistence=> " + e);
}catch (Exception e){
message.setCode(500);
message.setMessage("error => Error interno");
logger.error("Exception => " + e);
}
response.setMessage(message);
return Response.status(message.getCode()).entity(response).build();
}
} |
from .people import IDPersonScraper
from .bills import IDBillScraper
from utils import url_xpath, State
# from .committees import IDCommitteeScraper
class Idaho(State):
scrapers = {
"people": IDPersonScraper,
# 'committees': IDCommitteeScraper,
"bills": IDBillScraper,
}
<API key> = [
{
"_scraped_name": "2011 Session",
"classification": "primary",
"identifier": "2011",
"name": "61st Legislature, 1st Regular Session (2011)",
"start_date": "2011-01-10",
"end_date": "2011-04-07",
},
{
"_scraped_name": "2012 Session",
"classification": "primary",
"identifier": "2012",
"name": "61st Legislature, 2nd Regular Session (2012)",
"start_date": "2012-01-09",
"end_date": "2012-03-29",
},
{
"_scraped_name": "2013 Session",
"classification": "primary",
"identifier": "2013",
"name": "62nd Legislature, 1st Regular Session (2013)",
"start_date": "2013-01-07",
"end_date": "2013-04-04",
},
{
"_scraped_name": "2014 Session",
"classification": "primary",
"identifier": "2014",
"name": "63nd Legislature, 1st Regular Session (2014)",
"start_date": "2014-01-06",
"end_date": "2014-03-21",
},
{
"_scraped_name": "2015 Session",
"classification": "primary",
"identifier": "2015",
"name": "64th Legislature, 1st Regular Session (2015)",
"start_date": "2015-01-12",
"end_date": "2015-04-10",
},
{
"_scraped_name": "2015 Extraordinary Session",
"classification": "special",
"identifier": "2015spcl",
"name": "65th Legislature, 1st Extraordinary Session (2015)",
"start_date": "2015-05-18",
"end_date": "2015-05-18",
},
{
"_scraped_name": "2016 Session",
"classification": "primary",
"identifier": "2016",
"name": "63rd Legislature, 2nd Regular Session (2016)",
"start_date": "2016-01-11",
"end_date": "2016-03-25",
},
{
"_scraped_name": "2017 Session",
"classification": "primary",
"identifier": "2017",
"name": "64th Legislature, 1st Regular Session (2017)",
"start_date": "2017-01-09",
"end_date": "2017-04-07",
},
{
"_scraped_name": "2018 Session",
"classification": "primary",
"identifier": "2018",
"name": "64th Legislature, 2nd Regular Session (2018)",
"start_date": "2018-01-08",
"end_date": "2018-03-27",
},
{
"_scraped_name": "2019 Session",
"classification": "primary",
"identifier": "2019",
"name": "65th Legislature, 1st Regular Session (2019)",
"start_date": "2019-01-07",
"end_date": "2019-03-29",
},
{
"_scraped_name": "2020 Session",
"classification": "primary",
"identifier": "2020",
"name": "65th Legislature, 2nd Regular Session (2020)",
"start_date": "2020-01-06",
"end_date": "2020-03-27",
},
{
"_scraped_name": "2020 Extraordinary Session",
"classification": "special",
"identifier": "2020spcl",
"name": "65th Legislature, First Extraordinary Session (2020)",
"start_date": "2020-08-24",
# TODO: Set real end date after session completes
"end_date": "2020-08-28",
},
# "_scraped_name": "2021 Session",
# "classification": "primary",
# "identifier": "2021",
# "name": "66th Legislature, 1st Regular Session (2021)",
# "start_date": "2020-01-11",
# "end_date": "2020-04-07",
]
<API key> = [
"2021 Session",
"2020 Session",
"2010 Session",
"2009 Session",
"2008 Session",
"2007 Session",
"2006 Extraordinary Session",
"2006 Session",
"2005 Session",
"2004 Session",
"2003 Session",
"2002 Session",
"2001 Session",
"2000 Extraordinary Session",
"2000 Session",
"1999 Session",
"1998 Session",
]
def get_session_list(self):
return url_xpath(
"https://legislature.idaho.gov/sessioninfo/",
'//select[@id="ddlsessions"]/option/text()',
) |
<!DOCTYPE html PUBLIC "-
<html xmlns="http:
<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.11"/>
<title>AStarPathPlanning: Class Members - Variables</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 id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">AStarPathPlanning
</div>
<div id="projectbrief">While Acme robot is on automation mode and plan to move from an origin to a goal, this project helps to find the path with the shortest path.</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.11 -->
<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="pages.html"><span>Related Pages</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>
<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="inherits.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><a href="functions.html"><span>All</span></a></li>
<li><a href="functions_func.html"><span>Functions</span></a></li>
<li class="current"><a href="functions_vars.html"><span>Variables</span></a></li>
<li><a href="functions_type.html"><span>Typedefs</span></a></li>
<li><a href="functions_enum.html"><span>Enumerations</span></a></li>
<li><a href="functions_eval.html"><span>Enumerator</span></a></li>
<li><a href="functions_rela.html"><span>Related Functions</span></a></li>
</ul>
</div>
<div id="navrow4" class="tabs3">
<ul class="tablist">
<li><a href="functions_vars.html#index_a"><span>a</span></a></li>
<li><a href="functions_vars_b.html#index_b"><span>b</span></a></li>
<li><a href="functions_vars_c.html#index_c"><span>c</span></a></li>
<li><a href="functions_vars_d.html#index_d"><span>d</span></a></li>
<li><a href="functions_vars_e.html#index_e"><span>e</span></a></li>
<li><a href="functions_vars_f.html#index_f"><span>f</span></a></li>
<li><a href="functions_vars_h.html#index_h"><span>h</span></a></li>
<li><a href="functions_vars_i.html#index_i"><span>i</span></a></li>
<li><a href="functions_vars_k.html#index_k"><span>k</span></a></li>
<li><a href="functions_vars_l.html#index_l"><span>l</span></a></li>
<li><a href="functions_vars_m.html#index_m"><span>m</span></a></li>
<li><a href="functions_vars_n.html#index_n"><span>n</span></a></li>
<li class="current"><a href="functions_vars_o.html#index_o"><span>o</span></a></li>
<li><a href="functions_vars_p.html#index_p"><span>p</span></a></li>
<li><a href="functions_vars_q.html#index_q"><span>q</span></a></li>
<li><a href="functions_vars_r.html#index_r"><span>r</span></a></li>
<li><a href="functions_vars_s.html#index_s"><span>s</span></a></li>
<li><a href="functions_vars_t.html#index_t"><span>t</span></a></li>
<li><a href="functions_vars_u.html#index_u"><span>u</span></a></li>
<li><a href="functions_vars_v.html#index_v"><span>v</span></a></li>
<li><a href="functions_vars_w.html#index_w"><span>w</span></a></li>
<li><a href="functions_vars_x.html#index_x"><span>x</span></a></li>
<li><a href="functions_vars_y.html#index_y"><span>y</span></a></li>
<li><a href="functions_vars_z.html#index_z"><span>z</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="<API key>">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div class="contents">
 
<h3><a class="anchor" id="index_o"></a>- o -</h3><ul>
<li>one_bits_
: <a class="el" href="<API key>.html#<API key>">testing::gmock_matchers_test::FloatingPointTest< RawType ></a>
</li>
<li>opener
: <a class="el" href="<API key>.html#<API key>">upload.AbstractRpcServer</a>
</li>
<li>options
: <a class="el" href="<API key>.html#<API key>">upload.<API key></a>
</li>
<li>output
: <a class="el" href="<API key>.html#<API key>">gtest_test_utils.Subprocess</a>
, <a class="el" href="<API key>.html#<API key>">testing::Flags</a>
</li>
<li>output_dir_
: <a class="el" href="<API key>.html#<API key>"><API key>.<API key></a>
</li>
</ul>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.11
</small></address>
</body>
</html> |
from __future__ import unicode_literals
import datetime
from django.db import models
from django.utils import timezone
# Create your models here.
class Question(models.Model):
question_text = models.CharField(max_length=200)
pub_date = models.DateTimeField('date published')
def __str__(self):
return self.question_text
def <API key>(self):
now = timezone.now()
return now - datetime.timedelta(days=1) <= self.pub_date <= now
class Choice(models.Model):
question = models.ForeignKey(Question, on_delete=models.CASCADE)
choice_text = models.CharField(max_length=200)
votes = models.IntegerField(default=0)
def __str__(self):
return self.choice_text |
#ifndef PSP_MODEXPORT_H_
#define PSP_MODEXPORT_H_
struct _PspLibraryEntry {
const char * name;
unsigned short version;
unsigned short attribute;
unsigned char entLen;
unsigned char varCount;
unsigned short funcCount;
void * entrytable;
};
#endif |
function DPD() {
}
DPD.prototype.getAuthor = function() {
return "Sebastian Hammerl";
}
DPD.prototype.getVersion = function() {
return "1.0";
}
DPD.prototype.getColor = function() {
return "#e37286";
}
DPD.prototype.init = function(id, callbackStatus, callbackDetails, callbackMetadata, callbackError) {
this.id = id;
this.callbackStatus = callbackStatus;
this.callbackDetails = callbackDetails;
this.callbackMetadata = callbackMetadata;
this.callbackError = callbackError;
};
DPD.prototype.getTrackingUrl = function() {
if(LANG == "de")
return "https://extranet.dpd.de/cgi-bin/delistrack?pknr=" + this.id + "&typ=1&lang=de";
return "https://extranet.dpd.de/cgi-bin/delistrack?pknr=" + this.id + "&typ=1&lang=en";
}
DPD.prototype.getDetails = function() {
var request = new Ajax.Request(this.getTrackingUrl(), {
method: 'get',
evalJS: 'false',
evalJSON: 'false',
onSuccess: this.<API key>.bind(this),
onFailure: this.<API key>.bind(this)
});
};
DPD.prototype.<API key> = function(response) {
var responseText = response.responseText;
var status = 0;
if(responseText.split("<br>Einrollung").length > 1 || responseText.split("<br>Pick-up").length > 1) {
status = 1;
}
if(responseText.split("<br>HUB-Durchlauf").length > 1 || responseText.split("<br>Hub scan").length > 1) {
status = 2;
}
if(responseText.split("<br>Eingang").length > 1 || responseText.split("<br>Inbound").length > 1) {
status = 3;
}
if(responseText.split("<br>Ausrollung").length > 1 || responseText.split("<br>Out for delivery").length > 1) {
status = 4;
}
if(responseText.split("<br>Zustellung").length > 1 || responseText.split("<br>Delivered").length > 1) {
status = 5;
}
if(responseText.split("Ein Fehler ist aufgetreten").length > 1 || responseText.split("An error has occurred").length > 1) {
status = -1;
}
this.callbackStatus(status);
if(status > 0) {
var details = [];
var details2 = responseText.split("<tr class=\"\"");
for (var i=1; i<details2.length; i++) {
var tmp = details2[i].split("<td style=\"padding-left: 10px;\">");
var tmpDate = tmp[1].split(" <br>")[0];
var tmpTime = tmp[1].split(" <br>")[1];
tmpTime = tmpTime.split(" </td>")[0];
tmpDate = tmpDate + " " + tmpTime;
var tmpLoc = tmp[2].split("</a><br> ")[1];
tmpLoc = tmpLoc.split("</td>")[0];
var tmpNotes = tmp[3].split("<br>")[1];
tmpNotes = tmpNotes.split(";")[0];
details.push({date: tmpDate, location: tmpLoc, notes: tmpNotes});
if(details2[i].split("Code-Beschreibung").length > 1)
break;
}
details = details.reverse();
this.callbackDetails(details.clone());
}
};
DPD.prototype.<API key> = function(response) {
this.callbackError("Konnte Seite nicht laden.");
};
registerService("DPD", new DPD()); |
# Oswald Hurlem's Unity Vector Library and Generator
Use [Unity.Mathematics](https://github.com/Unity-Technologies/Unity.Mathematics) instead.
Unity has announced that [future versions of its engine will feature a non-verbose math library with integer-based vectors](https://youtu.be/tGmnZdY5Y-E?t=1h5m12s). Therefore, this repository will no longer be updated, and I encourage you not to use it.
## What does it do?
This is a library that includes several types of non-float vector types, including int vectors. It adds many operations for vector types, and is generated by a python script.
The vector types, and most functions, are implemented in both C++ and C#, with identical memory layouts. Unity's Vector# types are also implemented in C++. This makes writing and utilizing native code easier and more fun, as I can personally attest. Crucially, neither language's implementation is a wrapper around the other, which would prevent inlining and create slow code.
## Vector as in... ?
As in a set of 2-4 numbers represention a point in 2-4-dimensional space. Not an arbitarily-sized list of arbitrarily typed values. Not what you provide to SIMD functions.
## Development/Epistemic status
I am a C++ and C
Breaking changes to names and calling conventions are not out of the question. In particular, I may replace VectorI2 and VectorI3 with the Vector2Int and Vector3Int types introduced in Unity 2017.2, and then updating the naming convention of other non-float vectors to match these. I personally do not like that naming convention, so this is totally contingent upon whether Vector#Int becomes prevalent in Unity's and others' codebases.
## Sample code
C
C
using OH;
using OH.Ext;
public static class Dumb
{
public static double Example(VectorB2 byteVector)
{
var six = OHV.MkVectorB2(6); // (6, 6)
return byteVector.ElRem(six) // Element-wise remainder
.XXYY() // Swizzled to a VectorB4
.MkVectorD4B() // Convert to a double vector
.Volume(); // Get product of all four components;
// All of these are available as non-extension methods as well via OHV.*
}
}
C++
C++
#include "oh_vectors_unity.h"
double DumbExample(VectorB2 byteVector)
{
auto six = MkVectorB2(6); // (6, 6)
return Volume(
MkVectorD4B(
SwizzXXYY(
ElRem(byteVector, six)
)
)
);
}
## Features
* Vectors that use Byte, Int32, and Double as components.
* It's generated code, but very easy to read for the most part.
* Implements most built-in Unity functions with an (IMO) better naming scheme, plus many more.
* The added vector types do not implicitly cast
* Identical method names across each type, but no functions where they don't make sense (e.g. no normalizing integer vectors).
* Swizzles! Swizzle between any two vectors with the same component type. Allows you to use underscores to blank members out.
* Conversion from float to integer vectors rounds to -Infinity like God intended.
* All functions are pure! All functions look like functions! Say goodbye to Unity's impure .Normalize() function and sqrt-concealing .normalized property.
* Implemented as both extension methods and non-extension methods.
* With the upgraded Mono Runtime, `using static OH.OHV;` lets you call vector operations without giving the class name.
* `using OH.Ext;` gives you all functions as extension methods.
* Mix and match to choose how much work Intellisense has to do. Or use both so that it's just like [UFCS](https://en.wikipedia.org/wiki/<API key>)!
* Compact inspector for all vector types.
## Usage
Copy UnityVector\*.cs into your Assets folder. You will need to provide implementations for a few simple math functions. Mine can be found in ExtraMath.cs.
For C++ code, you'll need to provide the math functions as well as a few typedefs. I do this in testBuild.cpp
To use the python script, you must have Interpy installed.
## TODO
* Reimplement remaining Unity Vector functions.
* Convert integer vectors to array indices.
* Interactions with rectangles, rays, and angles.
* Improve flexibility of code generator.
* Unit tests using some established Vector library??
* Add SIMD/SOA types
* Add ISPC codegen/compatibility
* Some of the required math functions (such as Div() for float types) shouldn't be required.
* MAYBE: Generate C instead of C++
* MAYBE: Use Unity's Vector#Int types for compatibility and change naming scheme to be consistent.
## Please!!
Let me know if you are using this library, how you're using it, and what you'd like changed or added. |
'''
Coursera:
- Software Defined Networking (SDN) course
-- Network Virtualization
Professor: Nick Feamster
Teaching Assistant: Arpit Gupta
'''
from pox.core import core
from collections import defaultdict
import pox.openflow.libopenflow_01 as of
import pox.openflow.discovery
import pox.openflow.spanning_tree
from pox.lib.revent import *
from pox.lib.util import dpid_to_str
from pox.lib.util import dpidToStr
from pox.lib.addresses import IPAddr, EthAddr
from collections import namedtuple
import os
log = core.getLogger()
class VideoSlice (EventMixin):
def __init__(self):
self.listenTo(core.openflow)
core.openflow_discovery.addListeners(self)
# Adjacency map. [sw1][sw2] -> port from sw1 to sw2
self.adjacency = defaultdict(lambda:defaultdict(lambda:None))
'''
The structure of self.portmap is a four-tuple key and a string value.
The type is:
(dpid string, src MAC addr, dst MAC addr, port (int)) -> dpid of next switch
'''
self.portmap = {
# h1 <-- port 80 --> h3
('00-00-00-00-00-01', EthAddr('00:00:00:00:00:01'),
EthAddr('00:00:00:00:00:03'), 80): '00-00-00-00-00-03',
# """ Add your mapping logic here"""
('00-00-00-00-00-03', EthAddr('00:00:00:00:00:01'),
EthAddr('00:00:00:00:00:03'), 80): '00-00-00-00-00-04',
('00-00-00-00-00-03', EthAddr('00:00:00:00:00:03'),
EthAddr('00:00:00:00:00:01'), 80): '00-00-00-00-00-01',
('00-00-00-00-00-04', EthAddr('00:00:00:00:00:03'),
EthAddr('00:00:00:00:00:01'), 80): '00-00-00-00-00-03',
#port 22
('00-00-00-00-00-01', EthAddr('00:00:00:00:00:01'),
EthAddr('00:00:00:00:00:03'), 22): '00-00-00-00-00-02',
('00-00-00-00-00-02', EthAddr('00:00:00:00:00:01'),
EthAddr('00:00:00:00:00:03'), 22): '00-00-00-00-00-04',
('00-00-00-00-00-04', EthAddr('00:00:00:00:00:03'),
EthAddr('00:00:00:00:00:01'), 22): '00-00-00-00-00-02',
('00-00-00-00-00-02', EthAddr('00:00:00:00:00:03'),
EthAddr('00:00:00:00:00:01'), 22): '00-00-00-00-00-01',
#h2--h4
('00-00-00-00-00-01', EthAddr('00:00:00:00:00:02'),
EthAddr('00:00:00:00:00:04'), 80): '00-00-00-00-00-03',
('00-00-00-00-00-03', EthAddr('00:00:00:00:00:02'),
EthAddr('00:00:00:00:00:04'), 80): '00-00-00-00-00-04',
('00-00-00-00-00-04', EthAddr('00:00:00:00:00:04'),
EthAddr('00:00:00:00:00:02'), 80): '00-00-00-00-00-03',
('00-00-00-00-00-03', EthAddr('00:00:00:00:00:04'),
EthAddr('00:00:00:00:00:02'), 80): '00-00-00-00-00-01',
('00-00-00-00-00-01', EthAddr('00:00:00:00:00:02'),
EthAddr('00:00:00:00:00:04'), 22): '00-00-00-00-00-02',
('00-00-00-00-00-02', EthAddr('00:00:00:00:00:02'),
EthAddr('00:00:00:00:00:04'), 22): '00-00-00-00-00-04',
('00-00-00-00-00-02', EthAddr('00:00:00:00:00:04'),
EthAddr('00:00:00:00:00:02'), 22): '00-00-00-00-00-01',
('00-00-00-00-00-04', EthAddr('00:00:00:00:00:04'),
EthAddr('00:00:00:00:00:02'), 22): '00-00-00-00-00-02',
#h1-h4
('00-00-00-00-00-01', EthAddr('00:00:00:00:00:01'),
EthAddr('00:00:00:00:00:04'), 80): '00-00-00-00-00-03',
('00-00-00-00-00-03', EthAddr('00:00:00:00:00:01'),
EthAddr('00:00:00:00:00:04'), 80): '00-00-00-00-00-04',
('00-00-00-00-00-04', EthAddr('00:00:00:00:00:04'),
EthAddr('00:00:00:00:00:01'), 80): '00-00-00-00-00-03',
('00-00-00-00-00-03', EthAddr('00:00:00:00:00:04'),
EthAddr('00:00:00:00:00:01'), 80): '00-00-00-00-00-01',
('00-00-00-00-00-01', EthAddr('00:00:00:00:00:01'),
EthAddr('00:00:00:00:00:04'), 22): '00-00-00-00-00-02',
('00-00-00-00-00-02', EthAddr('00:00:00:00:00:01'),
EthAddr('00:00:00:00:00:04'), 22): '00-00-00-00-00-04',
('00-00-00-00-00-04', EthAddr('00:00:00:00:00:04'),
EthAddr('00:00:00:00:00:01'), 22): '00-00-00-00-00-02',
('00-00-00-00-00-02', EthAddr('00:00:00:00:00:04'),
EthAddr('00:00:00:00:00:01'), 22): '00-00-00-00-00-01',
#h2-h3
('00-00-00-00-00-01', EthAddr('00:00:00:00:00:02'),
EthAddr('00:00:00:00:00:03'), 80): '00-00-00-00-00-03',
('00-00-00-00-00-03', EthAddr('00:00:00:00:00:02'),
EthAddr('00:00:00:00:00:03'), 80): '00-00-00-00-00-04',
('00-00-00-00-00-04', EthAddr('00:00:00:00:00:03'),
EthAddr('00:00:00:00:00:02'), 80): '00-00-00-00-00-03',
('00-00-00-00-00-03', EthAddr('00:00:00:00:00:03'),
EthAddr('00:00:00:00:00:02'), 80): '00-00-00-00-00-01',
('00-00-00-00-00-01', EthAddr('00:00:00:00:00:02'),
EthAddr('00:00:00:00:00:03'), 22): '00-00-00-00-00-02',
('00-00-00-00-00-02', EthAddr('00:00:00:00:00:02'),
EthAddr('00:00:00:00:00:03'), 22): '00-00-00-00-00-04',
('00-00-00-00-00-04', EthAddr('00:00:00:00:00:03'),
EthAddr('00:00:00:00:00:02'), 22): '00-00-00-00-00-02',
('00-00-00-00-00-02', EthAddr('00:00:00:00:00:03'),
EthAddr('00:00:00:00:00:02'), 22): '00-00-00-00-00-01',
}
def _handle_LinkEvent (self, event):
l = event.link
sw1 = dpid_to_str(l.dpid1)
sw2 = dpid_to_str(l.dpid2)
log.debug ("link %s[%d] <-> %s[%d]",
sw1, l.port1,
sw2, l.port2)
self.adjacency[sw1][sw2] = l.port1
self.adjacency[sw2][sw1] = l.port2
def _handle_PacketIn (self, event):
"""
Handle packet in messages from the switch to implement above algorithm.
"""
packet = event.parsed
tcpp = event.parsed.find('tcp')
def install_fwdrule(event,packet,outport):
msg = of.ofp_flow_mod()
msg.idle_timeout = 10
msg.hard_timeout = 30
msg.match = of.ofp_match.from_packet(packet, event.port)
msg.actions.append(of.ofp_action_output(port = outport))
msg.data = event.ofp
msg.in_port = event.port
event.connection.send(msg)
def forward (message = None):
this_dpid = dpid_to_str(event.dpid)
if packet.dst.is_multicast:
print "Destination multicast, flooding the packet."
flood()
return
else:
log.debug("Got unicast packet for %s at %s (input port %d):",
packet.dst, dpid_to_str(event.dpid), event.port)
key_map = ()
try:
# """ Add your logic here""""
print "Inside add your logic"
print packet.find('tcp')
key_map = (this_dpid, packet.src, packet.dst, packet.find('tcp').dstport)
if not self.portmap.get(key_map):
key_map = (this_dpid, packet.src, packet.dst, packet.find('tcp').srcport)
if not self.portmap.get(key_map):
raise AttributeError
print "FOUND: " + str(key_map)
next_dpid = self.portmap[key_map]
install_fwdrule(event,packet,self.adjacency[this_dpid][next_dpid])
except AttributeError:
log.debug("packet type has no transport ports, flooding")
print "FLOOD: " + str(key_map)
# flood and install the flow table entry for the flood
install_fwdrule(event,packet,of.OFPP_FLOOD)
# flood, but don't install the rule
def flood (message = None):
""" Floods the packet """
msg = of.ofp_packet_out()
msg.actions.append(of.ofp_action_output(port = of.OFPP_FLOOD))
msg.data = event.ofp
msg.in_port = event.port
event.connection.send(msg)
forward()
def <API key>(self, event):
dpid = dpidToStr(event.dpid)
log.debug("Switch %s has come up.", dpid)
def launch():
# Run spanning tree so that we can deal with topologies with loops
pox.openflow.discovery.launch()
pox.openflow.spanning_tree.launch()
'''
Starting the Video Slicing module
'''
core.registerNew(VideoSlice) |
package game;
import core.gameManagers.MenuManager;
import gui.panel.GamePage;
public class SinglePlayerState extends AbstractGameState {
public SinglePlayerState(GamePage... gamePages) {
super(gamePages);
}
@Override
public void loadState() {
MenuManager.getInstance().startGame();
}
} |
package net.datacrow.core.modules;
/**
* This exception is thrown when an exception occurred during the upgrade of a module.
* @author Robert Jan van der Waals
*/
public class <API key> extends Exception {
private static final long serialVersionUID = <API key>;
public <API key>(Exception exp) {
super("An error occurred while upgrading a module (using the add, remove and alter XML files): " + exp.getMessage(), exp);
}
} |
# -*- coding: utf-8 -*-
"""
Grill logging module.
"""
# standard
from __future__ import annotations
import logging
from pathlib import Path
from naming import NameConfig
from grill.names import DateTimeFile
_LOG_FILE_SUFFIX = 'log'
class ErrorFilter(logging.Filter):
"""
Pass any message meant for stderr.
"""
def filter(self, record):
"""
If the record does is not logging.INFO, return True
"""
return record.levelno > logging.INFO
class OutFilter(logging.Filter):
"""
Pass any message meant for stderr.
"""
def filter(self, record):
"""
If the record does is logging.INFO, return True
"""
return record.levelno <= logging.INFO
class LogFile(DateTimeFile):
"""docstring for LogFile"""
config = dict(
log_name=r'[\w\.]+',
log_filter=r'\d+',
)
file_config = NameConfig(dict(suffix=_LOG_FILE_SUFFIX))
@property
def path(self):
return Path(r'~/grill').expanduser() / super().name
@property
def _defaults(self):
result = super()._defaults
result.update(
log_name='grill',
log_filter=logging.INFO,
suffix=_LOG_FILE_SUFFIX,
)
return result |
package com.Ntut.runnable;
import android.os.Handler;
import com.Ntut.utility.CreditConnector;
import java.util.ArrayList;
public class <API key> extends BaseRunnable {
private String year;
private int index;
public <API key>(Handler handler, String year, int index) {
super(handler);
this.year = year;
this.index = index;
}
@Override
public void run() {
try {
ArrayList<String> result = CreditConnector.getDepartmentList(year,
index);
sendRefreshMessage(result);
} catch (Exception e) {
sendErrorMessage(e.getMessage());
}
}
} |
#include "global.h"
#include "guid.h"
// #ifndef BUILD_EFI
// /* EFI has %g for this, so it's only needed in platform c */
// const char *guid_to_str(EFI_GUID *guid)
// static char str[256];
// sprintf(str, "%08x-%04hx-%04hx-%02hhx%02hhx-%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx",
// guid->Data1, guid->Data2, guid->Data3,
// guid->Data4[0], guid->Data4[1], guid->Data4[2],
// guid->Data4[3], guid->Data4[4], guid->Data4[5],
// guid->Data4[6], guid->Data4[7]);
// return str;
// void str_to_guid(const char *str, EFI_GUID *guid)
// sscanf(str, "%8x-%4hx-%4hx-%2hhx%2hhx-%2hhx%2hhx%2hhx%2hhx%2hhx%2hhx",
// &guid->Data1, &guid->Data2, &guid->Data3,
// guid->Data4, guid->Data4 + 1, guid->Data4 + 2,
// guid->Data4 + 3, guid->Data4 + 4, guid->Data4 + 5,
// guid->Data4 + 6, guid->Data4 + 7);
// #endif
/* all the necessary guids */
EFI_GUID GV_GUID = EFI_GLOBAL_VARIABLE;
EFI_GUID SIG_DB = { 0xd719b2cb, 0x3d3a, 0x4596, {0xa3, 0xbc, 0xda, 0xd0, 0xe, 0x67, 0x65, 0x6f }};
EFI_GUID X509_GUID = { 0xa5c059a1, 0x94e4, 0x4aa7, {0x87, 0xb5, 0xab, 0x15, 0x5c, 0x2b, 0xf0, 0x72} };
EFI_GUID RSA2048_GUID = { 0x3c5766e8, 0x269c, 0x4e34, {0xaa, 0x14, 0xed, 0x77, 0x6e, 0x85, 0xb3, 0xb6} };
EFI_GUID PKCS7_GUID = { 0x4aafd29d, 0x68df, 0x49ee, {0x8a, 0xa9, 0x34, 0x7d, 0x37, 0x56, 0x65, 0xa7} };
EFI_GUID IMAGE_PROTOCOL = <API key>;
EFI_GUID SIMPLE_FS_PROTOCOL = <API key>;
EFI_GUID <API key> = { 0xc1c41626, 0x504c, 0x4092, { 0xac, 0xa9, 0x41, 0xf9, 0x36, 0x93, 0x43, 0x28 } };
EFI_GUID MOK_OWNER = { 0x605dab50, 0xe046, 0x4300, {0xab, 0xb6, 0x3d, 0xd8, 0x10, 0xdd, 0x8b, 0x23} };
EFI_GUID <API key> = { 0xA46423E3, 0x4617, 0x49f1, {0xB9, 0xFF, 0xD1, 0xBF, 0xA9, 0x11, 0x58, 0x39 } };
EFI_GUID <API key> = { 0x94ab2f58, 0x1438, 0x4ef1, {0x91, 0x52, 0x18, 0x94, 0x1a, 0x3a, 0x0e, 0x68 } }; |
// This program is free software: you can redistribute it and/or modify
// (at your option) any later version.
// This program is distributed in the hope that it will be useful,
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
namespace Esuli.MiPai.Index
{
using System;
using System.Collections.Generic;
using Esuli.Base.Enumerators;
using Esuli.Base.IO.Storage;
using Esuli.MiPai.DistanceFunctions;
using Esuli.Scheggia.Core;
using Esuli.Scheggia.Enumerators;
public class <API key><Tfeatures>
: IPostingEnumerator<Tfeatures>
{
public static IPostingEnumerator<Tfeatures> Build(Tfeatures query, KeyValuePair<int, int>[] ranges, <API key><Tfeatures> storageReader, IDistanceFunction<Tfeatures> distanceFunction)
{
if (ranges.Length == 0)
{
return new <API key><Tfeatures>();
}
return new <API key><Tfeatures>(query, ranges, storageReader, distanceFunction);
}
private KeyValuePair<int, int>[] ranges;
private <API key><Tfeatures> storageReader;
private int currentRange;
private IEnumerator<Tfeatures> <API key>;
private Tfeatures currentHit;
private int currentHitId;
private int count;
private int progress;
private ScoreFunction scorefunction;
private <API key>(Tfeatures query, KeyValuePair<int, int>[] ranges, <API key><Tfeatures> storageReader, IDistanceFunction<Tfeatures> distanceFunction)
{
this.ranges = ranges;
this.storageReader = storageReader;
currentRange = -1;
<API key> = null;
currentHit = default(Tfeatures);
currentHitId = -1;
count = 0;
progress = 0;
foreach (KeyValuePair<int, int> range in ranges)
{
count += range.Value - range.Key + 1;
}
scorefunction = delegate()
{
return distanceFunction.Distance(query, currentHit);
};
}
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
protected virtual void Dispose(bool disposing)
{
}
private bool MoveNextRange()
{
int nextRange = currentRange + 1;
if (nextRange == ranges.Length)
{
return false;
}
currentRange = nextRange;
KeyValuePair<int, int> range = ranges[currentRange];
<API key> = GetRangeEnumerator(range.Key, range.Value);
currentHitId = range.Key - 1;
return true;
}
private IEnumerator<Tfeatures> GetRangeEnumerator(int start, int end)
{
for (int index = start; index <= end; ++index)
{
yield return storageReader[index];
}
}
public bool MoveNext()
{
if (currentHitId < 0)
{
if (!MoveNextRange())
{
currentHit = default(Tfeatures);
return false;
}
}
while (!<API key>.MoveNext())
{
if (!MoveNextRange())
{
currentHit = default(Tfeatures);
return false;
}
}
currentHit = <API key>.Current;
++currentHitId;
++progress;
return true;
}
public bool MoveNext(int minHitId)
{
while (CurrentPostingId < minHitId)
{
if (!MoveNext())
{
return false;
}
}
return true;
}
public int Count
{
get
{
return count;
}
}
public int Progress
{
get
{
return progress;
}
}
public int CurrentPostingId
{
get
{
if (currentHit == null)
{
return -1;
}
return currentHitId;
}
}
public int CurrentHitCount
{
get
{
return 1;
}
}
public IHitEnumerator <API key>()
{
return <API key>();
}
public ScoreFunction ScoreFunction
{
get
{
return scorefunction;
}
set
{
scorefunction = value;
}
}
public IHitEnumerator<Tfeatures> <API key>()
{
return new ArrayHitEnumerator<Tfeatures>(currentHitId, new Tfeatures[] { currentHit });
}
}
} |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
<!--NewPage
<HTML>
<HEAD>
<!-- Generated by javadoc on Thu Nov 22 16:43:43 EST 2007 -->
<TITLE>
Xalan-Java 2.7.1: Class XMLReaderAdapter
</TITLE>
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../stylesheet.css" TITLE="Style">
</HEAD>
<BODY BGCOLOR="white">
<A NAME="navbar_top"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_top_firstrow"></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/XMLReaderAdapter.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../org/xml/sax/helpers/XMLFilterImpl.html"><B>PREV CLASS</B></A>
<A HREF="../../../../org/xml/sax/helpers/XMLReaderFactory.html"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../index.html" TARGET="_top"><B>FRAMES</B></A>
<A HREF="XMLReaderAdapter.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
SUMMARY: INNER | FIELD | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL: FIELD | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<HR>
<H2>
<FONT SIZE="-1">
org.xml.sax.helpers</FONT>
<BR>
Class XMLReaderAdapter</H2>
<PRE>
java.lang.Object
|
+--<B>org.xml.sax.helpers.XMLReaderAdapter</B>
</PRE>
<HR>
<DL>
<DT>public class <B>XMLReaderAdapter</B><DT>extends java.lang.Object<DT>implements <A HREF="../../../../org/xml/sax/Parser.html">Parser</A>, <A HREF="../../../../org/xml/sax/ContentHandler.html">ContentHandler</A></DL>
<P>
Adapt a SAX2 XMLReader as a SAX1 Parser.
<blockquote>
<em>This module, both source code and documentation, is in the
Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
See <a href='http:
for further information.
</blockquote>
<p>This class wraps a SAX2 <A HREF="../../../../org/xml/sax/XMLReader.html">XMLReader</A>
and makes it act as a SAX1 <A HREF="../../../../org/xml/sax/Parser.html">Parser</A>. The XMLReader
must support a true value for the
http://xml.org/sax/features/namespace-prefixes property or parsing will fail
with a <A HREF="../../../../org/xml/sax/SAXException.html">SAXException</A>; if the XMLReader
supports a false value for the http://xml.org/sax/features/namespaces
property, that will also be used to improve efficiency.</p>
<P>
<DL>
<DT><B>Since: </B><DD>SAX 2.0</DD>
<DT><B>See Also: </B><DD><A HREF="../../../../org/xml/sax/Parser.html"><CODE>Parser</CODE></A>,
<A HREF="../../../../org/xml/sax/XMLReader.html"><CODE>XMLReader</CODE></A></DL>
<HR>
<P>
<A NAME="constructor_summary"></A>
<TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=2><FONT SIZE="+2">
<B>Constructor Summary</B></FONT></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><B><A HREF="../../../../org/xml/sax/helpers/XMLReaderAdapter.html#XMLReaderAdapter()">XMLReaderAdapter</A></B>()</CODE>
<BR>
Create a new adapter.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><B><A HREF="../../../../org/xml/sax/helpers/XMLReaderAdapter.html#XMLReaderAdapter(org.xml.sax.XMLReader)">XMLReaderAdapter</A></B>(<A HREF="../../../../org/xml/sax/XMLReader.html">XMLReader</A> xmlReader)</CODE>
<BR>
Create a new adapter.</TD>
</TR>
</TABLE>
<A NAME="method_summary"></A>
<TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=2><FONT SIZE="+2">
<B>Method Summary</B></FONT></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/xml/sax/helpers/XMLReaderAdapter.html#characters(char[], int, int)">characters</A></B>(char[] ch,
int start,
int length)</CODE>
<BR>
Adapt a SAX2 characters event.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/xml/sax/helpers/XMLReaderAdapter.html#endDocument()">endDocument</A></B>()</CODE>
<BR>
End document event.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/xml/sax/helpers/XMLReaderAdapter.html#endElement(java.lang.String, java.lang.String, java.lang.String)">endElement</A></B>(java.lang.String uri,
java.lang.String localName,
java.lang.String qName)</CODE>
<BR>
Adapt a SAX2 end element event.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/xml/sax/helpers/XMLReaderAdapter.html#endPrefixMapping(java.lang.String)">endPrefixMapping</A></B>(java.lang.String prefix)</CODE>
<BR>
Adapt a SAX2 end prefix mapping event.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/xml/sax/helpers/XMLReaderAdapter.html#ignorableWhitespace(char[], int, int)">ignorableWhitespace</A></B>(char[] ch,
int start,
int length)</CODE>
<BR>
Adapt a SAX2 ignorable whitespace event.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/xml/sax/helpers/XMLReaderAdapter.html#parse(org.xml.sax.InputSource)">parse</A></B>(<A HREF="../../../../org/xml/sax/InputSource.html">InputSource</A> input)</CODE>
<BR>
Parse the document.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/xml/sax/helpers/XMLReaderAdapter.html#parse(java.lang.String)">parse</A></B>(java.lang.String systemId)</CODE>
<BR>
Parse the document.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/xml/sax/helpers/XMLReaderAdapter.html#<API key>(java.lang.String, java.lang.String)"><API key></A></B>(java.lang.String target,
java.lang.String data)</CODE>
<BR>
Adapt a SAX2 processing instruction event.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/xml/sax/helpers/XMLReaderAdapter.html#setDocumentHandler(org.xml.sax.DocumentHandler)">setDocumentHandler</A></B>(<A HREF="../../../../org/xml/sax/DocumentHandler.html">DocumentHandler</A> handler)</CODE>
<BR>
Register the SAX1 document event handler.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/xml/sax/helpers/XMLReaderAdapter.html#setDocumentLocator(org.xml.sax.Locator)">setDocumentLocator</A></B>(<A HREF="../../../../org/xml/sax/Locator.html">Locator</A> locator)</CODE>
<BR>
Set a document locator.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/xml/sax/helpers/XMLReaderAdapter.html#setDTDHandler(org.xml.sax.DTDHandler)">setDTDHandler</A></B>(<A HREF="../../../../org/xml/sax/DTDHandler.html">DTDHandler</A> handler)</CODE>
<BR>
Register the DTD event handler.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/xml/sax/helpers/XMLReaderAdapter.html#setEntityResolver(org.xml.sax.EntityResolver)">setEntityResolver</A></B>(<A HREF="../../../../org/xml/sax/EntityResolver.html">EntityResolver</A> resolver)</CODE>
<BR>
Register the entity resolver.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/xml/sax/helpers/XMLReaderAdapter.html#setErrorHandler(org.xml.sax.ErrorHandler)">setErrorHandler</A></B>(<A HREF="../../../../org/xml/sax/ErrorHandler.html">ErrorHandler</A> handler)</CODE>
<BR>
Register the error event handler.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/xml/sax/helpers/XMLReaderAdapter.html#setLocale(java.util.Locale)">setLocale</A></B>(java.util.Locale locale)</CODE>
<BR>
Set the locale for error reporting.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/xml/sax/helpers/XMLReaderAdapter.html#skippedEntity(java.lang.String)">skippedEntity</A></B>(java.lang.String name)</CODE>
<BR>
Adapt a SAX2 skipped entity event.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/xml/sax/helpers/XMLReaderAdapter.html#startDocument()">startDocument</A></B>()</CODE>
<BR>
Start document event.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/xml/sax/helpers/XMLReaderAdapter.html#startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes)">startElement</A></B>(java.lang.String uri,
java.lang.String localName,
java.lang.String qName,
<A HREF="../../../../org/xml/sax/Attributes.html">Attributes</A> atts)</CODE>
<BR>
Adapt a SAX2 start element event.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/xml/sax/helpers/XMLReaderAdapter.html#startPrefixMapping(java.lang.String, java.lang.String)">startPrefixMapping</A></B>(java.lang.String prefix,
java.lang.String uri)</CODE>
<BR>
Adapt a SAX2 start prefix mapping event.</TD>
</TR>
</TABLE>
<A NAME="<API key>.lang.Object"></A>
<TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#EEEEFF" CLASS="<API key>">
<TD><B>Methods inherited from class java.lang.Object</B></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE>equals,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait</CODE></TD>
</TR>
</TABLE>
<P>
<A NAME="constructor_detail"></A>
<TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=1><FONT SIZE="+2">
<B>Constructor Detail</B></FONT></TD>
</TR>
</TABLE>
<A NAME="XMLReaderAdapter()"></A><H3>
XMLReaderAdapter</H3>
<PRE>
public <B>XMLReaderAdapter</B>()
throws <A HREF="../../../../org/xml/sax/SAXException.html">SAXException</A></PRE>
<DL>
<DD>Create a new adapter.
<p>Use the "org.xml.sax.driver" property to locate the SAX2
driver to embed.</p><DD><DL>
<DT><B>Throws:</B><DD><A HREF="../../../../org/xml/sax/SAXException.html">SAXException</A> - If the embedded driver
cannot be instantiated or if the
org.xml.sax.driver property is not specified.</DL>
</DD>
</DL>
<HR>
<A NAME="XMLReaderAdapter(org.xml.sax.XMLReader)"></A><H3>
XMLReaderAdapter</H3>
<PRE>
public <B>XMLReaderAdapter</B>(<A HREF="../../../../org/xml/sax/XMLReader.html">XMLReader</A> xmlReader)</PRE>
<DL>
<DD>Create a new adapter.
<p>Create a new adapter, wrapped around a SAX2 XMLReader.
The adapter will make the XMLReader act like a SAX1
Parser.</p><DD><DL>
<DT><B>Parameters:</B><DD><CODE>xmlReader</CODE> - The SAX2 XMLReader to wrap.<DT><B>Throws:</B><DD>java.lang.<API key> - If the argument is null.</DL>
</DD>
</DL>
<A NAME="method_detail"></A>
<TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=1><FONT SIZE="+2">
<B>Method Detail</B></FONT></TD>
</TR>
</TABLE>
<A NAME="setLocale(java.util.Locale)"></A><H3>
setLocale</H3>
<PRE>
public void <B>setLocale</B>(java.util.Locale locale)
throws <A HREF="../../../../org/xml/sax/SAXException.html">SAXException</A></PRE>
<DL>
<DD>Set the locale for error reporting.
<p>This is not supported in SAX2, and will always throw
an exception.</p><DD><DL>
<DT><B>Specified by: </B><DD><A HREF="../../../../org/xml/sax/Parser.html#setLocale(java.util.Locale)">setLocale</A> in interface <A HREF="../../../../org/xml/sax/Parser.html">Parser</A><DT><B>Parameters:</B><DD><CODE>locale</CODE> - the locale for error reporting.<DT><B>Throws:</B><DD><A HREF="../../../../org/xml/sax/SAXException.html">SAXException</A> - Thrown unless overridden.<DT><B>See Also: </B><DD><A HREF="../../../../org/xml/sax/Parser.html#setLocale(java.util.Locale)"><CODE>Parser.setLocale(java.util.Locale)</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="setEntityResolver(org.xml.sax.EntityResolver)"></A><H3>
setEntityResolver</H3>
<PRE>
public void <B>setEntityResolver</B>(<A HREF="../../../../org/xml/sax/EntityResolver.html">EntityResolver</A> resolver)</PRE>
<DL>
<DD>Register the entity resolver.<DD><DL>
<DT><B>Specified by: </B><DD><A HREF="../../../../org/xml/sax/Parser.html#setEntityResolver(org.xml.sax.EntityResolver)">setEntityResolver</A> in interface <A HREF="../../../../org/xml/sax/Parser.html">Parser</A><DT><B>Parameters:</B><DD><CODE>resolver</CODE> - The new resolver.<DT><B>See Also: </B><DD><A HREF="../../../../org/xml/sax/Parser.html#setEntityResolver(org.xml.sax.EntityResolver)"><CODE>Parser.setEntityResolver(org.xml.sax.EntityResolver)</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="setDTDHandler(org.xml.sax.DTDHandler)"></A><H3>
setDTDHandler</H3>
<PRE>
public void <B>setDTDHandler</B>(<A HREF="../../../../org/xml/sax/DTDHandler.html">DTDHandler</A> handler)</PRE>
<DL>
<DD>Register the DTD event handler.<DD><DL>
<DT><B>Specified by: </B><DD><A HREF="../../../../org/xml/sax/Parser.html#setDTDHandler(org.xml.sax.DTDHandler)">setDTDHandler</A> in interface <A HREF="../../../../org/xml/sax/Parser.html">Parser</A><DT><B>Parameters:</B><DD><CODE>handler</CODE> - The new DTD event handler.<DT><B>See Also: </B><DD><A HREF="../../../../org/xml/sax/Parser.html#setDTDHandler(org.xml.sax.DTDHandler)"><CODE>Parser.setDTDHandler(org.xml.sax.DTDHandler)</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="setDocumentHandler(org.xml.sax.DocumentHandler)"></A><H3>
setDocumentHandler</H3>
<PRE>
public void <B>setDocumentHandler</B>(<A HREF="../../../../org/xml/sax/DocumentHandler.html">DocumentHandler</A> handler)</PRE>
<DL>
<DD>Register the SAX1 document event handler.
<p>Note that the SAX1 document handler has no Namespace
support.</p><DD><DL>
<DT><B>Specified by: </B><DD><A HREF="../../../../org/xml/sax/Parser.html#setDocumentHandler(org.xml.sax.DocumentHandler)">setDocumentHandler</A> in interface <A HREF="../../../../org/xml/sax/Parser.html">Parser</A><DT><B>Parameters:</B><DD><CODE>handler</CODE> - The new SAX1 document event handler.<DT><B>See Also: </B><DD><A HREF="../../../../org/xml/sax/Parser.html#setDocumentHandler(org.xml.sax.DocumentHandler)"><CODE>Parser.setDocumentHandler(org.xml.sax.DocumentHandler)</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="setErrorHandler(org.xml.sax.ErrorHandler)"></A><H3>
setErrorHandler</H3>
<PRE>
public void <B>setErrorHandler</B>(<A HREF="../../../../org/xml/sax/ErrorHandler.html">ErrorHandler</A> handler)</PRE>
<DL>
<DD>Register the error event handler.<DD><DL>
<DT><B>Specified by: </B><DD><A HREF="../../../../org/xml/sax/Parser.html#setErrorHandler(org.xml.sax.ErrorHandler)">setErrorHandler</A> in interface <A HREF="../../../../org/xml/sax/Parser.html">Parser</A><DT><B>Parameters:</B><DD><CODE>handler</CODE> - The new error event handler.<DT><B>See Also: </B><DD><A HREF="../../../../org/xml/sax/Parser.html#setErrorHandler(org.xml.sax.ErrorHandler)"><CODE>Parser.setErrorHandler(org.xml.sax.ErrorHandler)</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="parse(java.lang.String)"></A><H3>
parse</H3>
<PRE>
public void <B>parse</B>(java.lang.String systemId)
throws java.io.IOException,
<A HREF="../../../../org/xml/sax/SAXException.html">SAXException</A></PRE>
<DL>
<DD>Parse the document.
<p>This method will throw an exception if the embedded
XMLReader does not support the
http://xml.org/sax/features/namespace-prefixes property.</p><DD><DL>
<DT><B>Specified by: </B><DD><A HREF="../../../../org/xml/sax/Parser.html#parse(java.lang.String)">parse</A> in interface <A HREF="../../../../org/xml/sax/Parser.html">Parser</A><DT><B>Parameters:</B><DD><CODE>systemId</CODE> - The absolute URL of the document.<DT><B>Throws:</B><DD>java.io.IOException - If there is a problem reading
the raw content of the document.<DD><A HREF="../../../../org/xml/sax/SAXException.html">SAXException</A> - If there is a problem
processing the document.<DT><B>See Also: </B><DD><A HREF="../../../../org/xml/sax/helpers/XMLReaderAdapter.html#parse(org.xml.sax.InputSource)"><CODE>parse(org.xml.sax.InputSource)</CODE></A>,
<A HREF="../../../../org/xml/sax/Parser.html#parse(java.lang.String)"><CODE>Parser.parse(java.lang.String)</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="parse(org.xml.sax.InputSource)"></A><H3>
parse</H3>
<PRE>
public void <B>parse</B>(<A HREF="../../../../org/xml/sax/InputSource.html">InputSource</A> input)
throws java.io.IOException,
<A HREF="../../../../org/xml/sax/SAXException.html">SAXException</A></PRE>
<DL>
<DD>Parse the document.
<p>This method will throw an exception if the embedded
XMLReader does not support the
http://xml.org/sax/features/namespace-prefixes property.</p><DD><DL>
<DT><B>Specified by: </B><DD><A HREF="../../../../org/xml/sax/Parser.html#parse(org.xml.sax.InputSource)">parse</A> in interface <A HREF="../../../../org/xml/sax/Parser.html">Parser</A><DT><B>Parameters:</B><DD><CODE>input</CODE> - An input source for the document.<DT><B>Throws:</B><DD>java.io.IOException - If there is a problem reading
the raw content of the document.<DD><A HREF="../../../../org/xml/sax/SAXException.html">SAXException</A> - If there is a problem
processing the document.<DT><B>See Also: </B><DD><A HREF="../../../../org/xml/sax/helpers/XMLReaderAdapter.html#parse(java.lang.String)"><CODE>parse(java.lang.String)</CODE></A>,
<A HREF="../../../../org/xml/sax/Parser.html#parse(org.xml.sax.InputSource)"><CODE>Parser.parse(org.xml.sax.InputSource)</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="setDocumentLocator(org.xml.sax.Locator)"></A><H3>
setDocumentLocator</H3>
<PRE>
public void <B>setDocumentLocator</B>(<A HREF="../../../../org/xml/sax/Locator.html">Locator</A> locator)</PRE>
<DL>
<DD>Set a document locator.<DD><DL>
<DT><B>Specified by: </B><DD><A HREF="../../../../org/xml/sax/ContentHandler.html#setDocumentLocator(org.xml.sax.Locator)">setDocumentLocator</A> in interface <A HREF="../../../../org/xml/sax/ContentHandler.html">ContentHandler</A><DT><B>Parameters:</B><DD><CODE>locator</CODE> - The document locator.<DT><B>See Also: </B><DD><A HREF="../../../../org/xml/sax/ContentHandler.html#setDocumentLocator(org.xml.sax.Locator)"><CODE>ContentHandler.setDocumentLocator(org.xml.sax.Locator)</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="startDocument()"></A><H3>
startDocument</H3>
<PRE>
public void <B>startDocument</B>()
throws <A HREF="../../../../org/xml/sax/SAXException.html">SAXException</A></PRE>
<DL>
<DD>Start document event.<DD><DL>
<DT><B>Specified by: </B><DD><A HREF="../../../../org/xml/sax/ContentHandler.html#startDocument()">startDocument</A> in interface <A HREF="../../../../org/xml/sax/ContentHandler.html">ContentHandler</A><DT><B>Throws:</B><DD><A HREF="../../../../org/xml/sax/SAXException.html">SAXException</A> - The client may raise a
processing exception.<DT><B>See Also: </B><DD><A HREF="../../../../org/xml/sax/ContentHandler.html#startDocument()"><CODE>ContentHandler.startDocument()</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="endDocument()"></A><H3>
endDocument</H3>
<PRE>
public void <B>endDocument</B>()
throws <A HREF="../../../../org/xml/sax/SAXException.html">SAXException</A></PRE>
<DL>
<DD>End document event.<DD><DL>
<DT><B>Specified by: </B><DD><A HREF="../../../../org/xml/sax/ContentHandler.html#endDocument()">endDocument</A> in interface <A HREF="../../../../org/xml/sax/ContentHandler.html">ContentHandler</A><DT><B>Throws:</B><DD><A HREF="../../../../org/xml/sax/SAXException.html">SAXException</A> - The client may raise a
processing exception.<DT><B>See Also: </B><DD><A HREF="../../../../org/xml/sax/ContentHandler.html#endDocument()"><CODE>ContentHandler.endDocument()</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="startPrefixMapping(java.lang.String, java.lang.String)"></A><H3>
startPrefixMapping</H3>
<PRE>
public void <B>startPrefixMapping</B>(java.lang.String prefix,
java.lang.String uri)</PRE>
<DL>
<DD>Adapt a SAX2 start prefix mapping event.<DD><DL>
<DT><B>Specified by: </B><DD><A HREF="../../../../org/xml/sax/ContentHandler.html#startPrefixMapping(java.lang.String, java.lang.String)">startPrefixMapping</A> in interface <A HREF="../../../../org/xml/sax/ContentHandler.html">ContentHandler</A><DT><B>Parameters:</B><DD><CODE>prefix</CODE> - The prefix being mapped.<DD><CODE>uri</CODE> - The Namespace URI being mapped to.<DT><B>See Also: </B><DD><A HREF="../../../../org/xml/sax/ContentHandler.html#startPrefixMapping(java.lang.String, java.lang.String)"><CODE>ContentHandler.startPrefixMapping(java.lang.String, java.lang.String)</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="endPrefixMapping(java.lang.String)"></A><H3>
endPrefixMapping</H3>
<PRE>
public void <B>endPrefixMapping</B>(java.lang.String prefix)</PRE>
<DL>
<DD>Adapt a SAX2 end prefix mapping event.<DD><DL>
<DT><B>Specified by: </B><DD><A HREF="../../../../org/xml/sax/ContentHandler.html#endPrefixMapping(java.lang.String)">endPrefixMapping</A> in interface <A HREF="../../../../org/xml/sax/ContentHandler.html">ContentHandler</A><DT><B>Parameters:</B><DD><CODE>prefix</CODE> - The prefix being mapped.<DT><B>See Also: </B><DD><A HREF="../../../../org/xml/sax/ContentHandler.html#endPrefixMapping(java.lang.String)"><CODE>ContentHandler.endPrefixMapping(java.lang.String)</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes)"></A><H3>
startElement</H3>
<PRE>
public void <B>startElement</B>(java.lang.String uri,
java.lang.String localName,
java.lang.String qName,
<A HREF="../../../../org/xml/sax/Attributes.html">Attributes</A> atts)
throws <A HREF="../../../../org/xml/sax/SAXException.html">SAXException</A></PRE>
<DL>
<DD>Adapt a SAX2 start element event.<DD><DL>
<DT><B>Specified by: </B><DD><A HREF="../../../../org/xml/sax/ContentHandler.html#startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes)">startElement</A> in interface <A HREF="../../../../org/xml/sax/ContentHandler.html">ContentHandler</A><DT><B>Parameters:</B><DD><CODE>uri</CODE> - The Namespace URI.<DD><CODE>localName</CODE> - The Namespace local name.<DD><CODE>qName</CODE> - The qualified (prefixed) name.<DD><CODE>atts</CODE> - The SAX2 attributes.<DT><B>Throws:</B><DD><A HREF="../../../../org/xml/sax/SAXException.html">SAXException</A> - The client may raise a
processing exception.<DT><B>See Also: </B><DD><A HREF="../../../../org/xml/sax/ContentHandler.html#endDocument()"><CODE>ContentHandler.endDocument()</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="endElement(java.lang.String, java.lang.String, java.lang.String)"></A><H3>
endElement</H3>
<PRE>
public void <B>endElement</B>(java.lang.String uri,
java.lang.String localName,
java.lang.String qName)
throws <A HREF="../../../../org/xml/sax/SAXException.html">SAXException</A></PRE>
<DL>
<DD>Adapt a SAX2 end element event.<DD><DL>
<DT><B>Specified by: </B><DD><A HREF="../../../../org/xml/sax/ContentHandler.html#endElement(java.lang.String, java.lang.String, java.lang.String)">endElement</A> in interface <A HREF="../../../../org/xml/sax/ContentHandler.html">ContentHandler</A><DT><B>Parameters:</B><DD><CODE>uri</CODE> - The Namespace URI.<DD><CODE>localName</CODE> - The Namespace local name.<DD><CODE>qName</CODE> - The qualified (prefixed) name.<DT><B>Throws:</B><DD><A HREF="../../../../org/xml/sax/SAXException.html">SAXException</A> - The client may raise a
processing exception.<DT><B>See Also: </B><DD><A HREF="../../../../org/xml/sax/ContentHandler.html#endElement(java.lang.String, java.lang.String, java.lang.String)"><CODE>ContentHandler.endElement(java.lang.String, java.lang.String, java.lang.String)</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="characters(char[], int, int)"></A><H3>
characters</H3>
<PRE>
public void <B>characters</B>(char[] ch,
int start,
int length)
throws <A HREF="../../../../org/xml/sax/SAXException.html">SAXException</A></PRE>
<DL>
<DD>Adapt a SAX2 characters event.<DD><DL>
<DT><B>Specified by: </B><DD><A HREF="../../../../org/xml/sax/ContentHandler.html#characters(char[], int, int)">characters</A> in interface <A HREF="../../../../org/xml/sax/ContentHandler.html">ContentHandler</A><DT><B>Parameters:</B><DD><CODE>ch</CODE> - An array of characters.<DD><CODE>start</CODE> - The starting position in the array.<DD><CODE>length</CODE> - The number of characters to use.<DT><B>Throws:</B><DD><A HREF="../../../../org/xml/sax/SAXException.html">SAXException</A> - The client may raise a
processing exception.<DT><B>See Also: </B><DD><A HREF="../../../../org/xml/sax/ContentHandler.html#characters(char[], int, int)"><CODE>ContentHandler.characters(char[], int, int)</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="ignorableWhitespace(char[], int, int)"></A><H3>
ignorableWhitespace</H3>
<PRE>
public void <B>ignorableWhitespace</B>(char[] ch,
int start,
int length)
throws <A HREF="../../../../org/xml/sax/SAXException.html">SAXException</A></PRE>
<DL>
<DD>Adapt a SAX2 ignorable whitespace event.<DD><DL>
<DT><B>Specified by: </B><DD><A HREF="../../../../org/xml/sax/ContentHandler.html#ignorableWhitespace(char[], int, int)">ignorableWhitespace</A> in interface <A HREF="../../../../org/xml/sax/ContentHandler.html">ContentHandler</A><DT><B>Parameters:</B><DD><CODE>ch</CODE> - An array of characters.<DD><CODE>start</CODE> - The starting position in the array.<DD><CODE>length</CODE> - The number of characters to use.<DT><B>Throws:</B><DD><A HREF="../../../../org/xml/sax/SAXException.html">SAXException</A> - The client may raise a
processing exception.<DT><B>See Also: </B><DD><A HREF="../../../../org/xml/sax/ContentHandler.html#ignorableWhitespace(char[], int, int)"><CODE>ContentHandler.ignorableWhitespace(char[], int, int)</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="<API key>(java.lang.String, java.lang.String)"></A><H3>
<API key></H3>
<PRE>
public void <B><API key></B>(java.lang.String target,
java.lang.String data)
throws <A HREF="../../../../org/xml/sax/SAXException.html">SAXException</A></PRE>
<DL>
<DD>Adapt a SAX2 processing instruction event.<DD><DL>
<DT><B>Specified by: </B><DD><A HREF="../../../../org/xml/sax/ContentHandler.html#<API key>(java.lang.String, java.lang.String)"><API key></A> in interface <A HREF="../../../../org/xml/sax/ContentHandler.html">ContentHandler</A><DT><B>Parameters:</B><DD><CODE>target</CODE> - The processing instruction target.<DD><CODE>data</CODE> - The remainder of the processing instruction<DT><B>Throws:</B><DD><A HREF="../../../../org/xml/sax/SAXException.html">SAXException</A> - The client may raise a
processing exception.<DT><B>See Also: </B><DD><A HREF="../../../../org/xml/sax/ContentHandler.html#<API key>(java.lang.String, java.lang.String)"><CODE>ContentHandler.<API key>(java.lang.String, java.lang.String)</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="skippedEntity(java.lang.String)"></A><H3>
skippedEntity</H3>
<PRE>
public void <B>skippedEntity</B>(java.lang.String name)
throws <A HREF="../../../../org/xml/sax/SAXException.html">SAXException</A></PRE>
<DL>
<DD>Adapt a SAX2 skipped entity event.<DD><DL>
<DT><B>Specified by: </B><DD><A HREF="../../../../org/xml/sax/ContentHandler.html#skippedEntity(java.lang.String)">skippedEntity</A> in interface <A HREF="../../../../org/xml/sax/ContentHandler.html">ContentHandler</A><DT><B>Parameters:</B><DD><CODE>name</CODE> - The name of the skipped entity.<DT><B>Throws:</B><DD><A HREF="../../../../org/xml/sax/SAXException.html">SAXException</A> - Throwable by subclasses.<DT><B>See Also: </B><DD><A HREF="../../../../org/xml/sax/ContentHandler.html#skippedEntity(java.lang.String)"><CODE>ContentHandler.skippedEntity(java.lang.String)</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="navbar_bottom"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="<API key>"></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/XMLReaderAdapter.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../org/xml/sax/helpers/XMLFilterImpl.html"><B>PREV CLASS</B></A>
<A HREF="../../../../org/xml/sax/helpers/XMLReaderFactory.html"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../index.html" TARGET="_top"><B>FRAMES</B></A>
<A HREF="XMLReaderAdapter.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
SUMMARY: INNER | FIELD | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL: FIELD | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<HR>
Copyright © 2006 Apache XML Project. All Rights Reserved.
</BODY>
</HTML> |
// <API key>.h
// StringManage
#import <Cocoa/Cocoa.h>
typedef enum : NSUInteger {
KeyTypeDefult,
KeyTypeAdd,
KeyTypeRemove,
} KeyType;
@interface <API key> : NSWindowController
<
NSPopoverDelegate,
NSTableViewDelegate,
<API key>,
NSTextFieldDelegate,
<API key>
>
- (void)setSearchRootDir:(NSString*)searchRootDir
projectName:(NSString*)projectName;
- (void)<API key>:(id)sender;
- (IBAction)refresh:(id)sender;
@end |
<?php
/*
*
* Autores: Jhonnatan Cubides, Harley Santoyo
*
*/
class Verificador
{
function Verificador()
{
if( file_exists( "instalador.php" ) == true )
{
header( "location: instalador.php" );
}
}
function mostrar_tablas( $conexion, $opcion = null )
{
$salida = "<br><br>
$resultado = $conexion->query( "SHOW TABLES" );
$conteo = 0;
while( $fila = mysqli_fetch_array( $resultado ) )
{
$salida .= $fila[ 0 ]."<br>";
$conteo ++;
}
if( $opcion == 2 ) $salida = $conteo;
return $salida;
}
/**
* Borra un archivo del sistema.
* @param texto nombre del archivo que se va a borrar.
*/
function borrar_archivo( $nombre_archivo )
{
unlink( $nombre_archivo );
}
function <API key>( $tabla, $servidor, $usuario, $clave, $bd, $imp_pruebas = null )
{
$conteo = 0;
$sql = " SELECT COUNT( * ) AS conteo FROM information_schema.tables WHERE table_schema = '$bd' AND table_name = '$tabla' ";
if( $imp_pruebas == 1 ) echo "<br><strong>".$sql."</strong><br>";
$conexion = mysqli_connect( $servidor, $usuario, $clave, $bd );
$resultado = $conexion->query( $sql );
while( $fila = mysqli_fetch_assoc( $resultado ) )
{
$conteo = $fila[ 'conteo' ];
}
return $conteo;
}
function <API key>( $objeto, $servidor, $usuario, $clave, $bd, $imp_pruebas = null )
{
$conteo = 0;
//$sql = " SELECT COUNT( * ) AS conteo FROM information_schema.tables WHERE table_schema = '$bd' AND table_name = '$tabla' ";
$sql = " SELECT COUNT( * ) AS conteo FROM information_schema.TABLE_CONSTRAINTS WHERE TABLE_SCHEMA = '$bd' AND CONSTRAINT_NAME = '$objeto'; ";
if( $imp_pruebas == 1 ) echo "<br><strong>".$sql."</strong><br>";
$conexion = mysqli_connect( $servidor, $usuario, $clave, $bd );
$resultado = $conexion->query( $sql );
while( $fila = mysqli_fetch_assoc( $resultado ) )
{
$conteo = $fila[ 'conteo' ];
}
return $conteo;
}
}
?> |
package io.valhala.javamon.pokemon.type;
public enum Type {
NORMAL,
FIGHTING,
FLYING,
POISON,
GROUND,
ROCK,
BUG,
GHOST,
FIRE,
WATER,
GRASS,
ELECTRIC,
PSYCHIC,
ICE,
DRAGON;
private String pokemonType;
public void setPokemonType(String s) {
this.pokemonType = s.toString();
}
public String getPokemonType() {return pokemonType;}
} |
/*
* @function strstr:
* Returns substring + rest of
* string , from the string.
*
* @param __str (char*):
* Specified string
* to find substring from.
*
* @param __substr (char*):
* the Substring to be searched
* for.
* @return (str_t):
* Returns the substring + rest
* of string.
*/
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <strstr/strstr.h>
#include <strlen/strlen.h>
#include <strcmp/strcmp.h>
#include <memmove/memmove.h>
#include <stdio/stdio.h>
str_t strstr(char* __str, char* __substr)
{
size_t strlen__substr = strlen(__substr);
size_t strlen__str = strlen(__str);
char __temp[strlen__substr];
str_t __return_str;
int __start_index=0;
bool __found=false;
int index=0;
while(__str[index])
{
if(__str[index] == __substr[0])
{
int i=0;
for(; __substr[i]; i++)
__temp[i] = __str[i+index];
__temp[i] = '\0';
if(strcmp(__temp,__substr)==0)
{
__start_index = (i+index)-strlen__substr;
__found=true;
for(int i=0; i<200;i++) __return_str.str[i]=0;
for(uint32_t i=__start_index,j=0; i<strlen__str;i++,j++)
__return_str.str[j]=__str[i];
}
index++;
}
else index++;
}
if(__found==false)
__return_str.str[0] = 0;
return __return_str;
} |
<?php
// Include main functions
require("includes/functions.php");
require("includes/templates.php");
require("includes/timer.class.php");
// Start the timer
$timer = new Timer();
$timer->start();
// Start the session
session_start();
// Include the configuration file, die if doesn't exist
file_exists("config.php") ? require("config.php") : die("Config.php not found!");
// Connect to the database
$link = @mysql_connect($db_host, $db_user, $db_pass);
if (!$link) {
$error = "Cannot connect to MySQL server.<br />";
$error .= mysql_errno() . ": " . mysql_error();
die($error);
}
// Select the database
$db = @mysql_select_db($db_name);
if (!$db) {
$error = "Failed to select database.<br />";
$error .= mysql_errno() . ": " . mysql_error();
die($error);
}
// Load configuration
$config_result = mysql_query("
SELECT
*
FROM
`phpVana_config`"
);
while ($row = mysql_fetch_assoc($config_result)) {
$phpVana_config[$row['config_name']] = stripslashes($row['config_value']);
}
// Load the template
$template = $phpVana_config['template'];
$template_path = file_exists("templates/" . $template . "/template.php") ? "templates/" . $template : "templates/CoolWater";
$tpl = new Template($template_path . "/template.php");
// Slogans
if(isset($phpVana_config['site_slogan'])) {
$slogans = explode("\n", $phpVana_config['site_slogan']);
$slogan_number = rand(0, count($slogans) - 1);
$slogan = trim($slogans[$slogan_number]);
}
$html_title = $phpVana_config['site_name'];
if($slogan != NULL) {
$html_title .= ": " . $slogan;
}
// Load content
if(isset($_GET['page'])) {
$page = stripslashes($_GET['page']);
// Look to see if the page exists
if(file_exists($page . ".php")) {
include($page . ".php");
}
else {
$body = new Template(getFileLocation("error.php"));
$body->set("error", "404");
}
}
else {
include("frontpage.php");
}
// End timer
$timer->stop();
// Set variables and output page to user
$tpl->set("content", $body);
$tpl->set("html_title", $html_title);
$tpl->set("render_time", $timer->time());
$tpl->set("site_name", $phpVana_config['site_name']);
$tpl->set("site_slogan", $slogan);
$tpl->set("template", $template);
echo $tpl->fetch($template_path . "/template.php"); |
#include "<API key>.h"
/*
* This type is implemented using OCTET_STRING,
* so here we adjust the DEF accordingly.
*/
static const ber_tlv_tag_t <API key>[] = {
(<API key> | (4 << 2))
};
<API key> <API key> = {
"<API key>",
"<API key>",
&asn_OP_OCTET_STRING,
<API key>,
sizeof(<API key>)
/sizeof(<API key>[0]),
<API key>, /* Same as above */
sizeof(<API key>)
/sizeof(<API key>[0]),
{ 0, 0, <API key> },
0, 0, /* No members */
&<API key> /* Additional specs */
}; |
#ifndef SIGNALCODE_H
#define SIGNALCODE_H
/*CORE-SIGNALS*/
#define TERMINATION 0
#define STATE_UPDATE 1
/*APPLICATIN SIGNALS*/
#define STOP_BTN_CLICKED 2
#define EXIT_BTN_CLICKED 3
#define IPCAM_STATE_UPDATE 4
#define START 5
#define ABORTED 6
#define CONNECTED 7
#define STOP 8
#define FAILURE 9
#define NEW_IMAGE 10
#define PAIR_IMAGE 11
#define <API key> 12
#define <API key> 13
#define <API key> 14
#define TURN_ON_DRAW_TRACES 15
#define <API key> 16
#define <API key> 17
#define <API key> 18
#define <API key> 19
#define <API key> 20
#define DB_INSERT 21
#define <API key> 22
#define DB_INSERT_TARGET 23
#define START_BTN_CLICKED 24
#endif // SIGNALCODE_H |
//
//### Java capabilities added 7 Jan 97, Bob Jamison
//### Updated : 27 Nov 97 -- Bob Jamison, Joe Nieten
//### 01 Jan 98 -- Bob Jamison -- fixed generic semantic constructor
//### 01 Jun 99 -- Bob Jamison -- added Runnable support
//### 06 Aug 00 -- Bob Jamison -- made state variables class-global
//### 03 Jan 01 -- Bob Jamison -- improved flags, tracing
//### 16 May 01 -- Bob Jamison -- added custom stack sizing
//### 04 Mar 02 -- Yuval Oren -- improved java performance, added options
//### 14 Mar 02 -- Tomas Hurka -- -d support, static initializer workaround
//### Please send bug reports to tom@hukatronic.cz
//### static char yysccsid[] = "@(#)yaccpar 1.8 (Berkeley) 01/20/90";
//#line 2 "Parser.y"
import java.lang.Math;
import java.io.*;
//#line 20 "Parser.java"
public class Parser
implements ParserTokens
{
boolean yydebug; //do I want debug output?
int yynerrs; //number of errors so far
int yyerrflag; //was there an error?
int yychar; //the current working character
//
//
// method: debug
//
void debug(String msg)
{
if (yydebug)
System.out.println(msg);
}
//
final static int YYSTACKSIZE = 500; //maximum stack size
int statestk[] = new int[YYSTACKSIZE]; //state stack
int stateptr;
int stateptrmax; //highest index of stackptr
int statemax; //state when highest index reached
//
// methods: state stack push,pop,drop,peek
//
final void state_push(int state)
{
try {
stateptr++;
statestk[stateptr]=state;
}
catch (<API key> e) {
int oldsize = statestk.length;
int newsize = oldsize * 2;
int[] newstack = new int[newsize];
System.arraycopy(statestk,0,newstack,0,oldsize);
statestk = newstack;
statestk[stateptr]=state;
}
}
final int state_pop()
{
return statestk[stateptr
}
final void state_drop(int cnt)
{
stateptr -= cnt;
}
final int state_peek(int relative)
{
return statestk[stateptr-relative];
}
//
// method: init_stacks : allocate and prepare stacks
//
final boolean init_stacks()
{
stateptr = -1;
val_init();
return true;
}
//
// method: dump_stacks : show n levels of the stacks
//
void dump_stacks(int count)
{
int i;
System.out.println("=index==state====value= s:"+stateptr+" v:"+valptr);
for (i=0;i<count;i++)
System.out.println(" "+i+" "+statestk[i]+" "+valstk[i]);
System.out.println("======================");
}
//
//public class ParserVal is defined in ParserVal.java
String yytext;//user variable to return contextual strings
ParserVal yyval; //used to return semantic vals from action routines
ParserVal yylval;//the 'lval' (result) I got from yylex()
ParserVal valstk[];
int valptr;
//
// methods: value stack push,pop,drop,peek.
//
void val_init()
{
valstk=new ParserVal[YYSTACKSIZE];
yyval=new ParserVal();
yylval=new ParserVal();
valptr=-1;
}
void val_push(ParserVal val)
{
if (valptr>=YYSTACKSIZE)
return;
valstk[++valptr]=val;
}
ParserVal val_pop()
{
if (valptr<0)
return new ParserVal();
return valstk[valptr
}
void val_drop(int cnt)
{
int ptr;
ptr=valptr-cnt;
if (ptr<0)
return;
valptr = ptr;
}
ParserVal val_peek(int relative)
{
int ptr;
ptr=valptr-relative;
if (ptr<0)
return new ParserVal();
return valstk[ptr];
}
final ParserVal dup_yyval(ParserVal val)
{
ParserVal dup = new ParserVal();
dup.ival = val.ival;
dup.dval = val.dval;
dup.sval = val.sval;
dup.obj = val.obj;
return dup;
}
//
public final static short YYERRCODE=256;
final static short yylhs[] = { -1,
0, 0, 1, 1, 1, 1, 2, 2, 3, 3,
5, 5, 6, 6, 6, 9, 9, 7, 7, 4,
4, 10, 10, 10, 13, 13, 11, 12, 12, 14,
14, 8, 15, 15, 17, 17, 16, 16, 19, 19,
18, 18, 20, 20, 22, 22, 23, 23, 23, 23,
23, 23, 23, 23, 21, 21, 25, 25, 25, 25,
24, 24, 27, 27, 27, 27, 27, 27, 27, 27,
26, 26, 26, 28, 28, 29, 29, 29, 29, 29,
};
final static short yylen[] = { 2,
0, 1, 1, 1, 2, 2, 1, 1, 2, 3,
1, 1, 1, 3, 3, 1, 1, 1, 2, 1,
1, 4, 7, 8, 4, 5, 4, 1, 4, 1,
2, 1, 1, 2, 2, 3, 1, 2, 2, 3,
2, 1, 1, 2, 2, 3, 1, 1, 1, 1,
1, 1, 1, 2, 1, 2, 2, 2, 3, 3,
1, 2, 2, 2, 2, 2, 3, 3, 3, 3,
2, 2, 1, 1, 3, 1, 1, 1, 1, 1,
};
final static short yydefred[] = { 0,
3, 0, 0, 79, 0, 0, 0, 0, 78, 80,
76, 77, 0, 0, 4, 7, 8, 0, 11, 12,
0, 20, 21, 32, 0, 0, 42, 0, 0, 0,
73, 0, 71, 72, 41, 0, 0, 19, 6, 5,
9, 0, 17, 16, 0, 0, 0, 0, 0, 0,
48, 47, 51, 50, 49, 52, 0, 53, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 10, 14, 15, 35, 0, 39, 0, 54, 0,
45, 57, 58, 0, 0, 63, 64, 66, 65, 0,
0, 0, 0, 75, 0, 28, 27, 0, 36, 40,
46, 59, 60, 67, 68, 70, 69, 0, 0, 0,
0, 30, 0, 0, 0, 0, 0, 29, 31, 23,
0, 0, 0, 25, 24, 0, 26,
};
final static short yydgoto[] = { 13,
14, 15, 96, 17, 18, 19, 20, 21, 46, 22,
23, 97, 111, 113, 24, 25, 48, 26, 50, 27,
28, 59, 60, 29, 63, 30, 68, 31, 32,
};
final static short yysindex[] = { -159,
0, -201, -201, 0, -79, -79, -79, -79, 0, 0,
0, 0, 0, -142, 0, 0, 0, -219, 0, 0,
-266, 0, 0, 0, -260, -240, 0, 110, -210, -157,
0, -221, 0, 0, 0, -214, -204, 0, 0, 0,
0, -197, 0, 0, -79, -79, -79, -206, -79, -213,
0, 0, 0, 0, 0, 0, -207, 0, 110, -201,
-201, -201, -163, -201, -201, -201, -201, -150, -201, -119,
-119, 0, 0, 0, 0, -79, 0, -79, 0, -201,
0, 0, 0, -201, -201, 0, 0, 0, 0, -201,
-201, -201, -201, 0, -173, 0, 0, -134, 0, 0,
0, 0, 0, 0, 0, 0, 0, 46, -137, -79,
-132, 0, -205, -119, -133, -131, -79, 0, 0, 0,
-119, -119, -123, 0, 0, -119, 0,
};
final static short yyrindex[] = { 103,
0, 0, 0, 0, 0, 0, 0, -186, 0, 0,
0, 0, 0, 128, 0, 0, 0, 0, 0, 0,
-155, 0, 0, 0, -212, 92, 0, 65, -29, -83,
0, -245, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, -22, 0, 98,
0, 0, 0, 0, 0, 0, 0, 0, 71, 0,
0, 0, 26, 0, 0, 0, 0, -54, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 1, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0,
};
final static short yygindex[] = { 0,
0, -14, 2, 0, 0, 0, 0, -3, 0, 0,
0, -65, 0, 0, 0, -37, 0, 4, 0, 0,
-45, 0, 83, 75, 0, 5, 0, 0, 0,
};
final static int YYTABLESIZE=400;
static short yytable[];
static { yytable();}
static void yytable(){
yytable = new short[]{ 40,
22, 16, 36, 37, 38, 98, 33, 34, 35, 75,
43, 44, 45, 74, 81, 16, 74, 74, 74, 74,
74, 47, 74, 74, 74, 74, 74, 74, 74, 74,
74, 74, 74, 74, 101, 74, 74, 74, 99, 41,
49, 73, 74, 42, 74, 69, 33, 70, 120, 33,
33, 118, 77, 61, 62, 124, 125, 71, 2, 3,
127, 72, 2, 3, 33, 33, 33, 78, 86, 87,
88, 89, 18, 94, 4, 76, 18, 5, 4, 6,
7, 100, 79, 8, 108, 9, 10, 11, 12, 9,
10, 11, 12, 112, 104, 105, 106, 107, 119, 1,
84, 85, 1, 13, 2, 3, 115, 13, 64, 16,
65, 66, 67, 123, 16, 90, 39, 91, 92, 93,
4, 2, 3, 5, 114, 6, 7, 2, 121, 8,
122, 9, 10, 11, 12, 82, 83, 4, 126, 95,
5, 80, 6, 7, 2, 3, 8, 0, 9, 10,
11, 12, 109, 110, 116, 117, 0, 0, 102, 103,
4, 0, 0, 5, 0, 0, 0, 0, 0, 8,
0, 9, 10, 11, 12, 61, 0, 0, 61, 61,
61, 61, 0, 0, 2, 3, 0, 61, 61, 61,
61, 61, 61, 61, 61, 61, 0, 61, 61, 61,
4, 0, 0, 5, 62, 0, 61, 62, 62, 62,
62, 9, 10, 11, 12, 0, 62, 62, 62, 62,
62, 62, 62, 62, 62, 0, 62, 62, 62, 55,
0, 0, 55, 55, 0, 62, 34, 0, 0, 34,
34, 55, 55, 55, 55, 55, 55, 55, 55, 55,
0, 55, 55, 55, 34, 34, 34, 22, 0, 22,
55, 0, 0, 0, 22, 22, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
22, 0, 0, 22, 56, 22, 22, 56, 56, 22,
0, 22, 22, 22, 22, 0, 56, 56, 56, 56,
56, 56, 56, 56, 56, 0, 56, 56, 56, 2,
3, 0, 0, 0, 0, 56, 0, 0, 0, 0,
0, 0, 0, 43, 0, 4, 43, 43, 5, 44,
6, 7, 44, 44, 8, 0, 9, 10, 11, 12,
0, 43, 43, 43, 0, 43, 43, 44, 44, 44,
37, 44, 44, 37, 37, 0, 38, 0, 0, 38,
38, 0, 0, 0, 0, 0, 0, 0, 37, 37,
37, 0, 0, 37, 38, 38, 38, 0, 0, 38,
51, 52, 53, 54, 55, 56, 0, 0, 0, 0,
0, 0, 57, 0, 0, 0, 0, 0, 0, 58,
};
}
static short yycheck[];
static { yycheck(); }
static void yycheck() {
yycheck = new short[] { 14,
0, 0, 6, 7, 8, 71, 2, 3, 5, 47,
277, 278, 279, 259, 60, 14, 262, 263, 264, 265,
266, 282, 268, 269, 270, 271, 272, 273, 274, 275,
276, 277, 278, 279, 80, 281, 282, 283, 76, 259,
281, 45, 46, 263, 290, 267, 259, 262, 114, 262,
263, 257, 49, 264, 265, 121, 122, 262, 264, 265,
126, 259, 264, 265, 277, 278, 279, 281, 64, 65,
66, 67, 259, 69, 280, 282, 263, 283, 280, 285,
286, 78, 290, 289, 258, 291, 292, 293, 294, 291,
292, 293, 294, 108, 90, 91, 92, 93, 113, 259,
264, 265, 0, 259, 264, 265, 110, 263, 266, 108,
268, 269, 270, 117, 113, 266, 259, 268, 269, 270,
280, 264, 265, 283, 262, 285, 286, 0, 262, 289,
262, 291, 292, 293, 294, 61, 62, 280, 262, 259,
283, 59, 285, 286, 264, 265, 289, -1, 291, 292,
293, 294, 287, 288, 287, 288, -1, -1, 84, 85,
280, -1, -1, 283, -1, -1, -1, -1, -1, 289,
-1, 291, 292, 293, 294, 259, -1, -1, 262, 263,
264, 265, -1, -1, 264, 265, -1, 271, 272, 273,
274, 275, 276, 277, 278, 279, -1, 281, 282, 283,
280, -1, -1, 283, 259, -1, 290, 262, 263, 264,
265, 291, 292, 293, 294, -1, 271, 272, 273, 274,
275, 276, 277, 278, 279, -1, 281, 282, 283, 259,
-1, -1, 262, 263, -1, 290, 259, -1, -1, 262,
263, 271, 272, 273, 274, 275, 276, 277, 278, 279,
-1, 281, 282, 283, 277, 278, 279, 257, -1, 259,
290, -1, -1, -1, 264, 265, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
280, -1, -1, 283, 259, 285, 286, 262, 263, 289,
-1, 291, 292, 293, 294, -1, 271, 272, 273, 274,
275, 276, 277, 278, 279, -1, 281, 282, 283, 264,
265, -1, -1, -1, -1, 290, -1, -1, -1, -1,
-1, -1, -1, 259, -1, 280, 262, 263, 283, 259,
285, 286, 262, 263, 289, -1, 291, 292, 293, 294,
-1, 277, 278, 279, -1, 281, 282, 277, 278, 279,
259, 281, 282, 262, 263, -1, 259, -1, -1, 262,
263, -1, -1, -1, -1, -1, -1, -1, 277, 278,
279, -1, -1, 282, 277, 278, 279, -1, -1, 282,
271, 272, 273, 274, 275, 276, -1, -1, -1, -1,
-1, -1, 283, -1, -1, -1, -1, -1, -1, 290,
};
}
final static short YYFINAL=13;
final static short YYMAXTOKEN=294;
final static String yyname[] = {
"end-of-file",null,null,null,null,null,null,null,null,null,null,null,null,null,
null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,
null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,
null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,
null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,
null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,
null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,
null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,
null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,
null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,
null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,
null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,
null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,
null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,
null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,
null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,
null,null,null,"DEDENT","INDENT","NEWLINE","PARENTESISI","PARENTESISD",
"DOSPUNTOS","PUNTOYCOMA","MAS","MENOS","POR","POTENCIA","DIV","DIVENTERA",
"MODULO","MAYOR","MENOR","MENOROIGUAL","MAYOROIGUAL","IGUALIGUAL","DISTINTO",
"DECREMENTO","INCREMENTO","IGUAL","BOOLEAN","AND","OR","NOT","FOR","WHILE","IF",
"ELSE","ELIF","PRINT","IN","CADENA","IDENTIFIER","ENTERO","REAL",
};
final static String yyrule[] = {
"$accept : file_input",
"file_input :",
"file_input : aux0",
"aux0 : NEWLINE",
"aux0 : stmt",
"aux0 : aux0 stmt",
"aux0 : aux0 NEWLINE",
"stmt : simple_stmt",
"stmt : compound_stmt",
"simple_stmt : small_stmt NEWLINE",
"simple_stmt : small_stmt PUNTOYCOMA NEWLINE",
"small_stmt : expr_stmt",
"small_stmt : print_stmt",
"expr_stmt : test",
"expr_stmt : test IGUAL test",
"expr_stmt : test augassign test",
"augassign : INCREMENTO",
"augassign : DECREMENTO",
"print_stmt : PRINT",
"print_stmt : PRINT test",
"compound_stmt : if_stmt",
"compound_stmt : while_stmt",
"if_stmt : IF test DOSPUNTOS suite",
"if_stmt : IF test DOSPUNTOS suite ELSE DOSPUNTOS suite",
"if_stmt : IF test DOSPUNTOS suite aux1 ELSE DOSPUNTOS suite",
"aux1 : ELIF test DOSPUNTOS suite",
"aux1 : aux1 ELIF test DOSPUNTOS suite",
"while_stmt : WHILE test DOSPUNTOS suite",
"suite : simple_stmt",
"suite : NEWLINE INDENT aux2 DEDENT",
"aux2 : stmt",
"aux2 : aux2 stmt",
"test : or_test",
"or_test : and_test",
"or_test : and_test aux3",
"aux3 : OR and_test",
"aux3 : aux3 OR and_test",
"and_test : not_test",
"and_test : not_test aux4",
"aux4 : AND not_test",
"aux4 : aux4 AND not_test",
"not_test : NOT not_test",
"not_test : comparison",
"comparison : expr",
"comparison : expr aux5",
"aux5 : comp_op expr",
"aux5 : aux5 comp_op expr",
"comp_op : MENOR",
"comp_op : MAYOR",
"comp_op : IGUALIGUAL",
"comp_op : MAYOROIGUAL",
"comp_op : MENOROIGUAL",
"comp_op : DISTINTO",
"comp_op : IN",
"comp_op : NOT IN",
"expr : term",
"expr : term aux6",
"aux6 : MAS term",
"aux6 : MENOS term",
"aux6 : aux6 MAS term",
"aux6 : aux6 MENOS term",
"term : factor",
"term : factor aux7",
"aux7 : POR factor",
"aux7 : DIV factor",
"aux7 : MODULO factor",
"aux7 : DIVENTERA factor",
"aux7 : aux7 POR factor",
"aux7 : aux7 DIV factor",
"aux7 : aux7 MODULO factor",
"aux7 : aux7 DIVENTERA factor",
"factor : MAS factor",
"factor : MENOS factor",
"factor : power",
"power : atom",
"power : atom POTENCIA factor",
"atom : ENTERO",
"atom : REAL",
"atom : CADENA",
"atom : BOOLEAN",
"atom : IDENTIFIER",
};
//#line 185 "Parser.y"
private Flexer lexer;
/* interface to the lexer */
private int yylex () {
int yyl_return = -1;
try {
yyl_return = lexer.yylex();
}
catch (IOException e) {
System.err.println("IO error :"+e);
}
return yyl_return;
}
/* error reporting */
public void yyerror (String error) {
System.err.println ("Error: " + lexer.yytext());
}
/* lexer is created in the constructor */
public Parser(Reader r) {
lexer = new Flexer(r, this);
yydebug = true;
}
/* that's how you use the parser */
public static void main(String args[]) throws IOException {
Parser yyparser = new Parser(new FileReader(args[0]));
yyparser.yyparse();
}
//#line 434 "Parser.java"
//
// method: yylexdebug : check lexer state
//
void yylexdebug(int state,int ch)
{
String s=null;
if (ch < 0) ch=0;
if (ch <= YYMAXTOKEN) //check index bounds
s = yyname[ch]; //now get it
if (s==null)
s = "illegal-symbol";
debug("state "+state+", reading "+ch+" ("+s+")");
}
//The following are now global, to aid in error reporting
int yyn; //next next thing to do
int yym;
int yystate; //current parsing state from state table
String yys; //current token string
//
// method: yyparse : parse input and execute indicated items
//
int yyparse()
{
boolean doaction;
init_stacks();
yynerrs = 0;
yyerrflag = 0;
yychar = -1; //impossible char forces a read
yystate=0; //initial state
state_push(yystate); //save it
val_push(yylval); //save empty value
while (true) //until parsing is done, either correctly, or w/error
{
doaction=true;
if (yydebug) debug("loop");
//
for (yyn=yydefred[yystate];yyn==0;yyn=yydefred[yystate])
{
if (yydebug) debug("yyn:"+yyn+" state:"+yystate+" yychar:"+yychar);
if (yychar < 0) //we want a char?
{
yychar = yylex(); //get next token
if (yydebug) debug(" next yychar:"+yychar);
//
if (yychar < 0) //it it didn't work/error
{
yychar = 0; //change it to default string (no -1!)
if (yydebug)
yylexdebug(yystate,yychar);
}
}//yychar<0
yyn = yysindex[yystate]; //get amount to shift by (shift index)
if ((yyn != 0) && (yyn += yychar) >= 0 &&
yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
{
if (yydebug)
debug("state "+yystate+", shifting to state "+yytable[yyn]);
//
yystate = yytable[yyn];//we are in a new state
state_push(yystate); //save it
val_push(yylval); //push our lval as the input for next rule
yychar = -1; //since we have 'eaten' a token, say we need another
if (yyerrflag > 0) //have we recovered an error?
--yyerrflag; //give ourselves credit
doaction=false; //but don't process yet
break; //quit the yyn=0 loop
}
yyn = yyrindex[yystate]; //reduce
if ((yyn !=0 ) && (yyn += yychar) >= 0 &&
yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
{ //we reduced!
if (yydebug) debug("reduce");
yyn = yytable[yyn];
doaction=true; //get ready to execute
break; //drop down to actions
}
else //ERROR RECOVERY
{
if (yyerrflag==0)
{
yyerror("syntax error");
yynerrs++;
}
if (yyerrflag < 3) //low error count?
{
yyerrflag = 3;
while (true) //do until break
{
if (stateptr<0) //check for under & overflow here
{
yyerror("stack underflow. aborting..."); //note lower case 's'
return 1;
}
yyn = yysindex[state_peek(0)];
if ((yyn != 0) && (yyn += YYERRCODE) >= 0 &&
yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE)
{
if (yydebug)
debug("state "+state_peek(0)+", error recovery shifting to state "+yytable[yyn]+" ");
yystate = yytable[yyn];
state_push(yystate);
val_push(yylval);
doaction=false;
break;
}
else
{
if (yydebug)
debug("error recovery discarding state "+state_peek(0)+" ");
if (stateptr<0) //check for under & overflow here
{
yyerror("Stack underflow. aborting..."); //capital 'S'
return 1;
}
state_pop();
val_pop();
}
}
}
else //discard this token
{
if (yychar == 0)
return 1; //yyabort
if (yydebug)
{
yys = null;
if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
if (yys == null) yys = "illegal-symbol";
debug("state "+yystate+", error recovery discards token "+yychar+" ("+yys+")");
}
yychar = -1; //read another
}
}//end error recovery
}//yyn=0 loop
if (!doaction) //any reason not to proceed?
continue; //skip action
yym = yylen[yyn]; //get count of terminals on rhs
if (yydebug)
debug("state "+yystate+", reducing "+yym+" by rule "+yyn+" ("+yyrule[yyn]+")");
if (yym>0) //if count of rhs not 'nil'
yyval = val_peek(yym-1); //get current semantic value
yyval = dup_yyval(yyval); //duplicate yyval if ParserVal is used as semantic value
switch(yyn)
{
//
case 1:
//#line 20 "Parser.y"
{Visitante v = new VisitantePrint();Nodo n = (Nodo) yyval.obj; System.out.println(n == null); System.out.println(n.imprimeSubarbol());n.acepta(v); System.out.println("Reconocimiento exitoso");}
break;
case 2:
//#line 21 "Parser.y"
{Visitante v = new VisitantePrint();Nodo n = (Nodo) yyval.obj; System.out.println(n == null); System.out.println(n.imprimeSubarbol());n.acepta(v); System.out.println("Reconocimiento exitoso");}
break;
case 4:
//#line 25 "Parser.y"
{yyval = val_peek(0);}
break;
case 7:
//#line 32 "Parser.y"
{yyval = val_peek(0);}
break;
case 8:
//#line 33 "Parser.y"
{yyval = val_peek(0);}
break;
case 9:
//#line 37 "Parser.y"
{yyval = val_peek(1);}
break;
case 10:
//#line 39 "Parser.y"
{yyval = val_peek(2);}
break;
case 11:
//#line 43 "Parser.y"
{yyval = val_peek(0);}
break;
case 12:
//#line 44 "Parser.y"
{yyval = val_peek(0);}
break;
case 13:
//#line 48 "Parser.y"
{yyval = val_peek(0);}
break;
case 14:
//#line 49 "Parser.y"
{Nodo n = (Nodo) val_peek(1).obj; Nodo izq = (Nodo) val_peek(2).obj; Nodo der = (Nodo) val_peek(0).obj; n.meteHijoIzq(der); n.meteHijoDer(izq); yyval = new ParserVal((Object)n);}
break;
case 15:
//#line 50 "Parser.y"
{Nodo n = (Nodo) val_peek(1).obj; Nodo izq = (Nodo) val_peek(2).obj; Nodo der = (Nodo) val_peek(0).obj; n.meteHijoIzq(der); n.meteHijoDer(izq); yyval = new ParserVal((Object)n);}
break;
case 16:
//#line 54 "Parser.y"
{yyval = val_peek(0);}
break;
case 17:
//#line 55 "Parser.y"
{yyval = val_peek(0);}
break;
case 19:
//#line 60 "Parser.y"
{Nodo n = (Nodo) val_peek(1).obj; Nodo izq = (Nodo) val_peek(0).obj; n.meteHijoDer(izq); yyval = new ParserVal((Object)n);}
break;
case 20:
//#line 64 "Parser.y"
{yyval = val_peek(0);}
break;
case 21:
//#line 65 "Parser.y"
{yyval = val_peek(0);}
break;
case 22:
//#line 69 "Parser.y"
{Nodo n = (Nodo) val_peek(3).obj; Nodo izq = (Nodo) val_peek(2).obj; Nodo der = (Nodo) val_peek(0).obj; n.meteHijoIzq(der); n.meteHijoDer(izq); yyval = new ParserVal((Object)n);}
break;
case 23:
//#line 70 "Parser.y"
{Nodo n = (Nodo) val_peek(6).obj; Nodo izq = (Nodo) val_peek(5).obj; Nodo der = (Nodo) val_peek(3).obj; Nodo felse = (Nodo) val_peek(2).obj; Nodo otro = (Nodo) val_peek(0).obj; n.meteHijo(felse); n.meteHijo(der); n.meteHijo(izq); felse.meteHijo(otro); yyval = new ParserVal((Object)n);}
break;
case 24:
//#line 71 "Parser.y"
{Nodo n = (Nodo) val_peek(7).obj; Nodo test = (Nodo) val_peek(6).obj; Nodo sucede = (Nodo) val_peek(4).obj; Nodo elif = (Nodo)val_peek(3).obj; Nodo felse = (Nodo)val_peek(2).obj; Nodo otro = (Nodo)val_peek(0).obj; n.meteHijo(felse); n.meteHijo(elif); n.meteHijo(sucede); n.meteHijo(test); felse.meteHijo(otro); yyval = new ParserVal((Object)n);}
break;
case 25:
//#line 74 "Parser.y"
{Nodo n = (Nodo) val_peek(3).obj; Nodo izq = (Nodo) val_peek(2).obj; Nodo der = (Nodo) val_peek(0).obj; n.meteHijoIzq(der); n.meteHijoDer(izq); yyval = new ParserVal((Object)n);}
break;
case 26:
//#line 75 "Parser.y"
{Nodo aux = (Nodo) val_peek(4).obj; Nodo elif = (Nodo) val_peek(3).obj; Nodo cond = (Nodo) val_peek(2).obj; Nodo suc = (Nodo) val_peek(0).obj; aux.meteInicio(elif); elif.meteHijoIzq(suc); elif.meteHijoDer(cond); yyval = new ParserVal((Object)aux);}
break;
case 27:
//#line 79 "Parser.y"
{Nodo n = (Nodo) val_peek(3).obj; Nodo izq = (Nodo) val_peek(2).obj; Nodo der = (Nodo) val_peek(0).obj; n.meteHijoIzq(der); n.meteHijoDer(izq); yyval = new ParserVal((Object)n);}
break;
case 28:
//#line 83 "Parser.y"
{yyval = val_peek(0);}
break;
case 29:
//#line 84 "Parser.y"
{yyval = val_peek(1);}
break;
case 30:
//#line 87 "Parser.y"
{yyval = val_peek(0);}
break;
case 31:
//#line 88 "Parser.y"
{Nodo n = (Nodo) val_peek(1).obj; Nodo hijo = (Nodo) val_peek(0).obj; n.meteHijoDer(hijo); yyval = new ParserVal((Object)n);}
break;
case 32:
//#line 92 "Parser.y"
{yyval = val_peek(0);}
break;
case 33:
//#line 96 "Parser.y"
{yyval = val_peek(0);}
break;
case 34:
//#line 97 "Parser.y"
{Nodo n = (Nodo) val_peek(0).obj; Nodo hijo = (Nodo) val_peek(1).obj; n.meteHijoDer(hijo); yyval = new ParserVal((Object)n);}
break;
case 35:
//#line 100 "Parser.y"
{Nodo n = (Nodo) val_peek(1).obj; Nodo der = (Nodo) val_peek(0).obj; n.meteHijoDer(der); yyval = new ParserVal((Object)n);}
break;
case 36:
//#line 101 "Parser.y"
{Nodo n = (Nodo) val_peek(1).obj; Nodo izq = (Nodo) val_peek(2).obj; Nodo der = (Nodo) val_peek(0).obj; n.meteHijoIzq(der); n.meteHijoDer(izq); yyval = new ParserVal((Object)n);}
break;
case 37:
//#line 105 "Parser.y"
{yyval = val_peek(0);}
break;
case 38:
//#line 106 "Parser.y"
{Nodo n = (Nodo) val_peek(0).obj; Nodo hijo = (Nodo) val_peek(1).obj; n.meteHijoDer(hijo); yyval = new ParserVal((Object)n);}
break;
case 39:
//#line 109 "Parser.y"
{Nodo n = (Nodo) val_peek(1).obj; Nodo der = (Nodo) val_peek(0).obj; n.meteHijoDer(der); yyval = new ParserVal((Object)n);}
break;
case 40:
//#line 110 "Parser.y"
{Nodo n = (Nodo) val_peek(1).obj; Nodo izq = (Nodo) val_peek(2).obj; Nodo der = (Nodo) val_peek(0).obj; n.meteHijoIzq(der); n.meteHijoDer(izq); yyval = new ParserVal((Object)n);}
break;
case 41:
//#line 114 "Parser.y"
{Nodo n = (Nodo) val_peek(1).obj; Nodo izq = (Nodo) val_peek(0).obj; n.meteHijoIzq(izq); yyval = new ParserVal((Object)n);}
break;
case 42:
//#line 115 "Parser.y"
{yyval = val_peek(0);}
break;
case 43:
//#line 119 "Parser.y"
{yyval = val_peek(0);}
break;
case 44:
//#line 120 "Parser.y"
{Nodo n = (Nodo) val_peek(0).obj; Nodo hijo = (Nodo) val_peek(1).obj; n.meteHijoDer(hijo); yyval = new ParserVal((Object)n);}
break;
case 45:
//#line 123 "Parser.y"
{Nodo n = (Nodo) val_peek(1).obj; Nodo der = (Nodo) val_peek(0).obj; n.meteHijoDer(der); yyval = new ParserVal((Object)n);}
break;
case 46:
//#line 124 "Parser.y"
{Nodo n = (Nodo) val_peek(1).obj; Nodo izq = (Nodo) val_peek(2).obj; Nodo der = (Nodo) val_peek(0).obj; n.meteHijoIzq(izq); n.meteHijoDer(der); yyval = new ParserVal((Object)n);}
break;
case 47:
//#line 128 "Parser.y"
{yyval = val_peek(0);}
break;
case 48:
//#line 129 "Parser.y"
{yyval = val_peek(0);}
break;
case 49:
//#line 130 "Parser.y"
{yyval = val_peek(0);}
break;
case 50:
//#line 131 "Parser.y"
{yyval = val_peek(0);}
break;
case 51:
//#line 132 "Parser.y"
{yyval = val_peek(0);}
break;
case 52:
//#line 133 "Parser.y"
{yyval = val_peek(0);}
break;
case 53:
//#line 134 "Parser.y"
{yyval = val_peek(0);}
break;
case 54:
//#line 135 "Parser.y"
{yyval = val_peek(1); yyval = val_peek(0);}
break;
case 55:
//#line 139 "Parser.y"
{yyval = val_peek(0);}
break;
case 56:
//#line 140 "Parser.y"
{Nodo n = (Nodo) val_peek(0).obj; Nodo hijo = (Nodo) val_peek(1).obj; n.meteHijoDer(hijo); yyval = new ParserVal((Object)n);}
break;
case 57:
//#line 143 "Parser.y"
{Nodo n = (Nodo) val_peek(1).obj; Nodo der = (Nodo) val_peek(0).obj; n.meteHijoDer(der); yyval = new ParserVal((Object)n);}
break;
case 58:
//#line 144 "Parser.y"
{Nodo n = (Nodo) val_peek(1).obj; Nodo der = (Nodo) val_peek(0).obj; n.meteHijoDer(der); yyval = new ParserVal((Object)n);}
break;
case 59:
//#line 145 "Parser.y"
{Nodo n = (Nodo) val_peek(1).obj; Nodo izq = (Nodo) val_peek(2).obj; Nodo der = (Nodo) val_peek(0).obj; n.meteHijoIzq(der); n.meteHijoDer(izq); yyval = new ParserVal((Object)n);}
break;
case 60:
//#line 146 "Parser.y"
{Nodo n = (Nodo) val_peek(1).obj; Nodo izq = (Nodo) val_peek(2).obj; Nodo der = (Nodo) val_peek(0).obj; n.meteHijoIzq(der); n.meteHijoDer(izq); yyval = new ParserVal((Object)n);}
break;
case 61:
//#line 150 "Parser.y"
{yyval = val_peek(0);}
break;
case 62:
//#line 151 "Parser.y"
{Nodo n = (Nodo) val_peek(0).obj; Nodo hijo = (Nodo) val_peek(1).obj; n.meteHijoDer(hijo); yyval = new ParserVal((Object)n);}
break;
case 63:
//#line 154 "Parser.y"
{Nodo n = (Nodo) val_peek(1).obj; Nodo der = (Nodo) val_peek(0).obj; n.meteHijoDer(der); yyval = new ParserVal((Object)n);}
break;
case 64:
//#line 155 "Parser.y"
{Nodo n = (Nodo) val_peek(1).obj; Nodo der = (Nodo) val_peek(0).obj; n.meteHijoDer(der); yyval = new ParserVal((Object)n);}
break;
case 65:
//#line 156 "Parser.y"
{Nodo n = (Nodo) val_peek(1).obj; Nodo der = (Nodo) val_peek(0).obj; n.meteHijoDer(der); yyval = new ParserVal((Object)n);}
break;
case 66:
//#line 157 "Parser.y"
{Nodo n = (Nodo) val_peek(1).obj; Nodo der = (Nodo) val_peek(0).obj; n.meteHijoDer(der); yyval = new ParserVal((Object)n);}
break;
case 67:
//#line 158 "Parser.y"
{Nodo n = (Nodo) val_peek(1).obj; Nodo izq = (Nodo) val_peek(2).obj; Nodo der = (Nodo) val_peek(0).obj; n.meteHijoIzq(der); n.meteHijoDer(izq); yyval = new ParserVal((Object)n);}
break;
case 68:
//#line 159 "Parser.y"
{Nodo n = (Nodo) val_peek(1).obj; Nodo izq = (Nodo) val_peek(2).obj; Nodo der = (Nodo) val_peek(0).obj; n.meteHijoIzq(der); n.meteHijoDer(izq); yyval = new ParserVal((Object)n);}
break;
case 69:
//#line 160 "Parser.y"
{Nodo n = (Nodo) val_peek(1).obj; Nodo izq = (Nodo) val_peek(2).obj; Nodo der = (Nodo) val_peek(0).obj; n.meteHijoIzq(der); n.meteHijoDer(izq); yyval = new ParserVal((Object)n);}
break;
case 70:
//#line 161 "Parser.y"
{Nodo n = (Nodo) val_peek(1).obj; Nodo izq = (Nodo) val_peek(2).obj; Nodo der = (Nodo) val_peek(0).obj; n.meteHijoIzq(der); n.meteHijoDer(izq); yyval = new ParserVal((Object)n);}
break;
case 71:
//#line 165 "Parser.y"
{Nodo n = (Nodo) val_peek(1).obj; Nodo izq = (Nodo) val_peek(0).obj; n.meteHijoDer(izq); yyval = new ParserVal((Object)n);}
break;
case 72:
//#line 166 "Parser.y"
{Nodo n = (Nodo) val_peek(1).obj; Nodo izq = (Nodo) val_peek(0).obj; n.meteHijoDer(izq); yyval = new ParserVal((Object)n);}
break;
case 73:
//#line 167 "Parser.y"
{yyval = val_peek(0);}
break;
case 74:
//#line 171 "Parser.y"
{yyval = val_peek(0);}
break;
case 75:
//#line 172 "Parser.y"
{Nodo n = (Nodo) val_peek(1).obj; Nodo izq = (Nodo) val_peek(2).obj; Nodo der = (Nodo) val_peek(0).obj; n.meteHijoIzq(der); n.meteHijoDer(izq); yyval = new ParserVal((Object)n);}
break;
case 76:
//#line 177 "Parser.y"
{yyval = val_peek(0);}
break;
case 77:
//#line 178 "Parser.y"
{yyval = val_peek(0);}
break;
case 78:
//#line 179 "Parser.y"
{yyval = val_peek(0);}
break;
case 79:
//#line 180 "Parser.y"
{yyval = val_peek(0);}
break;
case 80:
//#line 181 "Parser.y"
{yyval = val_peek(0);}
break;
//#line 887 "Parser.java"
//
}//switch
//
if (yydebug) debug("reduce");
state_drop(yym); //we just reduced yylen states
yystate = state_peek(0); //get new state
val_drop(yym); //corresponding value drop
yym = yylhs[yyn]; //select next TERMINAL(on lhs)
if (yystate == 0 && yym == 0)//done? 'rest' state and at first TERMINAL
{
if (yydebug) debug("After reduction, shifting from state 0 to state "+YYFINAL+"");
yystate = YYFINAL; //explicitly say we're done
state_push(YYFINAL); //and save it
val_push(yyval); //also save the semantic value of parsing
if (yychar < 0) //we want another character?
{
yychar = yylex(); //get next character
if (yychar<0) yychar=0; //clean, if necessary
if (yydebug)
yylexdebug(yystate,yychar);
}
if (yychar == 0) //Good exit (if lex returns 0 ;-)
break; //quit the loop--all DONE
}//if yystate
else //else not done yet
{ //get next state and push, for next yydefred[]
yyn = yygindex[yym]; //find out where to go
if ((yyn != 0) && (yyn += yystate) >= 0 &&
yyn <= YYTABLESIZE && yycheck[yyn] == yystate)
yystate = yytable[yyn]; //get new state
else
yystate = yydgoto[yym]; //else go to new defred
if (yydebug) debug("after reduction, shifting from state "+state_peek(0)+" to state "+yystate+"");
state_push(yystate); //going again, so push state & val...
val_push(yyval); //for next action
}
}//main loop
return 0;//yyaccept!!
}
//
//
/**
* A default run method, used for operating this parser
* object in the background. It is intended for extending Thread
* or implementing Runnable. Turn off with -Jnorun .
*/
public void run()
{
yyparse();
}
//
//
/**
* Default constructor. Turn off with -Jnoconstruct .
*/
public Parser()
{
//nothing to do
}
/**
* Create a parser, setting the debug to true or false.
* @param debugMe true for debugging, false for no debug.
*/
public Parser(boolean debugMe)
{
yydebug=debugMe;
}
//
}
// |
#include <stdio.h>
#include "PassFail.h"
/** test_passfail
*
* \return nothing
*
* Output both ways and show the final tally by using a 0-length message.
*/
void test_passfail() {
PASSFAIL(1, "Expect exactly 1 [FAIL]");
PASSFAIL(1, "Expect [PASS]");
PASSFAIL(0, "Expect [FAIL]");
PASSFAIL(1, "");
}
/** main
*
* Entirely ordinary main.
* Without args, the tests are run.
* With args, argc and argv are used (avoids lint warnings).
*/
int main(int argc, char **argv) {
test_passfail();
while (--argc) puts(*++argv);
return 0;
} |
require 'builder'
require 'open-uri'
require 'nokogiri'
require '<API key>'
# This class builds the RIF-CS for a collection, delegating to a wrapper object to find the necessary values.
# The idea is that this can be reused across projects, and that the project-specific details of what goes into
# the rifcs are encoded in the wrapper class. Create your own wrapper by subclassing RifCsWrapper. This is a work
# in progress and will likely need a bit of work to make it flexible enough to handle various different project needs.
class RifCsGenerator
attr_accessor :wrapper_object, :xml
def initialize(wrapper_object, target)
self.wrapper_object = wrapper_object
self.xml = Builder::XmlMarkup.new :target => target, :indent => 2
end
def build_rif_cs
xml.instruct!
xml.registryObjects(:xmlns => 'http://ands.org.au/standards/rif-cs/registryObjects',
'xmlns:xsi' => 'http:
'xsi:schemaLocation' => 'http:
xml.registryObject group: wrapper_object.group do
xml.key wrapper_object.key
xml.originatingSource wrapper_object.originating_source
xml.collection type: wrapper_object.collection_type do
xml.name type: 'primary' do
xml.namePart wrapper_object.title, {'xml:lang' => wrapper_object.language}
end
xml.name type: 'alternative' do
xml.namePart wrapper_object.filename
end
xml.location do
xml.address do
xml.electronic type: 'url', target: 'directDownload' do
xml.value wrapper_object.electronic_location
xml.title wrapper_object.<API key>
xml.byteSize wrapper_object.byte_size
xml.notes wrapper_object.<API key>
end
xml.physical do
xml.addressPart wrapper_object.physical_address, type: 'text'
end
end
end
wrapper_object.local_subjects.each do |subject|
xml.subject subject, {'type' => 'local', 'xml:lang' => wrapper_object.language}
end
wrapper_object.for_codes.each do |for_code|
xml.subject for_code, {type: 'anzsrc-for', 'xml:lang' => wrapper_object.language}
end
unless wrapper_object.<API key>.blank?
xml.description wrapper_object.<API key>, {type: 'full', 'xml:lang' => wrapper_object.language}
end
xml.rights do
xml.rightsStatement wrapper_object.rights_statement
xml.accessRights wrapper_object.access_rights_text, {type: wrapper_object.access_rights_type, rightsUri: wrapper_object.access_rights_uri}
xml.licence type: wrapper_object.license_type, rightsUri: wrapper_object.license_uri
end
xml.identifier wrapper_object.identifier_uri, {type: 'uri'}
xml.identifier wrapper_object.identifier_handle, {type: 'handle'}
if wrapper_object.start_time || wrapper_object.end_time
xml.coverage do
xml.temporal do
if wrapper_object.start_time
start_datetime = DateTime.parse(wrapper_object.start_time.to_s).strftime("%FT%T%:z")
xml.date start_datetime, type: 'dateFrom', dateFormat: 'W3CDTF'
end
if wrapper_object.end_time
end_datetime = DateTime.parse(wrapper_object.end_time.to_s).strftime("%FT%T%:z")
xml.date end_datetime, type: 'dateTo', dateFormat: 'W3CDTF'
end
end
end
end
wrapper_object.locations.each do |points|
xml.coverage do
points.each do |point|
xml.spatial "#{point[:long]},#{point[:lat]}", {type: 'gmlKmlPolyCoords', 'xml:lang' => wrapper_object.language}
end
end
end
wrapper_object.grant_numbers.each do |grant_number|
xml.relatedObject do
xml.key grant_number
xml.relation type: 'isOutputOf'
end
end
xml.relatedObject do
xml.key wrapper_object.creator_name
xml.relation type: 'hasCollector' do
xml.description 'Creator'
end
end
wrapper_object.contributors.each do |contributor|
xml.relatedObject do
xml.key contributor
xml.relation type: 'isEnrichedBy' do
xml.description 'Contributor'
end
end
end
xml.relatedObject do
xml.key wrapper_object.managed_by
xml.relation type: 'isManagedBy'
end
wrapper_object.primary_contacts.each do |contact|
xml.relatedObject do
xml.key contact
xml.relation type: 'hasAssociationWith' do
xml.description 'Primary Contact'
end
end
end
wrapper_object.related_websites.each do |related_website|
xml.relatedInfo type: 'website' do
xml.identifier related_website[:url], type: 'uri'
xml.title related_website[:title]
end
end
wrapper_object.notes.each do |note|
xml.relatedInfo do
xml.notes note
end
end
end
end
end
end
end |
from django.conf.urls import url
from annotate import views
urlpatterns = [
url(r'^$', views.IndexView.as_view(), name='index'),
url(r'^create$', views.create_annotation, name='create'),
url(r'^edit$', views.edit_annotation, name='edit'),
url(r'^json$', views.export_json, name='export_json'),
url(r'^rdf$', views.export_rdf, name='export_rdf'),
url(r'^(?P<pk>\d+)/update$', views.update_annotation, name='update'),
url(r'^(?P<pk>\d+)/$', views.DetailView.as_view(), name='detail'),
] |
#ifndef <API key>
#define <API key>
#include "../<API key>/<API key>.h"
class AndroidQmlAppViewer : public <API key>
{
Q_OBJECT
public:
explicit AndroidQmlAppViewer(QWidget *parent = 0);
protected:
void closeEvent(QCloseEvent *);
void keyPressEvent(QKeyEvent *);
private:
bool m_closePressed;
};
#endif // <API key> |
<?php
class <API key>
{
public static function display(Item $item)
{
if (Poll<API key>::<API key>()-><API key>())
{
$tpl = new FileTemplate('poll/PollVotesResult.tpl');
$tpl->add_lang(LangLoader::get_all_langs('poll'));
$tpl->put_all(array(
'C_HAS_VOTES' => $item->has_votes(),
'TOTAL_VOTES_NUMBER' => $item->get_votes_number()
));
if ($item->has_votes())
{
foreach ($item->get_votes() as $answer => $votes_number)
{
$percentage = round($votes_number * 100 / $item->get_votes_number(), 0);
$tpl->assign_block_vars('votes_result', array(
'ANSWER' => $answer,
'VOTES_NUMBER' => $votes_number,
'PERCENTAGE' => $percentage
));
}
}
return $tpl;
}
}
}
?> |
/**
* Scaffolding file used to store all the setups needed to run
* tests automatically generated by EvoSuite
* Thu Sep 20 13:55:48 GMT 2018
*/
package uk.ac.sanger.artemis.plot;
import org.evosuite.runtime.annotation.<API key>;
import org.junit.BeforeClass;
import org.junit.Before;
import org.junit.After;
import org.junit.AfterClass;
import org.evosuite.runtime.sandbox.Sandbox;
import org.evosuite.runtime.sandbox.Sandbox.SandboxMode;
@<API key>
public class <API key> {
@org.junit.Rule
public org.evosuite.runtime.vnet.<API key> nfr = new org.evosuite.runtime.vnet.<API key>();
private static final java.util.Properties defaultProperties = (java.util.Properties) java.lang.System.getProperties().clone();
private org.evosuite.runtime.thread.ThreadStopper threadStopper = new org.evosuite.runtime.thread.ThreadStopper (org.evosuite.runtime.thread.KillSwitchHandler.getInstance(), 3000);
@BeforeClass
public static void <API key>() {
org.evosuite.runtime.RuntimeSettings.className = "uk.ac.sanger.artemis.plot.<API key>";
org.evosuite.runtime.GuiSupport.initialize();
org.evosuite.runtime.RuntimeSettings.maxNumberOfThreads = 100;
org.evosuite.runtime.RuntimeSettings.<API key> = 10000;
org.evosuite.runtime.RuntimeSettings.mockSystemIn = true;
org.evosuite.runtime.RuntimeSettings.sandboxMode = org.evosuite.runtime.sandbox.Sandbox.SandboxMode.RECOMMENDED;
org.evosuite.runtime.sandbox.Sandbox.<API key>();
org.evosuite.runtime.classhandling.JDKClassResetter.init();
setSystemProperties();
initializeClasses();
org.evosuite.runtime.Runtime.getInstance().resetRuntime();
}
@AfterClass
public static void <API key>(){
Sandbox.<API key>();
java.lang.System.setProperties((java.util.Properties) defaultProperties.clone());
}
@Before
public void initTestCase(){
threadStopper.storeCurrentThreads();
threadStopper.startRecordingTime();
org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().initHandler();
org.evosuite.runtime.sandbox.Sandbox.<API key>();
setSystemProperties();
org.evosuite.runtime.GuiSupport.setHeadless();
org.evosuite.runtime.Runtime.getInstance().resetRuntime();
org.evosuite.runtime.agent.InstrumentingAgent.activate();
}
@After
public void doneWithTestCase(){
threadStopper.<API key>();
org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().<API key>();
org.evosuite.runtime.classhandling.JDKClassResetter.reset();
resetClasses();
org.evosuite.runtime.sandbox.Sandbox.<API key>();
org.evosuite.runtime.agent.InstrumentingAgent.deactivate();
org.evosuite.runtime.GuiSupport.restoreHeadlessMode();
}
public static void setSystemProperties() {
java.lang.System.setProperties((java.util.Properties) defaultProperties.clone());
java.lang.System.setProperty("file.encoding", "UTF-8");
java.lang.System.setProperty("java.awt.headless", "true");
java.lang.System.setProperty("java.io.tmpdir", "/var/folders/r3/<API key>/T/");
java.lang.System.setProperty("user.country", "GB");
java.lang.System.setProperty("user.dir", "/Users/kp11/workspace/applications/Artemis-build-ci/Artemis");
java.lang.System.setProperty("user.home", "/Users/kp11");
java.lang.System.setProperty("user.language", "en");
java.lang.System.setProperty("user.name", "kp11");
java.lang.System.setProperty("user.timezone", "");
}
private static void initializeClasses() {
org.evosuite.runtime.classhandling.ClassStateSupport.initializeClasses(<API key>.class.getClassLoader() ,
"uk.ac.sanger.artemis.plot.<API key>"
);
}
private static void resetClasses() {
org.evosuite.runtime.classhandling.ClassResetter.getInstance().setClassLoader(<API key>.class.getClassLoader());
org.evosuite.runtime.classhandling.ClassStateSupport.resetClasses(
"uk.ac.sanger.artemis.plot.<API key>",
"org.postgresql.util.SharedTimer",
"org.postgresql.Driver",
"org.hsqldb.jdbc.JDBCDriver"
);
}
} |
package org.armedbear.lisp;
import static org.armedbear.lisp.Lisp.*;
// ### %adjust-array array new-dimensions element-type initial-element
// initial-element-p initial-contents initial-contents-p fill-pointer
// displaced-to <API key> => new-array
public final class adjust_array extends Primitive
{
public adjust_array()
{
super("%adjust-array", PACKAGE_SYS, false);
}
@Override
public LispObject execute(LispObject[] args)
{
if (args.length != 10)
return error(new <API key>(this, 10));
AbstractArray array = checkArray(args[0]);
LispObject dimensions = args[1];
LispObject elementType = args[2];
boolean <API key> = args[4] != NIL;
boolean <API key> = args[6] != NIL;
LispObject initialElement = <API key> ? args[3] : null;
LispObject initialContents = <API key> ? args[5] : null;
LispObject fillPointer = args[7];
LispObject displacedTo = args[8];
LispObject <API key> = args[9];
if (<API key> && <API key>) {
return error(new LispError("ADJUST-ARRAY: cannot specify both initial element and initial contents."));
}
if (elementType != array.getElementType() &&
<API key>(elementType) != array.getElementType())
{
return error(new LispError("ADJUST-ARRAY: incompatible element type."));
}
if (array.getRank() == 0) {
return array.adjustArray(new int[0], initialElement, initialContents);
}
if (!<API key> && array.getElementType() == T)
initialElement = Fixnum.ZERO;
if (array.getRank() == 1) {
final int newSize;
if (dimensions instanceof Cons && dimensions.length() == 1)
newSize = Fixnum.getValue(dimensions.car());
else
newSize = Fixnum.getValue(dimensions);
if (array instanceof AbstractVector) {
AbstractVector v = (AbstractVector) array;
AbstractArray v2;
if (displacedTo != NIL) {
final int displacement;
if (<API key> == NIL)
displacement = 0;
else
displacement = Fixnum.getValue(<API key>);
v2 = v.adjustArray(newSize,
checkArray(displacedTo),
displacement);
} else {
v2 = v.adjustArray(newSize,
initialElement,
initialContents);
}
if (fillPointer != NIL)
v2.setFillPointer(fillPointer);
return v2;
}
}
// rank > 1
final int rank = dimensions.listp() ? dimensions.length() : 1;
int[] dimv = new int[rank];
if (dimensions.listp()) {
for (int i = 0; i < rank; i++) {
LispObject dim = dimensions.car();
dimv[i] = Fixnum.getValue(dim);
dimensions = dimensions.cdr();
}
} else
dimv[0] = Fixnum.getValue(dimensions);
if (displacedTo != NIL) {
final int displacement;
if (<API key> == NIL)
displacement = 0;
else
displacement = Fixnum.getValue(<API key>);
return array.adjustArray(dimv,
checkArray(displacedTo),
displacement);
} else {
return array.adjustArray(dimv,
initialElement,
initialContents);
}
}
private static final Primitive _ADJUST_ARRAY = new adjust_array();
} |
package com.example.tomek.myapplication;
import java.util.Date;
class XYZAccelVector {
private float x;
private float y;
private float z;
private long timestamp;
public XYZAccelVector(float x, float y, float z, long timestamp)
{
this.x=x;
this.y=y;
this.z=z;
this.timestamp = timestamp;
}
public String getXMLString()
{
return String.format("<AccelItem data=\"%d\" x=\"%f\" y=\"%f\" z=\"%f\"/>\n",
timestamp, x, y, z);
}
public float getX()
{
return x;
}
public float getY()
{
return y;
}
public float getZ()
{
return z;
}
public Date getDate()
{
return new Date(timestamp);
}
public long getTime()
{
return timestamp;
}
} |
package com.yc.xmj.util;
import com.taobao.api.ApiException;
import com.taobao.api.DefaultTaobaoClient;
import com.taobao.api.TaobaoClient;
import com.taobao.api.request.<API key>;
import com.taobao.api.response.<API key>;
public class SMS {
int num = 0;
static final String SMS_URL = "http://gw.api.taobao.com/router/rest";
static final String SMS_APPKEY = "23647603";
static final String SMS_<API key>;
public int sendSMS(String phone){
num = random4();
System.out.println(num+" ===============sendSMS");
TaobaoClient client = new DefaultTaobaoClient(SMS_URL, SMS_APPKEY, SMS_SECRET);
<API key> req = new <API key>();
req.setExtend("123456");
req.setSmsType("normal");
req.setSmsFreeSignName("");
req.setSmsParamString("{\"code\":\""+ num +"\",\"name\":\""+ phone +"\"}");
req.setRecNum(phone);
req.setSmsTemplateCode("SMS_48520003");
<API key> rsp = null;
try {
rsp = client.execute(req);
System.out.println(rsp.getBody());
} catch (ApiException e) {
// TODO Auto-generated catch block
e.printStackTrace();
return -1;
}
return 0;
}
public int random4(){
return (int)(Math.random()*(9999-1000+1))+1000; //1000-9999
}
public int getNum() {
return num;
}
public void setNum(int num) {
this.num = num;
}
public SMS() {
// TODO Auto-generated constructor stub
}
} |
<!DOCTYPE HTML PUBLIC "-
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (1.8.0_60) on Sun Nov 13 21:32:44 MST 2016 -->
<title>RideRequestListTest</title>
<meta name="date" content="2016-11-13">
<link rel="stylesheet" type="text/css" href="../../stylesheet.css" title="Style">
<script type="text/javascript" src="../../script.js"></script>
</head>
<body>
<script type="text/javascript"><!
try {
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="RideRequestListTest";
}
}
catch(err) {
}
var methods = {"i0":10,"i1":10,"i2":10,"i3":10,"i4":10,"i5":10,"i6":10,"i7":10};
var tabs = {65535:["t0","All Methods"],2:["t2","Instance Methods"],8:["t4","Concrete Methods"]};
var altColor = "altColor";
var rowColor = "rowColor";
var tableTab = "tableTab";
var activeTableTab = "activeTableTab";
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<div class="topNav"><a name="navbar.top">
</a>
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.top.firstrow">
</a>
<ul class="navList" title="Navigation">
<li><a href="../../assignment1/ridengo/package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../index-files/index-1.html">Index</a></li>
<li><a href="../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../assignment1/ridengo/RideRequestList.html" title="class in assignment1.ridengo"><span class="typeNameLink">Prev Class</span></a></li>
<li><a href="../../assignment1/ridengo/RideRequestTest.html" title="class in assignment1.ridengo"><span class="typeNameLink">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../index.html?assignment1/ridengo/RideRequestListTest.html" target="_top">Frames</a></li>
<li><a href="RideRequestListTest.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="<API key>">
<li><a href="../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!
allClassesLink = document.getElementById("<API key>");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary: </li>
<li>Nested | </li>
<li>Field | </li>
<li><a href="#constructor.summary">Constr</a> | </li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail: </li>
<li>Field | </li>
<li><a href="#constructor.detail">Constr</a> | </li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a name="skip.navbar.top">
</a></div>
<div class="header">
<div class="subTitle">assignment1.ridengo</div>
<h2 title="Class RideRequestListTest" class="title">Class RideRequestListTest</h2>
</div>
<div class="contentContainer">
<ul class="inheritance">
<li>java.lang.Object</li>
<li>
<ul class="inheritance">
<li>TestCase</li>
<li>
<ul class="inheritance">
<li>assignment1.ridengo.RideRequestListTest</li>
</ul>
</li>
</ul>
</li>
</ul>
<div class="description">
<ul class="blockList">
<li class="blockList">
<hr>
<br>
<pre>public class <span class="typeNameLabel">RideRequestListTest</span>
extends TestCase</pre>
<div class="block">Created by Rui on 2016-11-12.</div>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<ul class="blockList">
<li class="blockList"><a name="constructor.summary">
</a>
<h3>Constructor Summary</h3>
<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Constructor Summary table, listing constructors, and an explanation">
<caption><span>Constructors</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colOne" scope="col">Constructor and Description</th>
</tr>
<tr class="altColor">
<td class="colOne"><code><span class="memberNameLink"><a href="../../assignment1/ridengo/RideRequestListTest.html#RideRequestListTest--">RideRequestListTest</a></span>()</code> </td>
</tr>
</table>
</li>
</ul>
<ul class="blockList">
<li class="blockList"><a name="method.summary">
</a>
<h3>Method Summary</h3>
<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
<caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd"> </span></span><span id="t2" class="tableTab"><span><a href="javascript:show(2);">Instance Methods</a></span><span class="tabEnd"> </span></span><span id="t4" class="tableTab"><span><a href="javascript:show(8);">Concrete Methods</a></span><span class="tabEnd"> </span></span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tr id="i0" class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../assignment1/ridengo/RideRequestListTest.html#testAddRequest--">testAddRequest</a></span>()</code> </td>
</tr>
<tr id="i1" class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../assignment1/ridengo/RideRequestListTest.html#testClear--">testClear</a></span>()</code> </td>
</tr>
<tr id="i2" class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../assignment1/ridengo/RideRequestListTest.html#testContains--">testContains</a></span>()</code> </td>
</tr>
<tr id="i3" class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../assignment1/ridengo/RideRequestListTest.html#testGetRequests--">testGetRequests</a></span>()</code> </td>
</tr>
<tr id="i4" class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../assignment1/ridengo/RideRequestListTest.html#<API key>--"><API key></a></span>()</code> </td>
</tr>
<tr id="i5" class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../assignment1/ridengo/RideRequestListTest.html#<API key>--"><API key></a></span>()</code> </td>
</tr>
<tr id="i6" class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../assignment1/ridengo/RideRequestListTest.html#<API key>--"><API key></a></span>()</code> </td>
</tr>
<tr id="i7" class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../assignment1/ridengo/RideRequestListTest.html#testRemoveRequest--">testRemoveRequest</a></span>()</code> </td>
</tr>
</table>
<ul class="blockList">
<li class="blockList"><a name="methods.inherited.from.class.java.lang.Object">
</a>
<h3>Methods inherited from class java.lang.Object</h3>
<code>clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</code></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<ul class="blockList">
<li class="blockList"><a name="constructor.detail">
</a>
<h3>Constructor Detail</h3>
<a name="RideRequestListTest
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>RideRequestListTest</h4>
<pre>public RideRequestListTest()</pre>
</li>
</ul>
</li>
</ul>
<ul class="blockList">
<li class="blockList"><a name="method.detail">
</a>
<h3>Method Detail</h3>
<a name="testContains
</a>
<ul class="blockList">
<li class="blockList">
<h4>testContains</h4>
<pre>public void testContains()
throws java.lang.Exception</pre>
<dl>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code>java.lang.Exception</code></dd>
</dl>
</li>
</ul>
<a name="testGetRequests
</a>
<ul class="blockList">
<li class="blockList">
<h4>testGetRequests</h4>
<pre>public void testGetRequests()
throws java.lang.Exception</pre>
<dl>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code>java.lang.Exception</code></dd>
</dl>
</li>
</ul>
<a name="<API key>
</a>
<ul class="blockList">
<li class="blockList">
<h4><API key></h4>
<pre>public void <API key>()
throws java.lang.Exception</pre>
<dl>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code>java.lang.Exception</code></dd>
</dl>
</li>
</ul>
<a name="<API key>
</a>
<ul class="blockList">
<li class="blockList">
<h4><API key></h4>
<pre>public void <API key>()
throws java.lang.Exception</pre>
<dl>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code>java.lang.Exception</code></dd>
</dl>
</li>
</ul>
<a name="<API key>
</a>
<ul class="blockList">
<li class="blockList">
<h4><API key></h4>
<pre>public void <API key>()
throws java.lang.Exception</pre>
<dl>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code>java.lang.Exception</code></dd>
</dl>
</li>
</ul>
<a name="testAddRequest
</a>
<ul class="blockList">
<li class="blockList">
<h4>testAddRequest</h4>
<pre>public void testAddRequest()
throws java.lang.Exception</pre>
<dl>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code>java.lang.Exception</code></dd>
</dl>
</li>
</ul>
<a name="testClear
</a>
<ul class="blockList">
<li class="blockList">
<h4>testClear</h4>
<pre>public void testClear()
throws java.lang.Exception</pre>
<dl>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code>java.lang.Exception</code></dd>
</dl>
</li>
</ul>
<a name="testRemoveRequest
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>testRemoveRequest</h4>
<pre>public void testRemoveRequest()
throws java.lang.Exception</pre>
<dl>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code>java.lang.Exception</code></dd>
</dl>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
<div class="bottomNav"><a name="navbar.bottom">
</a>
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.bottom.firstrow">
</a>
<ul class="navList" title="Navigation">
<li><a href="../../assignment1/ridengo/package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../index-files/index-1.html">Index</a></li>
<li><a href="../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../assignment1/ridengo/RideRequestList.html" title="class in assignment1.ridengo"><span class="typeNameLink">Prev Class</span></a></li>
<li><a href="../../assignment1/ridengo/RideRequestTest.html" title="class in assignment1.ridengo"><span class="typeNameLink">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../index.html?assignment1/ridengo/RideRequestListTest.html" target="_top">Frames</a></li>
<li><a href="RideRequestListTest.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="<API key>">
<li><a href="../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!
allClassesLink = document.getElementById("<API key>");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary: </li>
<li>Nested | </li>
<li>Field | </li>
<li><a href="#constructor.summary">Constr</a> | </li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail: </li>
<li>Field | </li>
<li><a href="#constructor.detail">Constr</a> | </li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a name="skip.navbar.bottom">
</a></div>
</body>
</html> |
package com.earth2me.essentials.commands;
import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.Trade;
import com.earth2me.essentials.User;
import com.earth2me.essentials.utils.NumberUtil;
import java.math.BigDecimal;
import java.util.List;
import java.util.Locale;
import java.util.logging.Level;
import org.bukkit.Server;
import org.bukkit.inventory.ItemStack;
public class Commandsell extends EssentialsCommand
{
public Commandsell()
{
super("sell");
}
@Override
public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception
{
BigDecimal totalWorth = BigDecimal.ZERO;
String type = "";
if (args.length < 1)
{
throw new <API key>();
}
List<ItemStack> is = ess.getItemDb().getMatching(user, args);
int count = 0;
boolean isBulk = is.size() > 1;
for (ItemStack stack : is)
{
try
{
if (stack.getAmount() > 0)
{
totalWorth = totalWorth.add(sellItem(user, stack, args, isBulk));
stack = stack.clone();
count++;
for (ItemStack zeroStack : is)
{
if (zeroStack.isSimilar(stack))
{
zeroStack.setAmount(0);
}
}
}
}
catch (Exception e)
{
if (!isBulk)
{
throw e;
}
}
}
if (count != 1)
{
if (args[0].equalsIgnoreCase("blocks"))
{
user.sendMessage(_("totalWorthBlocks", type, NumberUtil.displayCurrency(totalWorth, ess)));
}
else
{
user.sendMessage(_("totalWorthAll", type, NumberUtil.displayCurrency(totalWorth, ess)));
}
}
}
private BigDecimal sellItem(User user, ItemStack is, String[] args, boolean isBulkSell) throws Exception
{
int amount = ess.getWorth().getAmount(ess, user, is, args, isBulkSell);
BigDecimal worth = ess.getWorth().getPrice(is);
if (worth == null)
{
throw new Exception(_("itemCannotBeSold"));
}
if (amount <= 0)
{
if (!isBulkSell) {
user.sendMessage(_("itemSold", NumberUtil.displayCurrency(BigDecimal.ZERO, ess), BigDecimal.ZERO, is.getType().toString().toLowerCase(Locale.ENGLISH), NumberUtil.displayCurrency(worth, ess)));
}
return BigDecimal.ZERO;
}
BigDecimal result = worth.multiply(BigDecimal.valueOf(amount));
//TODO: Prices for Enchantments
final ItemStack ris = is.clone();
ris.setAmount(amount);
if (!user.getInventory().containsAtLeast(ris, amount))
{
// This should never happen.
throw new <API key>("Trying to remove more items than are available.");
}
user.getInventory().removeItem(ris);
user.updateInventory();
Trade.log("Command", "Sell", "Item", user.getName(), new Trade(ris, ess), user.getName(), new Trade(result, ess), user.getLocation(), ess);
user.giveMoney(result);
user.sendMessage(_("itemSold", NumberUtil.displayCurrency(result, ess), amount, is.getType().toString().toLowerCase(Locale.ENGLISH), NumberUtil.displayCurrency(worth, ess)));
logger.log(Level.INFO, _("itemSoldConsole", user.getDisplayName(), is.getType().toString().toLowerCase(Locale.ENGLISH), NumberUtil.displayCurrency(result, ess), amount, NumberUtil.displayCurrency(worth, ess)));
return result;
}
} |
<!DOCTYPE HTML PUBLIC "-
<!--NewPage
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0_18) on Sun Mar 21 10:29:39 CDT 2010 -->
<TITLE>
Uses of Class cern.jet.stat.Utils (Parallel Colt 0.9.4 - API Specification)
</TITLE>
<META NAME="date" CONTENT="2010-03-21">
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../stylesheet.css" TITLE="Style">
<SCRIPT type="text/javascript">
function windowTitle()
{
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="Uses of Class cern.jet.stat.Utils (Parallel Colt 0.9.4 - API Specification)";
}
}
</SCRIPT>
<NOSCRIPT>
</NOSCRIPT>
</HEAD>
<BODY BGCOLOR="white" onload="windowTitle();">
<HR>
<A NAME="navbar_top"></A>
<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_top_firstrow"></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../cern/jet/stat/Utils.html" title="class in cern.jet.stat"><FONT CLASS="NavBarFont1"><B>Class</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Use</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
<b>Parallel Colt 0.9.4</b></EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
PREV
NEXT</FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../index.html?cern/jet/stat/\class-useUtils.html" target="_top"><B>FRAMES</B></A>
<A HREF="Utils.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!
if(window==top) {
document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_top"></A>
<HR>
<CENTER>
<H2>
<B>Uses of Class<br>cern.jet.stat.Utils</B></H2>
</CENTER>
No usage of cern.jet.stat.Utils
<P>
<HR>
<A NAME="navbar_bottom"></A>
<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="<API key>"></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../cern/jet/stat/Utils.html" title="class in cern.jet.stat"><FONT CLASS="NavBarFont1"><B>Class</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Use</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
<b>Parallel Colt 0.9.4</b></EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
PREV
NEXT</FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../index.html?cern/jet/stat/\class-useUtils.html" target="_top"><B>FRAMES</B></A>
<A HREF="Utils.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!
if(window==top) {
document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_bottom"></A>
<HR>
<font size=-1 >Jump to the <a target=_top href=http://sites.google.com/site/piotrwendykier/software/parallelcolt >Parallel Colt Homepage</a>
</BODY>
</HTML> |
package fr.pasteque.client.drivers.mpop;
import java.util.ArrayList;
public class MPopEntries extends ArrayList<MPopEntry> {
public void add(String name, String value) {
this.add(new MPopEntry(name, value));
}
public CharSequence[] getEntries() {
CharSequence[] result = new CharSequence[size()];
for (int i = 0; i < size(); i++) {
result[i] = this.get(i).name.substring("BT:".length());
}
return result;
}
public CharSequence[] getValues() {
CharSequence[] result = new CharSequence[size()];
for (int i = 0; i < size(); i++) {
result[i] = "BT:" + this.get(i).value;
}
return result;
}
} |
img{
width: 1280 px;
height: 800 px;
} |
//Article with original code:
// [1] Rosindell, James, Yan Wong, and Rampal S. Etienne.
// "A coalescence approach to spatial neutral ecology."
// Ecological Informatics 3.3 (2008): 259-271.
#ifndef NRRAND_H
#define NRRAND_H
class NRrand
{
public:
NRrand(const int seed) noexcept;
// returns an integer between 0 and max
int GetRandomInt(const int max) noexcept;
// returns normal deviates
double GetRandomNormal() noexcept;
private:
// returns a uniform random number in (0,1)
double GetRandomFraction() noexcept;
// the last result (for normal deviates)
double m_lastresult;
// when doing normal deviates and values are in pairs
// true when a new pair is needed, false when lastresult can be used
bool m_normflag;
};
#endif // NRRAND_H |
cat /var/log/dovecot.log | grep "unknown user (given password" | cut -d "," -f 2 | cut -d ")" -f 1 | sort | uniq > /root/ip-for-unknown-user
php <API key>.php /root/ip-for-unknown-user
php -n <API key>.php /root/ip-for-unknown-user | cut -d "," -f 3 | sort| uniq > uniq-country
cat /var/log/dovecot.log | grep "unknown user (given password" | cut -d "," -f 2 | cut -d ")" -f 1 | sort | uniq -c | sort | tail
cat /var/log/dovecot.log | grep "unknown user (given password" | cut -d "," -f 2 | cut -d ")" -f 1 | sort | uniq -c | sort | tail | sed 's/ / /g' | sed 's/ / /g' |sed 's/ / /g' | sed 's/ / /g' | cut -d " " -f 3 > /tmp/read-ip
php <API key>.php /tmp/read-ip |
package com.bioxx.tfc.GUI;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.Slot;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
import com.bioxx.tfc.Core.TFC_Core;
import com.bioxx.tfc.Core.Player.PlayerInventory;
public class GuiContainerTFC extends GuiContainer
{
protected boolean drawInventory = true;
protected Slot activeSlot;
public GuiContainerTFC(Container Container, int xsize, int ysize)
{
super(Container);
xSize = xsize;
ySize = ysize+PlayerInventory.invYSize;
}
protected void setDrawInventory(boolean b)
{
if(!drawInventory && b)
ySize +=PlayerInventory.invYSize;
else if(drawInventory && !b)
ySize -=PlayerInventory.invYSize;
drawInventory = b;
}
@Override
public void drawScreen(int par1, int par2, float par3)
{
super.drawScreen(par1, par2, par3);
for (int j1 = 0; j1 < this.inventorySlots.inventorySlots.size(); ++j1)
{
Slot slot = (Slot)this.inventorySlots.inventorySlots.get(j1);
if (this.isMouseOverSlot(slot, par1, par2) && slot.func_111238_b())
this.activeSlot = slot;
}
}
protected boolean isMouseOverSlot(Slot par1Slot, int par2, int par3)
{
return this.func_146978_c/*isPointInRegion*/(par1Slot.xDisplayPosition, par1Slot.yDisplayPosition, 16, 16, par2, par3);
}
@Override
protected void <API key>(float f, int i, int j)
{
drawGui(null);
}
protected void drawGui(ResourceLocation rl)
{
if(rl != null)
{
bindTexture(rl);
guiLeft = (width - xSize) / 2;
guiTop = (height - ySize) / 2;
<API key>(guiLeft, guiTop, 0, 0, xSize, ySize);
}
if(drawInventory)
PlayerInventory.drawInventory(this, width, height, <API key>.invYSize);
}
protected boolean mouseInRegion(int x, int y, int width, int height, int mouseX, int mouseY)
{
mouseX -= guiLeft;
mouseY -= guiTop;
return mouseX >= x && mouseX < x + width && mouseY >= y && mouseY < y + height;
}
protected void bindTexture(ResourceLocation rl)
{
TFC_Core.bindTexture(rl);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
}
public void drawTooltip(int mx, int my, String text) {
List list = new ArrayList();
list.add(text);
this.drawHoveringText(list, mx, my+15, this.fontRendererObj);
RenderHelper.<API key>();
GL11.glDisable(GL11.GL_LIGHTING);
//GL11.glDisable(GL11.GL_DEPTH_TEST);
}
protected void <API key>(List par1List, int par2, int par3, FontRenderer font, float z)
{
if (!par1List.isEmpty())
{
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
RenderHelper.<API key>();
GL11.glDisable(GL11.GL_LIGHTING);
//GL11.glDisable(GL11.GL_DEPTH_TEST);
int k = 0;
Iterator iterator = par1List.iterator();
while (iterator.hasNext())
{
String s = (String)iterator.next();
int l = font.getStringWidth(s);
if (l > k)
k = l;
}
int i1 = par2 + 12;
int j1 = par3 - 12;
int k1 = 8;
if (par1List.size() > 1)
k1 += 2 + (par1List.size() - 1) * 10;
if (i1 + k > this.width)
i1 -= 28 + k;
if (j1 + k1 + 6 > this.height)
j1 = this.height - k1 - 6;
this.zLevel = z;
itemRender.zLevel = 300.0F;
int l1 = -267386864;
this.drawGradientRect(i1 - 3, j1 - 4, i1 + k + 3, j1 - 3, l1, l1);
this.drawGradientRect(i1 - 3, j1 + k1 + 3, i1 + k + 3, j1 + k1 + 4, l1, l1);
this.drawGradientRect(i1 - 3, j1 - 3, i1 + k + 3, j1 + k1 + 3, l1, l1);
this.drawGradientRect(i1 - 4, j1 - 3, i1 - 3, j1 + k1 + 3, l1, l1);
this.drawGradientRect(i1 + k + 3, j1 - 3, i1 + k + 4, j1 + k1 + 3, l1, l1);
int i2 = 1347420415;
int j2 = (i2 & 16711422) >> 1 | i2 & -16777216;
this.drawGradientRect(i1 - 3, j1 - 3 + 1, i1 - 3 + 1, j1 + k1 + 3 - 1, i2, j2);
this.drawGradientRect(i1 + k + 2, j1 - 3 + 1, i1 + k + 3, j1 + k1 + 3 - 1, i2, j2);
this.drawGradientRect(i1 - 3, j1 - 3, i1 + k + 3, j1 - 3 + 1, i2, i2);
this.drawGradientRect(i1 - 3, j1 + k1 + 2, i1 + k + 3, j1 + k1 + 3, j2, j2);
for (int k2 = 0; k2 < par1List.size(); ++k2)
{
String s1 = (String)par1List.get(k2);
font.<API key>(s1, i1, j1, -1);
if (k2 == 0)
j1 += 2;
j1 += 10;
}
this.zLevel = 0.0F;
itemRender.zLevel = 0.0F;
GL11.glEnable(GL11.GL_LIGHTING);
RenderHelper.<API key>();
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
}
}
} |
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Threading;
using Hohoema.Models.Domain.Niconico.Follow.LoginUser;
using Hohoema.Models.Domain.Niconico.Follow;
using Hohoema.Models.Domain.Niconico;
using NiconicoToolkit.Follow;
namespace Hohoema.Presentation.ViewModels.Niconico.Follow
{
public sealed class <API key> : <API key><IUser>
{
private readonly UserFollowProvider _userFollowProvider;
private FollowUsersResponse _lastRes;
public <API key>(UserFollowProvider userFollowProvider)
{
_userFollowProvider = userFollowProvider;
MaxCount = 600;
}
public override async Task<IEnumerable<IUser>> GetPagedItemsAsync(int pageIndex, int pageSize, Cancellation<API key> = default)
{
try
{
_lastRes = await _userFollowProvider.GetItemsAsync(pageSize, _lastRes);
TotalCount = _lastRes.Data.Summary.Followees;
}
catch
{
_lastRes = null;
return Enumerable.Empty<IUser>();
}
return _lastRes?.Data.Items.Select(x => new FollowUserViewModel(x));
}
}
} |
package org.owm.libwlocate;
import java.util.List;
import android.net.wifi.ScanResult;
public class loc_info
{
public static final int LOC_METHOD_NONE=0;
public static final int <API key>=1;
public static final int LOC_METHOD_GPS=2;
/** describes based on which method the last location was performed with */
public int lastLocMethod=LOC_METHOD_NONE;
/** request data that is used for libwlocate-based location request, its member bssids is filled with valid BSSIDs also in case of GPS location */
public wloc_req requestData;
/** result of last WiFi-scan, this list is filled with valid data also in case of GPS location */
public List<ScanResult> wifiScanResult;
/** last movement speed in km per hour, if no speed could be evaluated the value is smaller than 0*/
public float lastSpeed=-1f;
} |
// This file is part of the "Irrlicht Engine".
#ifndef <API key>
#define <API key>
#include "irrString.h"
#include "path.h"
namespace irr
{
namespace core
{
/*! \file coreutil.h
\brief File containing useful basic utility functions
*/
//! search if a filename has a proper extension
inline s32 isFileExtension (const io::path& filename, const io::path& ext0,
const io::path& ext1, const io::path& ext2)
{
s32 extPos = filename.findLast ( '.' );
if ( extPos < 0 )
return 0;
extPos += 1;
if ( filename.<API key> ( ext0, extPos ) )
return 1;
if ( filename.<API key> ( ext1, extPos ) )
return 2;
if ( filename.<API key> ( ext2, extPos ) )
return 3;
return 0;
}
//! search if a filename has a proper extension
inline bool hasFileExtension(const io::path& filename, const io::path& ext0,
const io::path& ext1 = "", const io::path& ext2 = "")
{
return isFileExtension ( filename, ext0, ext1, ext2 ) > 0;
}
//! cut the filename extension from a source file path and store it in a dest file path
inline io::path& <API key> ( io::path &dest, const io::path &source )
{
const s32 endPos = source.findLast ( '.' );
dest = source.subString ( 0, endPos < 0 ? source.size () : endPos );
return dest;
}
//! get the filename extension from a file path
inline io::path& <API key> ( io::path &dest, const io::path &source )
{
const s32 endPos = source.findLast ( '.' );
if ( endPos < 0 )
dest = "";
else
dest = source.subString ( endPos, source.size () );
return dest;
}
//! delete path from filename
inline io::path& <API key>(io::path& filename)
{
// delete path from filename
const fschar_t* s = filename.c_str();
const fschar_t* p = s + filename.size();
// search for path separator or beginning
while ( *p != '/' && *p != '\\' && p != s )
p
if ( p != s )
{
++p;
filename = p;
}
return filename;
}
//! trim paths
inline io::path& deletePathFromPath(io::path& filename, s32 pathCount)
{
// delete path from filename
s32 i = filename.size();
// search for path separator or beginning
while ( i>=0 )
{
if ( filename[i] == '/' || filename[i] == '\\' )
{
if ( --pathCount <= 0 )
break;
}
--i;
}
if ( i>0 )
{
filename [ i + 1 ] = 0;
filename.validate();
}
else
filename="";
return filename;
}
//! looks if file is in the same directory of path. returns offset of directory.
//! 0 means in same directory. 1 means file is direct child of path
inline s32 isInSameDirectory ( const io::path& path, const io::path& file )
{
s32 subA = 0;
s32 subB = 0;
s32 pos = 0;
if ( path.size() && !path.equalsn ( file, path.size() ) )
return -1;
while ( (pos = path.findNext ( '/', pos )) >= 0 )
{
subA += 1;
pos += 1;
}
pos = 0;
while ( (pos = file.findNext ( '/', pos )) >= 0 )
{
subB += 1;
pos += 1;
}
return subB - subA;
}
//! splits a path into components
static inline void splitFilename(const io::path &name, io::path* path=0,
io::path* filename=0, io::path* extension=0, bool make_lower=false)
{
s32 i = name.size();
s32 extpos = i;
// search for path separator or beginning
while ( i >= 0 )
{
if ( name[i] == '.' )
{
extpos = i;
if ( extension )
*extension = name.subString ( extpos + 1, name.size() - (extpos + 1), make_lower );
}
else
if ( name[i] == '/' || name[i] == '\\' )
{
if ( filename )
*filename = name.subString ( i + 1, extpos - (i + 1), make_lower );
if ( path )
{
*path = name.subString ( 0, i + 1, make_lower );
path->replace ( '\\', '/' );
}
return;
}
i -= 1;
}
if ( filename )
*filename = name.subString ( 0, extpos, make_lower );
}
//! create a filename from components
static inline io::path mergeFilename(const io::path& path, const io::path& filename, const io::path& extension = "")
{
io::path result(path);
if ( !result.empty() )
{
const fschar_t last = result.lastChar();
if ( last != _IRR_TEXT('/') && last != _IRR_TEXT('\\') )
result += _IRR_TEXT('/');
}
if ( !filename.empty() )
result += filename;
if ( !extension.empty() )
{
if ( !result.empty() && extension[0] != _IRR_TEXT('.') )
result += _IRR_TEXT('.');
result += extension;
}
return result;
}
//! some standard function ( to remove dependencies )
inline s32 isdigit(s32 c) noexcept { return c >= '0' && c <= '9'; }
inline s32 isspace(s32 c) noexcept { return c == ' ' || c == '\f' || c == '\n' || c == '\r' || c == '\t' || c == '\v'; }
inline s32 isupper(s32 c) noexcept { return c >= 'A' && c <= 'Z'; }
} // end namespace core
} // end namespace irr
#endif |
<!DOCTYPE HTML PUBLIC "-
<!--NewPage
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0_14) on Wed May 30 20:32:35 CEST 2012 -->
<TITLE>
Uses of Class org.lwjgl.opengles.<API key> (LWJGL API)
</TITLE>
<META NAME="date" CONTENT="2012-05-30">
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../stylesheet.css" TITLE="Style">
<SCRIPT type="text/javascript">
function windowTitle()
{
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="Uses of Class org.lwjgl.opengles.<API key> (LWJGL API)";
}
}
</SCRIPT>
<NOSCRIPT>
</NOSCRIPT>
</HEAD>
<BODY BGCOLOR="white" onload="windowTitle();">
<HR>
<A NAME="navbar_top"></A>
<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_top_firstrow"></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../org/lwjgl/opengles/<API key>.html" title="class in org.lwjgl.opengles"><FONT CLASS="NavBarFont1"><B>Class</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Use</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../overview-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
PREV
NEXT</FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../index.html?org/lwjgl/opengles/\<API key>.html" target="_top"><B>FRAMES</B></A>
<A HREF="<API key>.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!
if(window==top) {
document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_top"></A>
<HR>
<CENTER>
<H2>
<B>Uses of Class<br>org.lwjgl.opengles.<API key></B></H2>
</CENTER>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
Packages that use <A HREF="../../../../org/lwjgl/opengles/<API key>.html" title="class in org.lwjgl.opengles"><API key></A></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><A HREF="#org.lwjgl.opengles"><B>org.lwjgl.opengles</B></A></TD>
<TD> </TD>
</TR>
</TABLE>
<P>
<A NAME="org.lwjgl.opengles"></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
Uses of <A HREF="../../../../org/lwjgl/opengles/<API key>.html" title="class in org.lwjgl.opengles"><API key></A> in <A HREF="../../../../org/lwjgl/opengles/package-summary.html">org.lwjgl.opengles</A></FONT></TH>
</TR>
</TABLE>
<P>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="<API key>">
<TH ALIGN="left" COLSPAN="2">Methods in <A HREF="../../../../org/lwjgl/opengles/package-summary.html">org.lwjgl.opengles</A> that throw <A HREF="../../../../org/lwjgl/opengles/<API key>.html" title="class in org.lwjgl.opengles"><API key></A></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static void</CODE></FONT></TD>
<TD><CODE><B>EGL.</B><B><A HREF="../../../../org/lwjgl/opengles/EGL.html#eglReleaseCurrent(org.lwjgl.opengles.EGLDisplay)">eglReleaseCurrent</A></B>(<A HREF="../../../../org/lwjgl/opengles/EGLDisplay.html" title="class in org.lwjgl.opengles">EGLDisplay</A> dpy)</CODE>
<BR>
Releases the current context without assigning a new one.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B>EGLContext.</B><B><A HREF="../../../../org/lwjgl/opengles/EGLContext.html#makeCurrent(org.lwjgl.opengles.EGLSurface)">makeCurrent</A></B>(<A HREF="../../../../org/lwjgl/opengles/EGLSurface.html" title="class in org.lwjgl.opengles">EGLSurface</A> surface)</CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B>EGLContext.</B><B><A HREF="../../../../org/lwjgl/opengles/EGLContext.html#makeCurrent(org.lwjgl.opengles.EGLSurface, org.lwjgl.opengles.EGLSurface)">makeCurrent</A></B>(<A HREF="../../../../org/lwjgl/opengles/EGLSurface.html" title="class in org.lwjgl.opengles">EGLSurface</A> draw,
<A HREF="../../../../org/lwjgl/opengles/EGLSurface.html" title="class in org.lwjgl.opengles">EGLSurface</A> read)</CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B>EGLSurface.</B><B><A HREF="../../../../org/lwjgl/opengles/EGLSurface.html#swapBuffers()">swapBuffers</A></B>()</CODE>
<BR>
</TD>
</TR>
</TABLE>
<P>
<HR>
<A NAME="navbar_bottom"></A>
<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="<API key>"></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../org/lwjgl/opengles/<API key>.html" title="class in org.lwjgl.opengles"><FONT CLASS="NavBarFont1"><B>Class</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Use</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../overview-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
PREV
NEXT</FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../index.html?org/lwjgl/opengles/\<API key>.html" target="_top"><B>FRAMES</B></A>
<A HREF="<API key>.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!
if(window==top) {
document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_bottom"></A>
<HR>
<i>Copyright &
</BODY>
</HTML> |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Globalization;
using Myvas.AspNetCore.Weixin;
using System.Threading.Tasks;
namespace Myvas.AspNetCore.Weixin
{
<summary>
</summary>
internal static class CardApiTicketApi
{
<summary>
<para>access_tokenaccess_tokenaccess_token7200access_tokenaccess_tokenapiaccess_tokenaccess_tokenapi</para>
<para>access_token5121</para>
<para>AppIDAppSecretaccess_tokenAppIDAppSecrethttps</para>
</summary>
<returns>
<para>JSON</para>
<code>{"access_token":"ACCESS_TOKEN","expires_in":7200}</code>
</returns>
<exception cref="WeixinException">
<para>JSONAppID:</para>
<code>{"errcode":40013,"errmsg":"invalid appid"}</code>
</exception>
public static async Task<CardApiTicketJson> GetCardApiTicket(string access_token)
{
string api = "https://api.weixin.qq.com/cgi-bin/ticket/getticket?access_token=ACCESS_TOKEN&type=wx_card";
api = api.Replace("ACCESS_TOKEN", access_token);
var result = await HttpUtility.GetJson<CardApiTicketJson>(api);
if (result.Succeeded)
return result;
else
throw new WeixinException(result);
}
}
} |
# pygen.py
# This module is part of Mako and is released under
"""utilities for generating and formatting literal Python code."""
import re, string
from StringIO import StringIO
from mako import exceptions
class PythonPrinter(object):
def __init__(self, stream):
# indentation counter
self.indent = 0
# a stack storing information about why we incremented
# the indentation counter, to help us determine if we
# should decrement it
self.indent_detail = []
# the string of whitespace multiplied by the indent
# counter to produce a line
self.indentstring = " "
# the stream we are writing to
self.stream = stream
# a list of lines that represents a buffered "block" of code,
# which can be later printed relative to an indent level
self.line_buffer = []
self.in_indent_lines = False
self.<API key>()
def write(self, text):
self.stream.write(text)
def <API key>(self, block):
"""print a line or lines of python which already contain indentation.
The indentation of the total block of lines will be adjusted to that of
the current indent level."""
self.in_indent_lines = False
for l in re.split(r'\r?\n', block):
self.line_buffer.append(l)
def writelines(self, *lines):
"""print a series of lines of python."""
for line in lines:
self.writeline(line)
def writeline(self, line):
"""print a line of python, indenting it according to the current indent level.
this also adjusts the indentation counter according to the content of the line."""
if not self.in_indent_lines:
self.<API key>()
self.in_indent_lines = True
decreased_indent = False
if (line is None or
re.match(r"^\s*#",line) or
re.match(r"^\s*$", line)
):
hastext = False
else:
hastext = True
is_comment = line and len(line) and line[0] == '
# see if this line should decrease the indentation level
if (not decreased_indent and
not is_comment and
(not hastext or self._is_unindentor(line))
):
if self.indent > 0:
self.indent -=1
# if the indent_detail stack is empty, the user
# probably put extra closures - the resulting
# module wont compile.
if len(self.indent_detail) == 0:
raise exceptions.SyntaxException("Too many whitespace closures")
self.indent_detail.pop()
if line is None:
return
# write the line
self.stream.write(self._indent_line(line) + "\n")
# see if this line should increase the indentation level.
# note that a line can both decrase (before printing) and
# then increase (after printing) the indentation level.
if re.search(r":[ \t]*(?:#.*)?$", line):
# increment indentation count, and also
# keep track of what the keyword was that indented us,
# if it is a python compound statement keyword
# where we might have to look for an "unindent" keyword
match = re.match(r"^\s*(if|try|elif|while|for)", line)
if match:
# its a "compound" keyword, so we will check for "unindentors"
indentor = match.group(1)
self.indent +=1
self.indent_detail.append(indentor)
else:
indentor = None
# its not a "compound" keyword. but lets also
# test for valid Python keywords that might be indenting us,
# else assume its a non-indenting line
m2 = re.match(r"^\s*(def|class|else|elif|except|finally)", line)
if m2:
self.indent += 1
self.indent_detail.append(indentor)
def close(self):
"""close this printer, flushing any remaining lines."""
self.<API key>()
def _is_unindentor(self, line):
"""return true if the given line is an 'unindentor', relative to the last 'indent' event received."""
# no indentation detail has been pushed on; return False
if len(self.indent_detail) == 0:
return False
indentor = self.indent_detail[-1]
# the last indent keyword we grabbed is not a
# compound statement keyword; return False
if indentor is None:
return False
# if the current line doesnt have one of the "unindentor" keywords,
# return False
match = re.match(r"^\s*(else|elif|except|finally).*\:", line)
if not match:
return False
# whitespace matches up, we have a compound indentor,
# and this line has an unindentor, this
# is probably good enough
return True
# should we decide that its not good enough, heres
# more stuff to check.
#keyword = match.group(1)
# match the original indent keyword
#for crit in [
# (r'if|elif', r'else|elif'),
# (r'try', r'except|finally|else'),
# (r'while|for', r'else'),
# if re.match(crit[0], indentor) and re.match(crit[1], keyword): return True
#return False
def _indent_line(self, line, stripspace = ''):
"""indent the given line according to the current indent level.
stripspace is a string of space that will be truncated from the start of the line
before indenting."""
return re.sub(r"^%s" % stripspace, self.indentstring * self.indent, line)
def <API key>(self):
"""reset the flags which would indicate we are in a backslashed or triple-quoted section."""
(self.backslashed, self.triplequoted) = (False, False)
def _in_multi_line(self, line):
"""return true if the given line is part of a multi-line block, via backslash or triple-quote."""
# we are only looking for explicitly joined lines here,
# not implicit ones (i.e. brackets, braces etc.). this is just
# to guard against the possibility of modifying the space inside
# of a literal multiline string with unfortunately placed whitespace
current_state = (self.backslashed or self.triplequoted)
if re.search(r"\\$", line):
self.backslashed = True
else:
self.backslashed = False
triples = len(re.findall(r"\"\"\"|\'\'\'", line))
if triples == 1 or triples % 2 != 0:
self.triplequoted = not self.triplequoted
return current_state
def <API key>(self):
stripspace = None
self.<API key>()
for entry in self.line_buffer:
if self._in_multi_line(entry):
self.stream.write(entry + "\n")
else:
entry = entry.expandtabs()
if stripspace is None and re.search(r"^[ \t]*[^# \t]", entry):
stripspace = re.match(r"^([ \t]*)", entry).group(1)
self.stream.write(self._indent_line(entry, stripspace) + "\n")
self.line_buffer = []
self.<API key>()
def adjust_whitespace(text):
"""remove the left-whitespace margin of a block of Python code."""
state = [False, False]
(backslashed, triplequoted) = (0, 1)
def in_multi_line(line):
start_state = (state[backslashed] or state[triplequoted])
if re.search(r"\\$", line):
state[backslashed] = True
else:
state[backslashed] = False
def match(reg, t):
m = re.match(reg, t)
if m:
return m, t[len(m.group(0)):]
else:
return None, t
while line:
if state[triplequoted]:
m, line = match(r"%s" % state[triplequoted], line)
if m:
state[triplequoted] = False
else:
m, line = match(r".*?(?=%s|$)" % state[triplequoted], line)
else:
m, line = match(r'#', line)
if m:
return start_state
m, line = match(r"\"\"\"|\'\'\'", line)
if m:
state[triplequoted] = m.group(0)
continue
m, line = match(r".*?(?=\"\"\"|\'\'\'|#|$)", line)
return start_state
def _indent_line(line, stripspace = ''):
return re.sub(r"^%s" % stripspace, '', line)
lines = []
stripspace = None
for line in re.split(r'\r?\n', text):
if in_multi_line(line):
lines.append(line)
else:
line = line.expandtabs()
if stripspace is None and re.search(r"^[ \t]*[^# \t]", line):
stripspace = re.match(r"^([ \t]*)", line).group(1)
lines.append(_indent_line(line, stripspace))
return "\n".join(lines) |
<?php
class Flight
{
private $flight_number;
private $seats;
private $departire;
private $arrival;
function __construct($departure, $arrival, $flight_number, $seats)
{
$this->departure = $departure;
$this->arrival = $arrival;
$this->flight_number = $flight_number;
$this->seats = $seats;
}
function getArrival()
{
return $this->arrival;
}
function getDeparture()
{
return $this->departure;
}
function getSeats()
{
return $this->seats;
}
function getNumber()
{
return $this->flight_number;
}
function getPrice($conn)
{
$sql = "SELECT price FROM flights WHERE departure = '$this->departure' && arrival = '$this->arrival' ";
$result = mysqli_query($conn, $sql);
$flight;
if (mysqli_num_rows($result) > 0)
{
$price = mysqli_fetch_assoc($result)["price"];
}
else
{
throw new Exception("No match found");
}
return intval($price);
}
} |
function PC_add_validation(form_selector, validation, config) {
var validation_config = {
ok_background_color: '#fff',
<API key>: '#FEE',
error_parent_class: false,
<API key>: true
};
if (config) {
$.extend(validation_config, config);
}
<API key>(form_selector);
var $form = $(form_selector);
// set new validation handler
$form.data('pc_validation_data', [validation_config, $.extend({}, validation)]);
$form.on('submit.pc_validator', function(){
var valid = true;
var first_input_field = false;
var validation_data = $(this).data('pc_validation_data');
console.log(validation_data);
if( !validation_data ) {
$(this).off('submit.pc_validation');
return;
}
$.each(validation_data[1], function(input_name, validation_rules) {
var valid_input = true;
var input_name_parts = input_name.split(':');
var input_field = false;
if (input_name_parts.length == 2 && input_name_parts[0] == 'id') {
input_field = $('#' + input_name_parts[1]);
}
else {
input_field =$(form_selector + " input[name="+input_name+"]" + ', ' + form_selector + " select[name="+input_name+"]" + ', ' + form_selector + " textarea[name="+input_name+"]");
}
if (!input_field || !input_field.length) {
return 'continue';
}
var input_value = $.trim(input_field.val());
$.each(validation_rules, function(index, validation_rule) {
if (validation_rule.if_checked) {
var check_box_field = $(form_selector + " input:checked[name="+validation_rule.if_checked+"]");
if (!check_box_field || !check_box_field.length) {
return 'continue';
}
}
if (validation_rule.if_checked_id) {
var check_field = $("#" + validation_rule.if_checked_id + ":checked");
if (!check_field || !check_field.length) {
return 'continue';
}
}
switch(validation_rule.rule) {
case 'required':
if (!input_value) {
valid_input = false;
}
break;
case 'min_length':
if (input_value.length < validation_rule.param) {
valid_input = false;
}
break;
case 'email':
var pattern = new RegExp(/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i);
if (!pattern.test(input_value)) {
valid_input = false;
}
break;
default:
}
});
if (!valid_input) {
if (!first_input_field) {
first_input_field = input_field;
}
valid = false;
if (validation_data[0].<API key>) {
input_field.css("background-color", validation_data[0].<API key>);
}
if (validation_data[0].error_parent_class) {
input_field.parent().addClass(validation_data[0].error_parent_class);
}
}
else {
if (validation_data[0].ok_background_color) {
input_field.css("background-color", validation_data[0].ok_background_color);
}
if (validation_data[0].error_parent_class) {
input_field.parent().removeClass(validation_data[0].error_parent_class);
}
}
});
if (!valid && first_input_field && validation_data[0].<API key>) {
$(window).scrollTop(first_input_field.offset().top);
}
return valid;
});
}
function <API key>(form_selector) {
var $form = $(form_selector);
// remove previous validation handler and error marks from the form
$form.off('submit.pc_validator');
var validation_data = $form.data('pc_validation_data');
if( validation_data ) {
$.each(validation_data[1], function(input_name, validation_rules) {
var input_name_parts = input_name.split(':');
var input_field = false;
if (input_name_parts.length == 2 && input_name_parts[0] == 'id') {
input_field = $('#' + input_name_parts[1]);
}
else {
input_field =$(form_selector + " input[name="+input_name+"]" + ', ' + form_selector + " select[name="+input_name+"]" + ', ' + form_selector + " textarea[name="+input_name+"]");
}
if( input_field ) {
if (validation_data[0].ok_background_color) {
input_field.css("background-color", validation_data[0].ok_background_color);
}
if (validation_data[0].error_parent_class) {
input_field.parent().removeClass(validation_data[0].error_parent_class);
}
}
});
}
} |
<?php
/**
* Project Create Status Exception
* @package project
*/
class <API key> extends <API key>
{
function __construct($message = null)
{
parent::__construct($message);
}
}
?> |
// This file is part of SyntroNet
// SyntroNet is free software: you can redistribute it and/or modify
// (at your option) any later version.
// SyntroNet is distributed in the hope that it will be useful,
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
#include "SyntroGloveView.h"
#include "GloveView.h"
#include "ViewClient.h"
#include "StreamDlg.h"
#include "SyntroLib.h"
#include "SyntroServer.h"
#include "SyntroAboutDlg.h"
#include "BasicSetupDlg.h"
#define RATE_INTERVAL 2 // two seconds between sample rate calculations
SyntroGloveView::SyntroGloveView(QWidget *parent)
: QMainWindow(parent)
{
ui.setupUi(this);
SyntroUtils::syntroAppInit();
startControlServer();
m_client = new ViewClient();
connect(m_client, SIGNAL(dirResponse(QStringList)), this, SLOT(dirResponse(QStringList)));
connect(this, SIGNAL(requestDir()), m_client, SLOT(requestDir()));
connect(ui.actionAbout, SIGNAL(triggered()), this, SLOT(onAbout()));
connect(ui.actionBasicSetup, SIGNAL(triggered()), this, SLOT(onBasicSetup()));
connect(ui.actionSelectSource, SIGNAL(triggered()), this, SLOT(onSelectSource()));
connect(ui.<API key>, SIGNAL(triggered()), this, SLOT(<API key>()));
connect(this, SIGNAL(newSource(const QString)), m_client, SLOT(newSource(QString)));
connect(m_client, SIGNAL(newIMUData(const RTQuaternion&, const RTQuaternion&, const RTQuaternion&)),
this, SLOT(newIMUData(const RTQuaternion&, const RTQuaternion&, const RTQuaternion&)), Qt::DirectConnection);
connect(ui.actionExit, SIGNAL(triggered()), this, SLOT(close()));
m_client->resumeThread();
m_imuSettings = new RTIMUSettings("SyntroGloveView");
m_imuSettings->m_imuType = RTIMU_TYPE_NULL;
m_imuSettings->saveSettings();
m_imu = (RTIMUNull *)RTIMU::createIMU(m_imuSettings);
initStatusBar();
layoutWindow();
restoreWindowState();
setWindowTitle(QString("%1 - %2")
.arg(SyntroUtils::getAppType())
.arg(SyntroUtils::getAppName()));
m_sampleCount = 0;
m_statusTimer = startTimer(RATE_INTERVAL * 1000);
m_refreshTimer = startTimer(20);
m_directoryTimer = startTimer(10000);
ui.actionSelectSource->setEnabled(false);
m_newIMUData = false;
QSettings *settings = SyntroUtils::getSettings();
QString source = settings->value(<API key>).toString();
if (source != "")
emit newSource(source);
delete settings;
}
void SyntroGloveView::startControlServer()
{
QSettings *settings = SyntroUtils::getSettings();
if (settings->value(<API key>).toBool()) {
m_controlServer = new SyntroServer();
m_controlServer->resumeThread();
}
else {
m_controlServer = NULL;
}
delete settings;
}
void SyntroGloveView::onAbout()
{
SyntroAbout dlg(this);
dlg.exec();
}
void SyntroGloveView::onBasicSetup()
{
BasicSetupDlg dlg(this);
dlg.exec();
}
void SyntroGloveView::closeEvent(QCloseEvent *)
{
killTimer(m_statusTimer);
killTimer(m_directoryTimer);
killTimer(m_refreshTimer);
if (m_client) {
m_client->exitThread();
m_client = NULL;
}
if (m_controlServer) {
m_controlServer->exitThread();
m_controlServer = NULL;
}
delete m_imuSettings;
saveWindowState();
SyntroUtils::syntroAppExit();
}
void SyntroGloveView::newIMUData(const RTQuaternion& palmQuat, const RTQuaternion& thumbQuat, const RTQuaternion& fingerQuat)
{
QMutexLocker locker(&m_lock);
m_sampleCount++;
m_palmQuat = palmQuat;
m_thumbQuat = thumbQuat;
m_fingerQuat = fingerQuat;
m_newIMUData = true;
}
void SyntroGloveView::dirResponse(QStringList directory)
{
m_directory = directory;
if (m_directory.length() > 0) {
if (!ui.actionSelectSource->isEnabled())
ui.actionSelectSource->setEnabled(true);
}
}
void SyntroGloveView::onSelectSource()
{
StreamDlg dlg(this, m_directory);
if (dlg.exec() != QDialog::Accepted)
return;
emit newSource(dlg.getSelection());
QSettings *settings = SyntroUtils::getSettings();
settings->setValue(<API key>, dlg.getSelection());
delete settings;
}
void SyntroGloveView::timerEvent(QTimerEvent *event)
{
if (event->timerId() == m_directoryTimer) {
emit requestDir();
} else if (event->timerId() == m_statusTimer) {
m_controlStatus->setText(m_client->getLinkState());
qreal rate = (qreal)m_sampleCount / (qreal)RATE_INTERVAL;
m_sampleCount = 0;
m_rateStatus->setText(QString("Sample rate: %1 per second").arg(rate));
} else {
QMutexLocker locker(&m_lock);
if (!m_newIMUData)
return;
m_view->setPose(m_palmQuat, m_thumbQuat, m_fingerQuat);
m_newIMUData = false;
}
}
void SyntroGloveView::initStatusBar()
{
m_controlStatus = new QLabel(this);
m_controlStatus->setAlignment(Qt::AlignLeft);
ui.statusBar->addWidget(m_controlStatus, 1);
m_rateStatus = new QLabel(this);
m_rateStatus->setAlignment(Qt::AlignCenter | Qt::AlignLeft);
ui.statusBar->addWidget(m_rateStatus);
}
void SyntroGloveView::layoutWindow()
{
QHBoxLayout *mainLayout = new QHBoxLayout();
mainLayout->setContentsMargins(3, 3, 3, 3);
mainLayout->setSpacing(3);
QVBoxLayout *vLayout = new QVBoxLayout();
m_view = new GloveView(this);
vLayout->addWidget(m_view);
mainLayout->addLayout(vLayout);
centralWidget()->setLayout(mainLayout);
setMinimumWidth(400);
setMinimumHeight(400);
}
void SyntroGloveView::saveWindowState()
{
QSettings *settings = SyntroUtils::getSettings();
settings->beginGroup("Window");
settings->setValue("Geometry", saveGeometry());
settings->setValue("State", saveState());
settings->endGroup();
delete settings;
}
void SyntroGloveView::restoreWindowState()
{
QSettings *settings = SyntroUtils::getSettings();
settings->beginGroup("Window");
restoreGeometry(settings->value("Geometry").toByteArray());
restoreState(settings->value("State").toByteArray());
settings->endGroup();
delete settings;
} |
package org.lenndi.umtapo.solr.service;
import org.lenndi.umtapo.solr.document.bean.record.Record;
import org.lenndi.umtapo.solr.exception.<API key>;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import java.util.List;
/**
* Solr record service interface.
*/
public interface SolrRecordService {
/**
* Find by id record.
*
* @param id the id
* @return the record
*/
Record findById(String id);
/**
* Add to index.
*
* @param record the record document
* @return the record
* @throws <API key> the invalid record exception
*/
Record save(Record record) throws <API key>;
/**
* Delete from index int.
*
* @param id the id
*/
void delete(String id);
/**
* Find by item id record.
*
* @param itemId the item id
* @return the record
*/
Record findByItemId(Integer itemId);
/**
* Search by serial number list.
*
* @param serialNumber the serial number
* @param serialType the serial type
* @return the list
*/
List<Record> <API key>(String serialNumber, String serialType);
/**
* Search by title page.
*
* @param title the title
* @param pageable the pageable
* @return the page
*/
Page<Record> searchByTitle(String title, Pageable pageable);
/**
* Search by title list.
*
* @param title the title
* @return the list
*/
List<Record> searchByTitle(String title);
/**
* Find item by serialNumber.
*
* @param serialNumber the serial number
* @param serialType the serial type
* @param page the page
* @return the page
*/
Page<Record> <API key>(String serialNumber, String serialType, Pageable page);
/**
* Full search page.
*
* @param title the title
* @param author the author
* @param publisher the publisher
* @param id the id
* @param publicationDate the publication date
* @param page the page
* @return the page
*/
Page<Record> fullSearch(
String title,
String author,
String publisher,
String id,
String publicationDate,
Pageable page);
} |
<?php
namespace Piwik\Plugins\Installation;
use <API key>;
use <API key>;
use <API key>;
use Piwik\Container\StaticContainer;
use Piwik\Piwik;
use Piwik\Plugins\UsersManager\UsersManager;
use Piwik\QuickForm2;
class FormSuperUser extends QuickForm2
{
function __construct($id = 'generalsetupform', $method = 'post', $attributes = null, $trackSubmit = false)
{
parent::__construct($id, $method, $attributes = array('autocomplete' => 'off'), $trackSubmit);
}
function init()
{
<API key>::registerRule('checkLogin', 'Piwik\Plugins\Installation\<API key>');
<API key>::registerRule('checkEmail', 'Piwik\Plugins\Installation\<API key>');
$login = $this->addElement('text', 'login')
->setLabel(Piwik::translate('<API key>'));
$login->addRule('required', Piwik::translate('General_Required', Piwik::translate('<API key>')));
$login->addRule('checkLogin');
$password = $this->addElement('password', 'password')
->setLabel(Piwik::translate('<API key>'));
$password->addRule('required', Piwik::translate('General_Required', Piwik::translate('<API key>')));
$pwMinLen = UsersManager::PASSWORD_MIN_LENGTH;
$pwLenInvalidMessage = Piwik::translate('<API key>', array($pwMinLen));
$password->addRule('length', $pwLenInvalidMessage, array('min' => $pwMinLen));
$passwordBis = $this->addElement('password', 'password_bis')
->setLabel(Piwik::translate('<API key>'));
$passwordBis->addRule('required', Piwik::translate('General_Required', Piwik::translate('<API key>')));
$passwordBis->addRule('eq', Piwik::translate('<API key>'), $password);
$email = $this->addElement('text', 'email')
->setLabel(Piwik::translate('Installation_Email'));
$email->addRule('required', Piwik::translate('General_Required', Piwik::translate('Installation_Email')));
$email->addRule('checkEmail', Piwik::translate('<API key>'));
$this->addElement('checkbox', '<API key>', null,
array(
'content' => ' ' . Piwik::translate('<API key>'),
));
$<API key> = Piwik::translate('<API key>',
array("<a href='https://matomo.org/support/?pk_medium=App_Newsletter_link&pk_source=Piwik_App&pk_campaign=App_Installation' style='color:#444;' rel='noreferrer' target='_blank'>", "</a>")
);
$currentLanguage = StaticContainer::get('Piwik\Translation\Translator')->getCurrentLanguage();
$this->addElement('checkbox', '<API key>', null,
array(
'content' => ' ' . $<API key>,
));
$this->addElement('submit', 'submit', array('value' => Piwik::translate('General_Next') . ' »', 'class' => 'btn'));
// default values
$this->addDataSource(new <API key>(array(
'<API key>' => 1,
'<API key>' => $currentLanguage == 'de' ? 0 : 1,
)));
}
}
/**
* Login id validation rule
*
*/
class <API key> extends <API key>
{
function validateOwner()
{
try {
$login = $this->owner->getValue();
if (!empty($login)) {
Piwik::<API key>($login);
}
} catch (\Exception $e) {
$this->setMessage($e->getMessage());
return false;
}
return true;
}
}
/**
* Email address validation rule
*
*/
class <API key> extends <API key>
{
function validateOwner()
{
return Piwik::isValidEmailString($this->owner->getValue());
}
} |
#include "libtorrent/socket.hpp"
#include "libtorrent/socket_io.hpp"
#include "libtorrent/upnp.hpp"
#include "libtorrent/io.hpp"
#include "libtorrent/parse_url.hpp"
#include "libtorrent/xml_parse.hpp"
#include "libtorrent/connection_queue.hpp"
#include "libtorrent/enum_net.hpp"
#include "libtorrent/escape_string.hpp"
#include "libtorrent/random.hpp"
#if defined <API key>
#include "libtorrent/debug.hpp"
#endif
#include <boost/bind.hpp>
#include <boost/ref.hpp>
#if BOOST_VERSION < 103500
#include <asio/ip/host_name.hpp>
#include <asio/ip/multicast.hpp>
#else
#include <boost/asio/ip/host_name.hpp>
#include <boost/asio/ip/multicast.hpp>
#endif
#include <cstdlib>
namespace libtorrent {
static error_code ec;
// TODO: listen_interface is not used. It's meant to bind the broadcast socket
upnp::upnp(io_service& ios, connection_queue& cc
, address const& listen_interface, std::string const& user_agent
, portmap_callback_t const& cb, log_callback_t const& lcb
, bool ignore_nonrouters, void* state)
: m_user_agent(user_agent)
, m_callback(cb)
, m_log_callback(lcb)
, m_retry_count(0)
, m_io_service(ios)
, m_socket(udp::endpoint(address_v4::from_string("239.255.255.250", ec), 1900)
, boost::bind(&upnp::on_reply, self(), _1, _2, _3))
, m_broadcast_timer(ios)
, m_refresh_timer(ios)
, m_map_timer(ios)
, m_disabled(false)
, m_closing(false)
, <API key>(ignore_nonrouters)
, m_cc(cc)
{
TORRENT_ASSERT(cb);
error_code ec;
m_socket.open(ios, ec);
if (state)
{
upnp_state_t* s = (upnp_state_t*)state;
m_devices.swap(s->devices);
m_mappings.swap(s->mappings);
delete s;
}
m_mappings.reserve(10);
}
void* upnp::drain_state()
{
upnp_state_t* s = new upnp_state_t;
s->mappings.swap(m_mappings);
for (std::set<rootdevice>::iterator i = m_devices.begin()
, end(m_devices.end()); i != end; ++i)
i->upnp_connection.reset();
s->devices.swap(m_devices);
return s;
}
upnp::~upnp()
{
}
void upnp::discover_device()
{
mutex::scoped_lock l(m_mutex);
if (m_socket.num_send_sockets() == 0)
log("No network interfaces to broadcast to", l);
<API key>(l);
}
void upnp::log(char const* msg, mutex::scoped_lock& l)
{
l.unlock();
m_log_callback(msg);
l.lock();
}
void upnp::<API key>(mutex::scoped_lock& l)
{
const char msearch[] =
"M-SEARCH * HTTP/1.1\r\n"
"HOST: 239.255.255.250:1900\r\n"
"ST:upnp:rootdevice\r\n"
"MAN:\"ssdp:discover\"\r\n"
"MX:3\r\n"
"\r\n\r\n";
error_code ec;
#ifdef TORRENT_DEBUG_UPNP
// simulate packet loss
if (m_retry_count & 1)
#endif
m_socket.send(msearch, sizeof(msearch) - 1, ec);
if (ec)
{
char msg[500];
snprintf(msg, sizeof(msg), "broadcast failed: %s. Aborting."
, convert_from_native(ec.message()).c_str());
log(msg, l);
disable(ec, l);
return;
}
#if defined <API key>
<API key>("upnp::resend_request");
#endif
++m_retry_count;
m_broadcast_timer.expires_from_now(seconds(2 * m_retry_count), ec);
m_broadcast_timer.async_wait(boost::bind(&upnp::resend_request
, self(), _1));
log("broadcasting search for rootdevice", l);
}
// returns a reference to a mapping or -1 on failure
int upnp::add_mapping(upnp::protocol_type p, int external_port, int local_port)
{
// external port 0 means _every_ port
TORRENT_ASSERT(external_port != 0);
mutex::scoped_lock l(m_mutex);
char msg[500];
snprintf(msg, sizeof(msg), "adding port map: [ protocol: %s ext_port: %u "
"local_port: %u ] %s", (p == tcp?"tcp":"udp"), external_port
, local_port, m_disabled ? "DISABLED": "");
log(msg, l);
if (m_disabled) return -1;
std::vector<global_mapping_t>::iterator i = std::find_if(
m_mappings.begin(), m_mappings.end()
, boost::bind(&global_mapping_t::protocol, _1) == int(none));
if (i == m_mappings.end())
{
m_mappings.push_back(global_mapping_t());
i = m_mappings.end() - 1;
}
i->protocol = p;
i->external_port = external_port;
i->local_port = local_port;
int mapping_index = i - m_mappings.begin();
for (std::set<rootdevice>::iterator i = m_devices.begin()
, end(m_devices.end()); i != end; ++i)
{
rootdevice& d = const_cast<rootdevice&>(*i);
TORRENT_ASSERT(d.magic == 1337);
if (int(d.mapping.size()) <= mapping_index)
d.mapping.resize(mapping_index + 1);
mapping_t& m = d.mapping[mapping_index];
m.action = mapping_t::action_add;
m.protocol = p;
m.external_port = external_port;
m.local_port = local_port;
if (d.service_namespace) update_map(d, mapping_index, l);
}
return mapping_index;
}
void upnp::delete_mapping(int mapping)
{
mutex::scoped_lock l(m_mutex);
if (mapping >= int(m_mappings.size())) return;
global_mapping_t& m = m_mappings[mapping];
char msg[500];
snprintf(msg, sizeof(msg), "deleting port map: [ protocol: %s ext_port: %u "
"local_port: %u ]", (m.protocol == tcp?"tcp":"udp"), m.external_port
, m.local_port);
log(msg, l);
if (m.protocol == none) return;
for (std::set<rootdevice>::iterator i = m_devices.begin()
, end(m_devices.end()); i != end; ++i)
{
rootdevice& d = const_cast<rootdevice&>(*i);
TORRENT_ASSERT(d.magic == 1337);
TORRENT_ASSERT(mapping < int(d.mapping.size()));
d.mapping[mapping].action = mapping_t::action_delete;
if (d.service_namespace) update_map(d, mapping, l);
}
}
bool upnp::get_mapping(int index, int& local_port, int& external_port, int& protocol) const
{
TORRENT_ASSERT(index < int(m_mappings.size()) && index >= 0);
if (index >= int(m_mappings.size()) || index < 0) return false;
global_mapping_t const& m = m_mappings[index];
if (m.protocol == none) return false;
local_port = m.local_port;
external_port = m.external_port;
protocol = m.protocol;
return true;
}
void upnp::resend_request(error_code const& ec)
{
#if defined <API key>
complete_async("upnp::resend_request");
#endif
if (ec) return;
boost::intrusive_ptr<upnp> me(self());
mutex::scoped_lock l(m_mutex);
if (m_closing) return;
if (m_retry_count < 12
&& (m_devices.empty() || m_retry_count < 4))
{
<API key>(l);
return;
}
if (m_devices.empty())
{
disable(errors::no_router, l);
return;
}
for (std::set<rootdevice>::iterator i = m_devices.begin()
, end(m_devices.end()); i != end; ++i)
{
if (i->control_url.empty() && !i->upnp_connection && !i->disabled)
{
// we don't have a WANIP or WANPPP url for this device,
// ask for it
rootdevice& d = const_cast<rootdevice&>(*i);
TORRENT_ASSERT(d.magic == 1337);
TORRENT_TRY
{
char msg[500];
snprintf(msg, sizeof(msg), "connecting to: %s", d.url.c_str());
log(msg, l);
if (d.upnp_connection) d.upnp_connection->close();
d.upnp_connection.reset(new http_connection(m_io_service
, m_cc, boost::bind(&upnp::on_upnp_xml, self(), _1, _2
, boost::ref(d), _5)));
d.upnp_connection->get(d.url, seconds(30), 1);
}
TORRENT_CATCH (std::exception& exc)
{
<API key>(std::exception, exc);
char msg[500];
snprintf(msg, sizeof(msg), "connection failed to: %s %s", d.url.c_str(), exc.what());
log(msg, l);
d.disabled = true;
}
}
}
}
void upnp::on_reply(udp::endpoint const& from, char* buffer
, std::size_t bytes_transferred)
{
boost::intrusive_ptr<upnp> me(self());
mutex::scoped_lock l(m_mutex);
using namespace libtorrent::detail;
// parse out the url for the device
error_code ec;
if (!in_local_network(m_io_service, from.address(), ec))
{
if (ec)
{
char msg[500];
snprintf(msg, sizeof(msg), "when receiving response from: %s: %s"
, print_endpoint(from).c_str(), convert_from_native(ec.message()).c_str());
log(msg, l);
}
else
{
char msg[400];
int num_chars = snprintf(msg, sizeof(msg)
, "ignoring response from: %s. IP is not on local network. "
, print_endpoint(from).c_str());
std::vector<ip_interface> net = enum_net_interfaces(m_io_service, ec);
for (std::vector<ip_interface>::const_iterator i = net.begin()
, end(net.end()); i != end && num_chars < sizeof(msg); ++i)
{
num_chars += snprintf(msg + num_chars, sizeof(msg) - num_chars, "(%s,%s) "
, print_address(i->interface_address).c_str(), print_address(i->netmask).c_str());
}
log(msg, l);
return;
}
}
bool non_router = false;
if (<API key>)
{
std::vector<ip_route> routes = enum_routes(m_io_service, ec);
if (std::find_if(routes.begin(), routes.end()
, boost::bind(&ip_route::gateway, _1) == from.address()) == routes.end())
{
// this upnp device is filtered because it's not in the
// list of configured routers
if (ec)
{
char msg[500];
snprintf(msg, sizeof(msg), "failed to enumerate routes when "
"receiving response from: %s: %s"
, print_endpoint(from).c_str(), convert_from_native(ec.message()).c_str());
log(msg, l);
}
else
{
char msg[400];
int num_chars = snprintf(msg, sizeof(msg), "SSDP response from: "
"%s: IP is not a router. "
, print_endpoint(from).c_str());
for (std::vector<ip_route>::const_iterator i = routes.begin()
, end(routes.end()); i != end && num_chars < sizeof(msg); ++i)
{
num_chars += snprintf(msg + num_chars, sizeof(msg) - num_chars, "(%s,%s) "
, print_address(i->gateway).c_str(), print_address(i->netmask).c_str());
}
log(msg, l);
non_router = true;
}
}
}
http_parser p;
bool error = false;
p.incoming(buffer::const_interval(buffer
, buffer + bytes_transferred), error);
if (error)
{
char msg[500];
snprintf(msg, sizeof(msg), "received malformed HTTP from: %s"
, print_endpoint(from).c_str());
log(msg, l);
return;
}
if (p.status_code() != 200 && p.method() != "notify")
{
if (p.method().empty())
{
char msg[500];
snprintf(msg, sizeof(msg), "HTTP status %u from %s"
, p.status_code(), print_endpoint(from).c_str());
log(msg, l);
}
else
{
char msg[500];
snprintf(msg, sizeof(msg), "HTTP method %s from %s"
, p.method().c_str(), print_endpoint(from).c_str());
log(msg, l);
}
return;
}
if (!p.header_finished())
{
char msg[500];
snprintf(msg, sizeof(msg), "incomplete HTTP packet from %s"
, print_endpoint(from).c_str());
log(msg, l);
return;
}
std::string url = p.header("location");
if (url.empty())
{
char msg[500];
snprintf(msg, sizeof(msg), "missing location header from %s"
, print_endpoint(from).c_str());
log(msg, l);
return;
}
rootdevice d;
d.url = url;
std::set<rootdevice>::iterator i = m_devices.find(d);
if (i == m_devices.end())
{
std::string protocol;
std::string auth;
error_code ec;
// we don't have this device in our list. Add it
boost::tie(protocol, auth, d.hostname, d.port, d.path)
= <API key>(d.url, ec);
if (d.port == -1) d.port = protocol == "http" ? 80 : 443;
if (ec)
{
char msg[500];
snprintf(msg, sizeof(msg), "invalid URL %s from %s: %s"
, d.url.c_str(), print_endpoint(from).c_str(), convert_from_native(ec.message()).c_str());
log(msg, l);
return;
}
// ignore the auth here. It will be re-parsed
// by the http connection later
if (protocol != "http")
{
char msg[500];
snprintf(msg, sizeof(msg), "unsupported protocol %s from %s"
, protocol.c_str(), print_endpoint(from).c_str());
log(msg, l);
return;
}
if (d.port == 0)
{
char msg[500];
snprintf(msg, sizeof(msg), "URL with port 0 from %s"
, print_endpoint(from).c_str());
log(msg, l);
return;
}
char msg[500];
snprintf(msg, sizeof(msg), "found rootdevice: %s (%d)"
, d.url.c_str(), int(m_devices.size()));
log(msg, l);
if (m_devices.size() >= 50)
{
char msg[500];
snprintf(msg, sizeof(msg), "too many rootdevices: (%d). Ignoring %s"
, int(m_devices.size()), d.url.c_str());
log(msg, l);
return;
}
d.non_router = non_router;
TORRENT_ASSERT(d.mapping.empty());
for (std::vector<global_mapping_t>::iterator j = m_mappings.begin()
, end(m_mappings.end()); j != end; ++j)
{
mapping_t m;
m.action = mapping_t::action_add;
m.local_port = j->local_port;
m.external_port = j->external_port;
m.protocol = j->protocol;
d.mapping.push_back(m);
}
boost::tie(i, boost::tuples::ignore) = m_devices.insert(d);
}
// iterate over the devices we know and connect and issue the mappings
try_map_upnp(l);
if (<API key>)
{
#if defined <API key>
<API key>("upnp::map_timer");
#endif
// check back in in a little bit to see if we have seen any
// devices at one of our default routes. If not, we want to override
// ignoring them and use them instead (better than not working).
m_map_timer.expires_from_now(seconds(1), ec);
m_map_timer.async_wait(boost::bind(&upnp::map_timer
, self(), _1));
}
}
void upnp::map_timer(error_code const& ec)
{
#if defined <API key>
complete_async("upnp::map_timer");
#endif
if (ec) return;
if (m_closing) return;
mutex::scoped_lock l(m_mutex);
try_map_upnp(l, true);
}
void upnp::try_map_upnp(mutex::scoped_lock& l, bool timer)
{
if (m_devices.empty()) return;
bool <API key> = false;
if (<API key> && timer)
{
// if we don't ave any devices that match our default route, we
// should try to map with the ones we did hear from anyway,
// regardless of if they are not running at our gateway.
<API key> = std::find_if(m_devices.begin()
, m_devices.end(), boost::bind(&rootdevice::non_router, _1) == false)
== m_devices.end();
if (<API key>)
{
char msg[500];
snprintf(msg, sizeof(msg), "overriding ignore non-routers");
log(msg, l);
}
}
for (std::set<rootdevice>::iterator i = m_devices.begin()
, end(m_devices.end()); i != end; ++i)
{
// if we're ignoring non-routers, skip them. If on_timer is
// set, we expect to have received all responses and if we don't
// have any devices at our default route, then issue requests
// to any device we found.
if (<API key> && i->non_router
&& !<API key>)
continue;
if (i->control_url.empty() && !i->upnp_connection && !i->disabled)
{
// we don't have a WANIP or WANPPP url for this device,
// ask for it
rootdevice& d = const_cast<rootdevice&>(*i);
TORRENT_ASSERT(d.magic == 1337);
TORRENT_TRY
{
char msg[500];
snprintf(msg, sizeof(msg), "connecting to: %s"
, d.url.c_str());
log(msg, l);
if (d.upnp_connection) d.upnp_connection->close();
d.upnp_connection.reset(new http_connection(m_io_service
, m_cc, boost::bind(&upnp::on_upnp_xml, self(), _1, _2
, boost::ref(d), _5)));
d.upnp_connection->get(d.url, seconds(30), 1);
}
TORRENT_CATCH (std::exception& exc)
{
<API key>(std::exception, exc);
char msg[500];
snprintf(msg, sizeof(msg), "connection failed to: %s %s"
, d.url.c_str(), exc.what());
log(msg, l);
d.disabled = true;
}
}
}
}
void upnp::post(upnp::rootdevice const& d, char const* soap
, char const* soap_action, mutex::scoped_lock& l)
{
TORRENT_ASSERT(d.magic == 1337);
TORRENT_ASSERT(d.upnp_connection);
char header[2048];
snprintf(header, sizeof(header), "POST %s HTTP/1.0\r\n"
"Host: %s:%u\r\n"
"Content-Type: text/xml; charset=\"utf-8\"\r\n"
"Content-Length: %d\r\n"
"Soapaction: \"%s#%s\"\r\n\r\n"
"%s"
, d.path.c_str(), d.hostname.c_str(), d.port
, int(strlen(soap)), d.service_namespace, soap_action
, soap);
d.upnp_connection->sendbuffer = header;
char msg[1024];
snprintf(msg, sizeof(msg), "sending: %s", header);
log(msg, l);
}
void upnp::create_port_mapping(http_connection& c, rootdevice& d, int i)
{
mutex::scoped_lock l(m_mutex);
TORRENT_ASSERT(d.magic == 1337);
if (!d.upnp_connection)
{
TORRENT_ASSERT(d.disabled);
char msg[500];
snprintf(msg, sizeof(msg), "mapping %u aborted", i);
log(msg, l);
return;
}
char const* soap_action = "AddPortMapping";
std::string local_endpoint = print_address(c.socket().local_endpoint(ec).address());
char soap[2048];
error_code ec;
snprintf(soap, sizeof(soap), "<?xml version=\"1.0\"?>\n"
"<s:Envelope xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\" "
"s:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\">"
"<s:Body><u:%s xmlns:u=\"%s\">"
"<NewRemoteHost></NewRemoteHost>"
"<NewExternalPort>%u</NewExternalPort>"
"<NewProtocol>%s</NewProtocol>"
"<NewInternalPort>%u</NewInternalPort>"
"<NewInternalClient>%s</NewInternalClient>"
"<NewEnabled>1</NewEnabled>"
"<<API key>>%s at %s:%d</<API key>>"
"<NewLeaseDuration>%u</NewLeaseDuration>"
"</u:%s></s:Body></s:Envelope>"
, soap_action, d.service_namespace, d.mapping[i].external_port
, (d.mapping[i].protocol == udp ? "UDP" : "TCP")
, d.mapping[i].local_port
, local_endpoint.c_str()
, m_user_agent.c_str(), local_endpoint.c_str(), d.mapping[i].local_port
, d.lease_duration, soap_action);
post(d, soap, soap_action, l);
}
void upnp::next(rootdevice& d, int i, mutex::scoped_lock& l)
{
if (i < num_mappings() - 1)
{
update_map(d, i + 1, l);
}
else
{
std::vector<mapping_t>::iterator j
= std::find_if(d.mapping.begin(), d.mapping.end()
, boost::bind(&mapping_t::action, _1) != int(mapping_t::action_none));
if (j == d.mapping.end()) return;
update_map(d, j - d.mapping.begin(), l);
}
}
void upnp::update_map(rootdevice& d, int i, mutex::scoped_lock& l)
{
TORRENT_ASSERT(d.magic == 1337);
TORRENT_ASSERT(i < int(d.mapping.size()));
TORRENT_ASSERT(d.mapping.size() == m_mappings.size());
if (d.upnp_connection) return;
boost::intrusive_ptr<upnp> me(self());
mapping_t& m = d.mapping[i];
if (m.action == mapping_t::action_none
|| m.protocol == none)
{
char msg[500];
snprintf(msg, sizeof(msg), "mapping %u does not need updating, skipping", i);
log(msg, l);
m.action = mapping_t::action_none;
next(d, i, l);
return;
}
TORRENT_ASSERT(!d.upnp_connection);
TORRENT_ASSERT(d.service_namespace);
char msg[500];
snprintf(msg, sizeof(msg), "connecting to %s", d.hostname.c_str());
log(msg, l);
if (m.action == mapping_t::action_add)
{
if (m.failcount > 5)
{
m.action = mapping_t::action_none;
// giving up
next(d, i, l);
return;
}
if (d.upnp_connection) d.upnp_connection->close();
d.upnp_connection.reset(new http_connection(m_io_service
, m_cc, boost::bind(&upnp::<API key>, self(), _1, _2
, boost::ref(d), i, _5), true, <API key>
, boost::bind(&upnp::create_port_mapping, self(), _1, boost::ref(d), i)));
d.upnp_connection->start(d.hostname, to_string(d.port).elems
, seconds(10), 1);
}
else if (m.action == mapping_t::action_delete)
{
if (d.upnp_connection) d.upnp_connection->close();
d.upnp_connection.reset(new http_connection(m_io_service
, m_cc, boost::bind(&upnp::<API key>, self(), _1, _2
, boost::ref(d), i, _5), true, <API key>
, boost::bind(&upnp::delete_port_mapping, self(), boost::ref(d), i)));
d.upnp_connection->start(d.hostname, to_string(d.port).elems
, seconds(10), 1);
}
m.action = mapping_t::action_none;
}
void upnp::delete_port_mapping(rootdevice& d, int i)
{
mutex::scoped_lock l(m_mutex);
TORRENT_ASSERT(d.magic == 1337);
if (!d.upnp_connection)
{
TORRENT_ASSERT(d.disabled);
char msg[500];
snprintf(msg, sizeof(msg), "unmapping %u aborted", i);
log(msg, l);
return;
}
char const* soap_action = "DeletePortMapping";
char soap[2048];
error_code ec;
snprintf(soap, sizeof(soap), "<?xml version=\"1.0\"?>\n"
"<s:Envelope xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\" "
"s:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\">"
"<s:Body><u:%s xmlns:u=\"%s\">"
"<NewRemoteHost></NewRemoteHost>"
"<NewExternalPort>%u</NewExternalPort>"
"<NewProtocol>%s</NewProtocol>"
"</u:%s></s:Body></s:Envelope>"
, soap_action, d.service_namespace
, d.mapping[i].external_port
, (d.mapping[i].protocol == udp ? "UDP" : "TCP")
, soap_action);
post(d, soap, soap_action, l);
}
namespace
{
void copy_tolower(std::string& dst, char const* src)
{
dst.clear();
while (*src) dst.push_back(to_lower(*src++));
}
}
struct parse_state
{
parse_state(): in_service(false), service_type(0) {}
void reset(char const* st)
{
in_service = false;
service_type = st;
tag_stack.clear();
control_url.clear();
model.clear();
url_base.clear();
}
bool in_service;
std::list<std::string> tag_stack;
std::string control_url;
char const* service_type;
std::string model;
std::string url_base;
bool top_tags(const char* str1, const char* str2)
{
std::list<std::string>::reverse_iterator i = tag_stack.rbegin();
if (i == tag_stack.rend()) return false;
if (!<API key>(i->c_str(), str2)) return false;
++i;
if (i == tag_stack.rend()) return false;
if (!<API key>(i->c_str(), str1)) return false;
return true;
}
};
<API key> void find_control_url(int type, char const* string, parse_state& state)
{
if (type == xml_start_tag)
{
std::string tag;
copy_tolower(tag, string);
state.tag_stack.push_back(tag);
// std::copy(state.tag_stack.begin(), state.tag_stack.end(), std::ostream_iterator<std::string>(std::cout, " "));
// std::cout << std::endl;
}
else if (type == xml_end_tag)
{
if (!state.tag_stack.empty())
{
if (state.in_service && state.tag_stack.back() == "service")
state.in_service = false;
state.tag_stack.pop_back();
}
}
else if (type == xml_string)
{
if (state.tag_stack.empty()) return;
// std::cout << " " << string << std::endl;
if (!state.in_service && state.top_tags("service", "servicetype"))
{
if (<API key>(string, state.service_type))
state.in_service = true;
}
else if (state.control_url.empty() && state.in_service && state.top_tags("service", "controlurl"))
{
// default to the first (or only) control url in the router's listing
state.control_url = string;
}
else if (state.model.empty() && state.top_tags("device", "modelname"))
{
state.model = string;
}
else if (state.tag_stack.back() == "urlbase")
{
state.url_base = string;
}
}
}
void upnp::on_upnp_xml(error_code const& e
, libtorrent::http_parser const& p, rootdevice& d
, http_connection& c)
{
boost::intrusive_ptr<upnp> me(self());
mutex::scoped_lock l(m_mutex);
TORRENT_ASSERT(d.magic == 1337);
if (d.upnp_connection && d.upnp_connection.get() == &c)
{
d.upnp_connection->close();
d.upnp_connection.reset();
}
if (e && e != asio::error::eof)
{
char msg[500];
snprintf(msg, sizeof(msg), "error while fetching control url from: %s: %s"
, d.url.c_str(), convert_from_native(e.message()).c_str());
log(msg, l);
d.disabled = true;
return;
}
if (!p.header_finished())
{
char msg[500];
snprintf(msg, sizeof(msg), "error while fetching control url from: %s: incomplete HTTP message"
, d.url.c_str());
log(msg, l);
d.disabled = true;
return;
}
if (p.status_code() != 200)
{
char msg[500];
snprintf(msg, sizeof(msg), "error while fetching control url from: %s: %s"
, d.url.c_str(), convert_from_native(p.message()).c_str());
log(msg, l);
d.disabled = true;
return;
}
parse_state s;
s.reset("urn:schemas-upnp-org:service:WANIPConnection:1");
xml_parse((char*)p.get_body().begin, (char*)p.get_body().end
, boost::bind(&find_control_url, _1, _2, boost::ref(s)));
if (!s.control_url.empty())
{
d.service_namespace = s.service_type;
if (!s.model.empty()) m_model = s.model;
}
else
{
// we didn't find the WAN IP connection, look for
// a PPP connection
s.reset("urn:schemas-upnp-org:service:WANPPPConnection:1");
xml_parse((char*)p.get_body().begin, (char*)p.get_body().end
, boost::bind(&find_control_url, _1, _2, boost::ref(s)));
if (!s.control_url.empty())
{
d.service_namespace = s.service_type;
if (!s.model.empty()) m_model = s.model;
}
else
{
char msg[500];
snprintf(msg, sizeof(msg), "could not find a port mapping interface in response from: %s"
, d.url.c_str());
log(msg, l);
d.disabled = true;
return;
}
}
if (!s.url_base.empty() && s.control_url.substr(0, 7) != "http:
{
// avoid double slashes in path
if (s.url_base[s.url_base.size()-1] == '/'
&& !s.control_url.empty()
&& s.control_url[0] == '/')
s.url_base.erase(s.url_base.end()-1);
d.control_url = s.url_base + s.control_url;
}
else d.control_url = s.control_url;
std::string protocol;
std::string auth;
error_code ec;
if (!d.control_url.empty() && d.control_url[0] == '/')
{
boost::tie(protocol, auth, d.hostname, d.port, d.path)
= <API key>(d.url, ec);
if (d.port == -1) d.port = protocol == "http" ? 80 : 443;
d.control_url = protocol + "://" + d.hostname + ":"
+ to_string(d.port).elems + s.control_url;
}
char msg[500];
snprintf(msg, sizeof(msg), "found control URL: %s namespace %s "
"urlbase: %s in response from %s"
, d.control_url.c_str(), d.service_namespace
, s.url_base.c_str(), d.url.c_str());
log(msg, l);
boost::tie(protocol, auth, d.hostname, d.port, d.path)
= <API key>(d.control_url, ec);
if (d.port == -1) d.port = protocol == "http" ? 80 : 443;
if (ec)
{
char msg[500];
snprintf(msg, sizeof(msg), "failed to parse URL '%s': %s"
, d.control_url.c_str(), convert_from_native(ec.message()).c_str());
log(msg, l);
d.disabled = true;
return;
}
d.upnp_connection.reset(new http_connection(m_io_service
, m_cc, boost::bind(&upnp::<API key>, self(), _1, _2
, boost::ref(d), _5), true, <API key>
, boost::bind(&upnp::get_ip_address, self(), boost::ref(d))));
d.upnp_connection->start(d.hostname, to_string(d.port).elems
, seconds(10), 1);
}
void upnp::get_ip_address(rootdevice& d)
{
mutex::scoped_lock l(m_mutex);
TORRENT_ASSERT(d.magic == 1337);
if (!d.upnp_connection)
{
TORRENT_ASSERT(d.disabled);
char msg[500];
snprintf(msg, sizeof(msg), "getting external IP address");
log(msg, l);
return;
}
char const* soap_action = "<API key>";
char soap[2048];
error_code ec;
snprintf(soap, sizeof(soap), "<?xml version=\"1.0\"?>\n"
"<s:Envelope xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\" "
"s:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\">"
"<s:Body><u:%s xmlns:u=\"%s\">"
"</u:%s></s:Body></s:Envelope>"
, soap_action, d.service_namespace
, soap_action);
post(d, soap, soap_action, l);
}
void upnp::disable(error_code const& ec, mutex::scoped_lock& l)
{
m_disabled = true;
// kill all mappings
for (std::vector<global_mapping_t>::iterator i = m_mappings.begin()
, end(m_mappings.end()); i != end; ++i)
{
if (i->protocol == none) continue;
i->protocol = none;
l.unlock();
m_callback(i - m_mappings.begin(), address(), 0, ec);
l.lock();
}
// we cannot clear the devices since there
// might be outstanding requests relying on
// the device entry being present when they
// complete
error_code e;
m_broadcast_timer.cancel(e);
m_refresh_timer.cancel(e);
m_map_timer.cancel(e);
m_socket.close();
}
namespace
{
struct <API key>
{
<API key>(): in_error_code(false), exit(false), error_code(-1) {}
bool in_error_code;
bool exit;
int error_code;
};
void find_error_code(int type, char const* string, <API key>& state)
{
if (state.exit) return;
if (type == xml_start_tag && !std::strcmp("errorCode", string))
{
state.in_error_code = true;
}
else if (type == xml_string && state.in_error_code)
{
state.error_code = std::atoi(string);
state.exit = true;
}
}
struct <API key>: public <API key>
{
<API key>(): in_ip_address(false) {}
bool in_ip_address;
std::string ip_address;
};
void find_ip_address(int type, char const* string, <API key>& state)
{
find_error_code(type, string, state);
if (state.exit) return;
if (type == xml_start_tag && !std::strcmp("<API key>", string))
{
state.in_ip_address = true;
}
else if (type == xml_string && state.in_ip_address)
{
state.ip_address = string;
state.exit = true;
}
}
struct error_code_t
{
int code;
char const* msg;
};
error_code_t error_codes[] =
{
{0, "no error"}
, {402, "Invalid Arguments"}
, {501, "Action Failed"}
, {714, "The specified value does not exist in the array"}
, {715, "The source IP address cannot be wild-carded"}
, {716, "The external port cannot be wild-carded"}
, {718, "The port mapping entry specified conflicts with "
"a mapping assigned previously to another client"}
, {724, "Internal and External port values must be the same"}
, {725, "The NAT implementation only supports permanent "
"lease times on port mappings"}
, {726, "RemoteHost must be a wildcard and cannot be a "
"specific IP address or DNS name"}
, {727, "ExternalPort must be a wildcard and cannot be a specific port "}
};
}
#if BOOST_VERSION >= 103500
struct upnp_error_category : boost::system::error_category
{
virtual const char* name() const <API key>
{
return "UPnP error";
}
virtual std::string message(int ev) const <API key>
{
int num_errors = sizeof(error_codes) / sizeof(error_codes[0]);
error_code_t* end = error_codes + num_errors;
error_code_t tmp = {ev, 0};
error_code_t* e = std::lower_bound(error_codes, end, tmp
, boost::bind(&error_code_t::code, _1) < boost::bind(&error_code_t::code, _2));
if (e != end && e->code == ev)
{
return e->msg;
}
char msg[500];
snprintf(msg, sizeof(msg), "unknown UPnP error (%d)", ev);
return msg;
}
virtual boost::system::error_condition <API key>(
int ev) const <API key>
{
return boost::system::error_condition(ev, *this);
}
};
boost::system::error_category& get_upnp_category()
{
static upnp_error_category cat;
return cat;
}
#else
boost::system::error_category& get_upnp_category()
{
static ::asio::error::error_category cat(21);
return cat;
}
#endif
void upnp::<API key>(error_code const& e
, libtorrent::http_parser const& p, rootdevice& d
, http_connection& c)
{
boost::intrusive_ptr<upnp> me(self());
mutex::scoped_lock l(m_mutex);
TORRENT_ASSERT(d.magic == 1337);
if (d.upnp_connection && d.upnp_connection.get() == &c)
{
d.upnp_connection->close();
d.upnp_connection.reset();
}
if (m_closing) return;
if (e && e != asio::error::eof)
{
char msg[500];
snprintf(msg, sizeof(msg), "error while getting external IP address: %s"
, convert_from_native(e.message()).c_str());
log(msg, l);
if (num_mappings() > 0) update_map(d, 0, l);
return;
}
if (!p.header_finished())
{
log("error while getting external IP address: incomplete http message", l);
if (num_mappings() > 0) update_map(d, 0, l);
return;
}
if (p.status_code() != 200)
{
char msg[500];
snprintf(msg, sizeof(msg), "error while getting external IP address: %s"
, convert_from_native(p.message()).c_str());
log(msg, l);
if (num_mappings() > 0) update_map(d, 0, l);
return;
}
// response may look like
// <?xml version="1.0"?>
// <s:Body><u:<API key> xmlns:u="urn:schemas-upnp-org:service:WANIPConnection:1">
// <<API key>>192.168.160.19</<API key>>
// </u:<API key>>
// </s:Body>
// </s:Envelope>
char msg[500];
snprintf(msg, sizeof(msg), "get external IP address response: %s"
, std::string(p.get_body().begin, p.get_body().end).c_str());
log(msg, l);
<API key> s;
xml_parse((char*)p.get_body().begin, (char*)p.get_body().end
, boost::bind(&find_ip_address, _1, _2, boost::ref(s)));
if (s.error_code != -1)
{
char msg[500];
snprintf(msg, sizeof(msg), "error while getting external IP address, code: %u"
, s.error_code);
log(msg, l);
}
if (!s.ip_address.empty()) {
snprintf(msg, sizeof(msg), "got router external IP address %s", s.ip_address.c_str());
log(msg, l);
d.external_ip = address::from_string(s.ip_address.c_str(), ec);
} else {
log("failed to find external IP address in response", l);
}
if (num_mappings() > 0) update_map(d, 0, l);
}
void upnp::<API key>(error_code const& e
, libtorrent::http_parser const& p, rootdevice& d, int mapping
, http_connection& c)
{
boost::intrusive_ptr<upnp> me(self());
mutex::scoped_lock l(m_mutex);
TORRENT_ASSERT(d.magic == 1337);
if (d.upnp_connection && d.upnp_connection.get() == &c)
{
d.upnp_connection->close();
d.upnp_connection.reset();
}
if (e && e != asio::error::eof)
{
char msg[500];
snprintf(msg, sizeof(msg), "error while adding port map: %s"
, convert_from_native(e.message()).c_str());
log(msg, l);
d.disabled = true;
return;
}
if (m_closing) return;
// error code response may look like this:
// <s:Body>
// <s:Fault>
// <faultcode>s:Client</faultcode>
// <faultstring>UPnPError</faultstring>
// <detail>
// <UPnPErrorxmlns="urn:schemas-upnp-org:control-1-0">
// <errorCode>402</errorCode>
// <errorDescription>Invalid Args</errorDescription>
// </UPnPError>
// </detail>
// </s:Fault>
// </s:Body>
// </s:Envelope>
if (!p.header_finished())
{
log("error while adding port map: incomplete http message", l);
next(d, mapping, l);
return;
}
std::string ct = p.header("content-type");
if (!ct.empty()
&& ct.find_first_of("text/xml") == std::string::npos
&& ct.find_first_of("text/soap+xml") == std::string::npos
&& ct.find_first_of("application/xml") == std::string::npos
&& ct.find_first_of("application/soap+xml") == std::string::npos
)
{
char msg[300];
snprintf(msg, sizeof(msg), "error while adding port map: invalid content-type, \"%s\". Expected text/xml or application/soap+xml"
, ct.c_str());
log(msg, l);
next(d, mapping, l);
return;
}
// We don't want to ignore responses with return codes other than 200
// since those might contain valid UPnP error codes
<API key> s;
xml_parse((char*)p.get_body().begin, (char*)p.get_body().end
, boost::bind(&find_error_code, _1, _2, boost::ref(s)));
if (s.error_code != -1)
{
char msg[500];
snprintf(msg, sizeof(msg), "error while adding port map, code: %u"
, s.error_code);
log(msg, l);
}
mapping_t& m = d.mapping[mapping];
if (s.error_code == 725)
{
// only permanent leases supported
d.lease_duration = 0;
m.action = mapping_t::action_add;
++m.failcount;
update_map(d, mapping, l);
return;
}
else if (s.error_code == 727)
{
return_error(mapping, s.error_code, l);
}
else if ((s.error_code == 718 || s.error_code == 501) && m.failcount < 4)
{
// some routers return 501 action failed, instead of 716
// The external port conflicts with another mapping
// pick a random port
m.external_port = 40000 + (random() % 10000);
m.action = mapping_t::action_add;
++m.failcount;
update_map(d, mapping, l);
return;
}
else if (s.error_code != -1)
{
return_error(mapping, s.error_code, l);
}
char msg[500];
snprintf(msg, sizeof(msg), "map response: %s"
, std::string(p.get_body().begin, p.get_body().end).c_str());
log(msg, l);
if (s.error_code == -1)
{
l.unlock();
m_callback(mapping, d.external_ip, m.external_port, error_code());
l.lock();
if (d.lease_duration > 0)
{
m.expires = time_now()
+ seconds(int(d.lease_duration * 0.75f));
ptime next_expire = m_refresh_timer.expires_at();
if (next_expire < time_now()
|| next_expire > m.expires)
{
#if defined <API key>
<API key>("upnp::on_expire");
#endif
error_code ec;
m_refresh_timer.expires_at(m.expires, ec);
m_refresh_timer.async_wait(boost::bind(&upnp::on_expire, self(), _1));
}
}
else
{
m.expires = max_time();
}
m.failcount = 0;
}
next(d, mapping, l);
}
void upnp::return_error(int mapping, int code, mutex::scoped_lock& l)
{
int num_errors = sizeof(error_codes) / sizeof(error_codes[0]);
error_code_t* end = error_codes + num_errors;
error_code_t tmp = {code, 0};
error_code_t* e = std::lower_bound(error_codes, end, tmp
, boost::bind(&error_code_t::code, _1) < boost::bind(&error_code_t::code, _2));
std::string error_string = "UPnP mapping error ";
error_string += to_string(code).elems;
if (e != end && e->code == code)
{
error_string += ": ";
error_string += e->msg;
}
l.unlock();
m_callback(mapping, address(), 0, error_code(code, get_upnp_category()));
l.lock();
}
void upnp::<API key>(error_code const& e
, libtorrent::http_parser const& p, rootdevice& d, int mapping
, http_connection& c)
{
boost::intrusive_ptr<upnp> me(self());
mutex::scoped_lock l(m_mutex);
TORRENT_ASSERT(d.magic == 1337);
if (d.upnp_connection && d.upnp_connection.get() == &c)
{
d.upnp_connection->close();
d.upnp_connection.reset();
}
if (e && e != asio::error::eof)
{
char msg[500];
snprintf(msg, sizeof(msg), "error while deleting portmap: %s"
, convert_from_native(e.message()).c_str());
log(msg, l);
}
else if (!p.header_finished())
{
log("error while deleting portmap: incomplete http message", l);
}
else if (p.status_code() != 200)
{
char msg[500];
snprintf(msg, sizeof(msg), "error while deleting portmap: %s"
, convert_from_native(p.message()).c_str());
log(msg, l);
}
else
{
char msg[500];
snprintf(msg, sizeof(msg), "unmap response: %s"
, std::string(p.get_body().begin, p.get_body().end).c_str());
log(msg, l);
}
<API key> s;
if (p.header_finished())
{
xml_parse((char*)p.get_body().begin, (char*)p.get_body().end
, boost::bind(&find_error_code, _1, _2, boost::ref(s)));
}
l.unlock();
m_callback(mapping, address(), 0, p.status_code() != 200
? error_code(p.status_code(), get_http_category())
: error_code(s.error_code, get_upnp_category()));
l.lock();
d.mapping[mapping].protocol = none;
next(d, mapping, l);
}
void upnp::on_expire(error_code const& ec)
{
#if defined <API key>
complete_async("upnp::on_expire");
#endif
if (ec) return;
ptime now = time_now();
ptime next_expire = max_time();
mutex::scoped_lock l(m_mutex);
for (std::set<rootdevice>::iterator i = m_devices.begin()
, end(m_devices.end()); i != end; ++i)
{
rootdevice& d = const_cast<rootdevice&>(*i);
TORRENT_ASSERT(d.magic == 1337);
for (int m = 0; m < num_mappings(); ++m)
{
if (d.mapping[m].expires != max_time())
continue;
if (d.mapping[m].expires < now)
{
d.mapping[m].expires = max_time();
update_map(d, m, l);
}
else if (d.mapping[m].expires < next_expire)
{
next_expire = d.mapping[m].expires;
}
}
}
if (next_expire != max_time())
{
#if defined <API key>
<API key>("upnp::on_expire");
#endif
error_code e;
m_refresh_timer.expires_at(next_expire, e);
m_refresh_timer.async_wait(boost::bind(&upnp::on_expire, self(), _1));
}
}
void upnp::close()
{
mutex::scoped_lock l(m_mutex);
error_code ec;
m_refresh_timer.cancel(ec);
m_broadcast_timer.cancel(ec);
m_map_timer.cancel(ec);
m_closing = true;
m_socket.close();
for (std::set<rootdevice>::iterator i = m_devices.begin()
, end(m_devices.end()); i != end; ++i)
{
rootdevice& d = const_cast<rootdevice&>(*i);
TORRENT_ASSERT(d.magic == 1337);
if (d.control_url.empty()) continue;
for (std::vector<mapping_t>::iterator j = d.mapping.begin()
, end(d.mapping.end()); j != end; ++j)
{
if (j->protocol == none) continue;
if (j->action == mapping_t::action_add)
{
j->action = mapping_t::action_none;
continue;
}
j->action = mapping_t::action_delete;
m_mappings[j - d.mapping.begin()].protocol = none;
}
if (num_mappings() > 0) update_map(d, 0, l);
}
}
} |
/*
simulator connector for ardupilot version of CRRCSim
*/
#include "SIM_CRRCSim.h"
#include <stdio.h>
#include <AP_HAL/AP_HAL.h>
extern const AP_HAL::HAL& hal;
namespace SITL {
CRRCSim::CRRCSim(const char *home_str, const char *frame_str) :
Aircraft(home_str, frame_str),
last_timestamp(0),
sock(true)
{
// try to bind to a specific port so that if we restart ArduPilot
// CRRCSim keeps sending us packets. Not strictly necessary but
// useful for debugging
sock.bind("127.0.0.1", 9003);
sock.reuseaddress();
sock.set_blocking(false);
heli_servos = (strstr(frame_str,"heli") != nullptr);
}
/*
decode and send servos for heli
*/
void CRRCSim::send_servos_heli(const struct sitl_input &input)
{
float swash1 = (input.servos[0]-1000) / 1000.0f;
float swash2 = (input.servos[1]-1000) / 1000.0f;
float swash3 = (input.servos[2]-1000) / 1000.0f;
float tail_rotor = (input.servos[3]-1000) / 1000.0f;
float rsc = (input.servos[7]-1000) / 1000.0f;
float col_pitch = (swash1+swash2+swash3)/3.0 - 0.5f;
float roll_rate = (swash1 - swash2)/2;
float pitch_rate = -((swash1 + swash2)/2.0 - swash3)/2;
float yaw_rate = -(tail_rotor - 0.5);
servo_packet pkt;
pkt.roll_rate = constrain_float(roll_rate, -0.5, 0.5);
pkt.pitch_rate = constrain_float(pitch_rate, -0.5, 0.5);
pkt.throttle = constrain_float(rsc, 0, 1);
pkt.yaw_rate = constrain_float(yaw_rate, -0.5, 0.5);
pkt.col_pitch = constrain_float(col_pitch, -0.5, 0.5);
sock.sendto(&pkt, sizeof(pkt), "127.0.0.1", 9002);
}
/*
decode and send servos for fixed wing
*/
void CRRCSim::<API key>(const struct sitl_input &input)
{
float roll_rate = ((input.servos[0]-1000)/1000.0) - 0.5;
float pitch_rate = ((input.servos[1]-1000)/1000.0) - 0.5;
float yaw_rate = ((input.servos[3]-1000)/1000.0) - 0.5;
float throttle = ((input.servos[2]-1000)/1000.0);
servo_packet pkt;
pkt.roll_rate = constrain_float(roll_rate, -0.5, 0.5);
pkt.pitch_rate = constrain_float(pitch_rate, -0.5, 0.5);
pkt.throttle = constrain_float(throttle, 0, 1);
pkt.yaw_rate = constrain_float(yaw_rate, -0.5, 0.5);
pkt.col_pitch = 0;
sock.sendto(&pkt, sizeof(pkt), "127.0.0.1", 9002);
}
/*
decode and send servos
*/
void CRRCSim::send_servos(const struct sitl_input &input)
{
if (heli_servos) {
send_servos_heli(input);
} else {
<API key>(input);
}
}
/*
receive an update from the FDM
This is a blocking function
*/
void CRRCSim::recv_fdm(const struct sitl_input &input)
{
fdm_packet pkt;
/*
we re-send the servo packet every 0.1 seconds until we get a
reply. This allows us to cope with some packet loss to the FDM
*/
while (sock.recv(&pkt, sizeof(pkt), 100) != sizeof(pkt)) {
send_servos(input);
}
accel_body = Vector3f(pkt.xAccel, pkt.yAccel, pkt.zAccel);
gyro = Vector3f(pkt.rollRate, pkt.pitchRate, pkt.yawRate);
velocity_ef = Vector3f(pkt.speedN, pkt.speedE, pkt.speedD);
Location loc1, loc2;
loc2.lat = pkt.latitude * 1.0e7;
loc2.lng = pkt.longitude * 1.0e7;
memset(&loc1, 0, sizeof(loc1));
Vector2f posdelta = location_diff(loc1, loc2);
position.x = posdelta.x;
position.y = posdelta.y;
position.z = -pkt.altitude;
airspeed = pkt.airspeed;
airspeed_pitot = pkt.airspeed;
dcm.from_euler(pkt.roll, pkt.pitch, pkt.yaw);
// auto-adjust to crrcsim frame rate
double deltat = pkt.timestamp - last_timestamp;
time_now_us += deltat * 1.0e6;
if (deltat < 0.01 && deltat > 0) {
adjust_frame_time(1.0/deltat);
}
last_timestamp = pkt.timestamp;
}
/*
update the CRRCSim simulation by one time step
*/
void CRRCSim::update(const struct sitl_input &input)
{
send_servos(input);
recv_fdm(input);
update_position();
// update magnetic field
update_mag_field_bf();
}
} // namespace SITL |
package com.codebutler.farebot.util;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.net.Uri;
import com.codebutler.farebot.provider.CardDBHelper;
import com.codebutler.farebot.provider.CardProvider;
import com.codebutler.farebot.provider.CardsTableColumns;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.xml.sax.InputSource;
import java.io.StringReader;
import java.io.StringWriter;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.<API key>;
import javax.xml.transform.OutputKeys;
import javax.xml.transform.Result;
import javax.xml.transform.Source;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
public class ExportHelper {
private ExportHelper() { }
public static String exportCardsXml(Context context) throws Exception {
<API key> factory = <API key>.newInstance();
factory.setNamespaceAware(true);
DocumentBuilder builder = factory.newDocumentBuilder();
Document exportDoc = builder.newDocument();
Element cardsElement = exportDoc.createElement("cards");
exportDoc.appendChild(cardsElement);
Cursor cursor = CardDBHelper.createCursor(context);
while (cursor.moveToNext()) {
int type = cursor.getInt(cursor.getColumnIndex(CardsTableColumns.TYPE));
String serial = cursor.getString(cursor.getColumnIndex(CardsTableColumns.TAG_SERIAL));
String data = cursor.getString(cursor.getColumnIndex(CardsTableColumns.DATA));
Document doc = builder.parse(new InputSource(new StringReader(data)));
Element rootElement = doc.getDocumentElement();
cardsElement.appendChild(exportDoc.adoptNode(rootElement.cloneNode(true)));
}
return xmlNodeToString(exportDoc);
}
public static Uri[] importCardsXml(Context context, String xml) throws Exception {
DocumentBuilder builder = <API key>.newInstance().newDocumentBuilder();
Document doc = builder.parse(new InputSource(new StringReader(xml)));
Element rootElement = doc.getDocumentElement();
if (rootElement.getNodeName().equals("card"))
return new Uri[] { importCard(context, rootElement) };
NodeList cardNodes = rootElement.<API key>("card");
Uri[] results = new Uri[cardNodes.getLength()];
for (int i = 0; i < cardNodes.getLength(); i++) {
results[i] = importCard(context, (Element)cardNodes.item(i));
}
return results;
}
private static Uri importCard(Context context, Element cardElement) throws Exception {
String xml = xmlNodeToString(cardElement);
ContentValues values = new ContentValues();
values.put(CardsTableColumns.TYPE, cardElement.getAttribute("type"));
values.put(CardsTableColumns.TAG_SERIAL, cardElement.getAttribute("id"));
values.put(CardsTableColumns.DATA, xml);
values.put(CardsTableColumns.SCANNED_AT, cardElement.getAttribute("scanned_at"));
return context.getContentResolver().insert(CardProvider.CONTENT_URI_CARD, values);
}
private static String xmlNodeToString(Node node) throws Exception {
// The amount of code required to do simple things in Java is incredible.
Source source = new DOMSource(node);
StringWriter stringWriter = new StringWriter();
Result result = new StreamResult(stringWriter);
TransformerFactory factory = TransformerFactory.newInstance();
Transformer transformer = factory.newTransformer();
transformer.setOutputProperty(OutputKeys.INDENT, "yes");
transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2");
transformer.setURIResolver(null);
transformer.transform(source, result);
return stringWriter.getBuffer().toString();
}
} |
/* deque.c */
#include <stdio.h>
#include <stdlib.h>
#define MAX 4
int que[MAX];
int front=0, rear=0;
void add_front(int p)
{
if(front) que[--front]=p;
else puts("Queue Overflow!");
}
void add_rear(int p)
{
if(rear!=MAX) que[rear++]=p;
else puts("Queue Overflow!");
}
int del_front()
{
int ret;
if(front<rear){
ret=que[front++];
if(front==rear) front=rear=0;
return ret;
}
else puts("Queue Underflow!");
return -1;
}
int del_rear()
{
int ret;
if(front<rear){
ret=que[--rear];
if(front==rear) front=rear=0;
return ret;
}
else puts("Queue Underflow!");
return -1;
}
int main()
{
int ch;
int p;
do{
puts("Choose an action ");
puts("0: Exit");
puts("1: Add to FRONT");
puts("2: Add to REAR ");
puts("3: Del from FRONT");
puts("4: Del from REAR ");
scanf(" %u%*c", &ch);
switch(ch){
case 0:
puts("Bye!");
break;
case 1:
scanf(" %d%*c", &p);
add_front(p);
break;
case 2:
scanf(" %d%*c", &p);
add_rear(p);
break;
case 3:
if((p=del_front())!=-1) printf("%d\n", p);
break;
case 4:
if((p=del_rear())!=-1) printf("%d\n", p);
break;
default:
puts("Invalid Input!");
break;
}
putchar('\n');
} while(ch);
return 0;
}
/* end of deque.c */ |
FROM node:6
# Create sentimeter directory
RUN mkdir -p /sentimeter/data
WORKDIR /sentimeter
# Variables
ENV NODE_ENV production
ENV DATABASE_HOST localhost
ENV DATABASE_NAME application
ENV DATABASE_USER root
ENV DATABASE_PASSWORD root
ENV DATABASE_PORT 3306
ENV DATABASE_DIALECT mysql
ENV DATABASE_STORAGE ./production.sentimeter.sqlite
ENV LOGGING false
# Install
COPY . /sentimeter
RUN npm install .
RUN npm install sequelize-cli
RUN node_modules/.bin/sequelize db:migrate
# RUN ls -la node_modules/.bin
# COPY config-docker.json /sentimeter/config/config.json
VOLUME /sentimeter/data
EXPOSE 8080
CMD ["node", "index.js"] |
using System;
using System.Collections.Generic;
using Microsoft.EntityFrameworkCore.Migrations;
namespace bukascore.Migrations
{
public partial class <API key> : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "<API key>",
table: "Teams");
migrationBuilder.DropForeignKey(
name: "<API key>",
table: "Tournaments");
migrationBuilder.DropIndex(
name: "<API key>",
table: "Teams");
migrationBuilder.DropColumn(
name: "TournamentId",
table: "Teams");
migrationBuilder.AlterColumn<int>(
name: "GameId",
table: "Tournaments",
nullable: false,
oldClrType: typeof(int),
oldNullable: true);
migrationBuilder.CreateTable(
name: "TournamentTeam",
columns: table => new
{
TournamentId = table.Column<int>(nullable: false),
TeamId = table.Column<int>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_TournamentTeam", x => new { x.TournamentId, x.TeamId });
table.ForeignKey(
name: "<API key>",
column: x => x.TeamId,
principalTable: "Teams",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "<API key>",
column: x => x.TournamentId,
principalTable: "Tournaments",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "<API key>",
table: "TournamentTeam",
column: "TeamId");
migrationBuilder.AddForeignKey(
name: "<API key>",
table: "Tournaments",
column: "GameId",
principalTable: "Games",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "<API key>",
table: "Tournaments");
migrationBuilder.DropTable(
name: "TournamentTeam");
migrationBuilder.AlterColumn<int>(
name: "GameId",
table: "Tournaments",
nullable: true,
oldClrType: typeof(int));
migrationBuilder.AddColumn<int>(
name: "TournamentId",
table: "Teams",
nullable: true);
migrationBuilder.CreateIndex(
name: "<API key>",
table: "Teams",
column: "TournamentId");
migrationBuilder.AddForeignKey(
name: "<API key>",
table: "Teams",
column: "TournamentId",
principalTable: "Tournaments",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "<API key>",
table: "Tournaments",
column: "GameId",
principalTable: "Games",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
}
}
} |
jQuery( document ).ready( function() {
var cmtApp = cmt.api.root.getApplication( 'core' );
var blogApp = cmt.api.root.getApplication( 'blogCore' );
// Register Controllers
});
cmg.core.controllers.SiteController.prototype.checkUserActionPre = function( requestElement ) {
var event = requestElement.attr( 'data-event' );
switch( event ) {
case 'review': {
}
}
return true;
};
cmg.core.controllers.SiteController.prototype.<API key> = function( requestElement, response ) {
var event = requestElement.attr( 'data-event' );
switch( event ) {
case 'review': {
break;
}
}
};
cmg.core.controllers.SiteController.prototype.<API key> = function( requestElement, response ) {
var event = requestElement.attr( 'data-event' );
switch( event ) {
case 'review': {
//window.location = siteUrl + 'login';
break;
}
}
};
// Ajax Login
cmg.core.controllers.SiteController.prototype.loginActionSuccess = function( requestElement, response ) {
window.location = response.data;
}; |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>themelock.com - Limitless - Responsive Web Application Kit by Eugene Kopyov</title>
<!-- Global stylesheets -->
<link href="https://fonts.googleapis.com/css?family=Roboto:400,300,100,500,700,900" rel="stylesheet" type="text/css">
<link href="assets/css/icons/icomoon/styles.css" rel="stylesheet" type="text/css">
<link href="assets/css/minified/bootstrap.min.css" rel="stylesheet" type="text/css">
<link href="assets/css/minified/core.min.css" rel="stylesheet" type="text/css">
<link href="assets/css/minified/components.min.css" rel="stylesheet" type="text/css">
<link href="assets/css/minified/colors.min.css" rel="stylesheet" type="text/css">
<!-- /global stylesheets -->
<!-- Core JS files -->
<script type="text/javascript" src="assets/js/plugins/loaders/pace.min.js"></script>
<script type="text/javascript" src="assets/js/core/libraries/jquery.min.js"></script>
<script type="text/javascript" src="assets/js/core/libraries/bootstrap.min.js"></script>
<script type="text/javascript" src="assets/js/plugins/loaders/blockui.min.js"></script>
<!-- /core JS files -->
<!-- Theme JS files -->
<script type="text/javascript" src="assets/js/plugins/visualization/d3/d3.min.js"></script>
<script type="text/javascript" src="assets/js/plugins/visualization/d3/d3_tooltip.js"></script>
<script type="text/javascript" src="assets/js/plugins/forms/styling/switchery.min.js"></script>
<script type="text/javascript" src="assets/js/plugins/forms/styling/uniform.min.js"></script>
<script type="text/javascript" src="assets/js/plugins/forms/selects/<API key>.js"></script>
<script type="text/javascript" src="assets/js/plugins/ui/moment/moment.min.js"></script>
<script type="text/javascript" src="assets/js/plugins/pickers/daterangepicker.js"></script>
<script type="text/javascript" src="assets/js/core/app.js"></script>
<script type="text/javascript" src="assets/js/pages/dashboard.js"></script>
<script type="text/javascript" src="assets/js/pages/layout_fixed_native.js"></script>
<!-- /theme JS files -->
</head>
<body class="navbar-top">
<!-- Main navbar -->
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="navbar-header">
<a class="navbar-brand" href="index.html"><img src="assets/images/logo_light.png" alt=""></a>
<ul class="nav navbar-nav visible-xs-block">
<li><a data-toggle="collapse" data-target="#navbar-mobile"><i class="icon-tree5"></i></a></li>
<li><a class="<API key>"><i class="<API key>"></i></a></li>
</ul>
</div>
<div class="navbar-collapse collapse" id="navbar-mobile">
<ul class="nav navbar-nav">
<li><a class="sidebar-control sidebar-main-toggle hidden-xs"><i class="<API key>"></i></a></li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
<i class="icon-git-compare"></i>
<span class="<API key> position-right">Git updates</span>
<span class="badge bg-warning-400">9</span>
</a>
<div class="dropdown-menu dropdown-content">
<div class="<API key>">
Git updates
<ul class="icons-list">
<li><a href="#"><i class="icon-sync"></i></a></li>
</ul>
</div>
<ul class="media-list <API key> width-350">
<li class="media">
<div class="media-left">
<a href="#" class="btn border-primary text-primary btn-flat btn-rounded btn-icon btn-sm"><i class="<API key>"></i></a>
</div>
<div class="media-body">
Drop the IE <a href="#">specific hacks</a> for temporal inputs
<div class="media-annotation">4 minutes ago</div>
</div>
</li>
<li class="media">
<div class="media-left">
<a href="#" class="btn border-warning text-warning btn-flat btn-rounded btn-icon btn-sm"><i class="icon-git-commit"></i></a>
</div>
<div class="media-body">
Add full font overrides for popovers and tooltips
<div class="media-annotation">36 minutes ago</div>
</div>
</li>
<li class="media">
<div class="media-left">
<a href="#" class="btn border-info text-info btn-flat btn-rounded btn-icon btn-sm"><i class="icon-git-branch"></i></a>
</div>
<div class="media-body">
<a href="#">Chris Arney</a> created a new <span class="text-semibold">Design</span> branch
<div class="media-annotation">2 hours ago</div>
</div>
</li>
<li class="media">
<div class="media-left">
<a href="#" class="btn border-success text-success btn-flat btn-rounded btn-icon btn-sm"><i class="icon-git-merge"></i></a>
</div>
<div class="media-body">
<a href="#">Eugene Kopyov</a> merged <span class="text-semibold">Master</span> and <span class="text-semibold">Dev</span> branches
<div class="media-annotation">Dec 18, 18:36</div>
</div>
</li>
<li class="media">
<div class="media-left">
<a href="#" class="btn border-primary text-primary btn-flat btn-rounded btn-icon btn-sm"><i class="<API key>"></i></a>
</div>
<div class="media-body">
Have Carousel ignore keyboard events
<div class="media-annotation">Dec 12, 05:46</div>
</div>
</li>
</ul>
<div class="<API key>">
<a href="#" data-popup="tooltip" title="All activity"><i class="icon-menu display-block"></i></a>
</div>
</div>
</li>
</ul>
<p class="navbar-text"><span class="label bg-success-400">Online</span></p>
<ul class="nav navbar-nav navbar-right">
<li class="dropdown language-switch">
<a class="dropdown-toggle" data-toggle="dropdown">
<img src="assets/images/flags/gb.png" class="position-left" alt="">
English
<span class="caret"></span>
</a>
<ul class="dropdown-menu">
<li><a class="deutsch"><img src="assets/images/flags/de.png" alt=""> Deutsch</a></li>
<li><a class="ukrainian"><img src="assets/images/flags/ua.png" alt=""> Українська</a></li>
<li><a class="english"><img src="assets/images/flags/gb.png" alt=""> English</a></li>
<li><a class="espana"><img src="assets/images/flags/es.png" alt=""> España</a></li>
<li><a class="russian"><img src="assets/images/flags/ru.png" alt=""> Русский</a></li>
</ul>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
<i class="icon-bubbles4"></i>
<span class="<API key> position-right">Messages</span>
<span class="badge bg-warning-400">2</span>
</a>
<div class="dropdown-menu dropdown-content width-350">
<div class="<API key>">
Messages
<ul class="icons-list">
<li><a href="#"><i class="icon-compose"></i></a></li>
</ul>
</div>
<ul class="media-list <API key>">
<li class="media">
<div class="media-left">
<img src="assets/images/placeholder.jpg" class="img-circle img-sm" alt="">
<span class="badge bg-danger-400 media-badge">5</span>
</div>
<div class="media-body">
<a href="#" class="media-heading">
<span class="text-semibold">James Alexander</span>
<span class="media-annotation pull-right">04:58</span>
</a>
<span class="text-muted">who knows, maybe that would be the best thing for me...</span>
</div>
</li>
<li class="media">
<div class="media-left">
<img src="assets/images/placeholder.jpg" class="img-circle img-sm" alt="">
<span class="badge bg-danger-400 media-badge">4</span>
</div>
<div class="media-body">
<a href="#" class="media-heading">
<span class="text-semibold">Margo Baker</span>
<span class="media-annotation pull-right">12:16</span>
</a>
<span class="text-muted">That was something he was unable to do because...</span>
</div>
</li>
<li class="media">
<div class="media-left"><img src="assets/images/placeholder.jpg" class="img-circle img-sm" alt=""></div>
<div class="media-body">
<a href="#" class="media-heading">
<span class="text-semibold">Jeremy Victorino</span>
<span class="media-annotation pull-right">22:48</span>
</a>
<span class="text-muted">But that would be extremely strained and suspicious...</span>
</div>
</li>
<li class="media">
<div class="media-left"><img src="assets/images/placeholder.jpg" class="img-circle img-sm" alt=""></div>
<div class="media-body">
<a href="#" class="media-heading">
<span class="text-semibold">Beatrix Diaz</span>
<span class="media-annotation pull-right">Tue</span>
</a>
<span class="text-muted">What a strenuous career it is that I've chosen...</span>
</div>
</li>
<li class="media">
<div class="media-left"><img src="assets/images/placeholder.jpg" class="img-circle img-sm" alt=""></div>
<div class="media-body">
<a href="#" class="media-heading">
<span class="text-semibold">Richard Vango</span>
<span class="media-annotation pull-right">Mon</span>
</a>
<span class="text-muted">Other travelling salesmen live a life of luxury...</span>
</div>
</li>
</ul>
<div class="<API key>">
<a href="#" data-popup="tooltip" title="All messages"><i class="icon-menu display-block"></i></a>
</div>
</div>
</li>
<li class="dropdown dropdown-user">
<a class="dropdown-toggle" data-toggle="dropdown">
<img src="assets/images/placeholder.jpg" alt="">
<span>Victoria</span>
<i class="caret"></i>
</a>
<ul class="dropdown-menu dropdown-menu-right">
<li><a href="#"><i class="icon-user-plus"></i> My profile</a></li>
<li><a href="#"><i class="icon-coins"></i> My balance</a></li>
<li><a href="#"><span class="badge bg-teal-400 pull-right">58</span> <i class="<API key>"></i> Messages</a></li>
<li class="divider"></li>
<li><a href="#"><i class="icon-cog5"></i> Account settings</a></li>
<li><a href="#"><i class="icon-switch2"></i> Logout</a></li>
</ul>
</li>
</ul>
</div>
</div>
<!-- /main navbar -->
<!-- Page container -->
<div class="page-container">
<!-- Page content -->
<div class="page-content">
<!-- Main sidebar -->
<div class="sidebar sidebar-main sidebar-fixed">
<div class="sidebar-content">
<!-- User menu -->
<div class="sidebar-user">
<div class="category-content">
<div class="media">
<a href="#" class="media-left"><img src="assets/images/placeholder.jpg" class="img-circle img-sm" alt=""></a>
<div class="media-body">
<span class="media-heading text-semibold">Victoria Baker</span>
<div class="text-size-mini text-muted">
<i class="icon-pin text-size-small"></i> Santa Ana, CA
</div>
</div>
<div class="media-right media-middle">
<ul class="icons-list">
<li>
<a href="#"><i class="icon-cog3"></i></a>
</li>
</ul>
</div>
</div>
</div>
</div>
<!-- /user menu -->
<!-- Main navigation -->
<div class="sidebar-category <API key>">
<div class="category-content no-padding">
<ul class="navigation navigation-main <API key>">
<!-- Main -->
<li class="navigation-header"><span>Main</span> <i class="icon-menu" title="Main pages"></i></li>
<li><a href="index.html"><i class="icon-home4"></i> <span>Dashboard</span></a></li>
<li>
<a href="#"><i class="icon-stack2"></i> <span>Page layouts</span></a>
<ul>
<li><a href="layout_navbar_fixed.html">Fixed navbar</a></li>
<li><a href="<API key>.html">Fixed navbar & sidebar</a></li>
<li class="active"><a href="<API key>.html">Fixed sidebar native scroll</a></li>
<li><a href="<API key>.html">Hideable navbar</a></li>
<li><a href="<API key>.html">Hideable & fixed sidebar</a></li>
<li><a href="layout_footer_fixed.html">Fixed footer</a></li>
<li class="navigation-divider"></li>
<li><a href="boxed_default.html">Boxed with default sidebar</a></li>
<li><a href="boxed_mini.html">Boxed with mini sidebar</a></li>
<li><a href="boxed_full.html">Boxed full width</a></li>
</ul>
</li>
<li>
<a href="#"><i class="icon-copy"></i> <span>Layouts</span></a>
<ul>
<li><a href="index.html" id="layout1">Layout 1 <span class="label bg-warning-400">Current</span></a></li>
<li><a href="../../layout_2/LTR/index.html" id="layout2">Layout 2</a></li>
<li><a href="../../layout_3/LTR/index.html" id="layout3">Layout 3</a></li>
<li><a href="../../layout_4/LTR/index.html" id="layout4">Layout 4</a></li>
<li class="disabled"><a href="../../layout_5/LTR/index.html" id="layout5">Layout 5 <span class="label">Coming soon</span></a></li>
</ul>
</li>
<li>
<a href="#"><i class="icon-droplet2"></i> <span>Color system</span></a>
<ul>
<li><a href="colors_primary.html">Primary palette</a></li>
<li><a href="colors_danger.html">Danger palette</a></li>
<li><a href="colors_success.html">Success palette</a></li>
<li><a href="colors_warning.html">Warning palette</a></li>
<li><a href="colors_info.html">Info palette</a></li>
<li class="navigation-divider"></li>
<li><a href="colors_pink.html">Pink palette</a></li>
<li><a href="colors_violet.html">Violet palette</a></li>
<li><a href="colors_purple.html">Purple palette</a></li>
<li><a href="colors_indigo.html">Indigo palette</a></li>
<li><a href="colors_blue.html">Blue palette</a></li>
<li><a href="colors_teal.html">Teal palette</a></li>
<li><a href="colors_green.html">Green palette</a></li>
<li><a href="colors_orange.html">Orange palette</a></li>
<li><a href="colors_brown.html">Brown palette</a></li>
<li><a href="colors_grey.html">Grey palette</a></li>
<li><a href="colors_slate.html">Slate palette</a></li>
</ul>
</li>
<li>
<a href="#"><i class="icon-stack"></i> <span>Starter kit</span></a>
<ul>
<li><a href="starters/horizontal_nav.html">Horizontal navigation</a></li>
<li><a href="starters/1_col.html">1 column</a></li>
<li><a href="starters/2_col.html">2 columns</a></li>
<li>
<a href="#">3 columns</a>
<ul>
<li><a href="starters/3_col_dual.html">Dual sidebars</a></li>
<li><a href="starters/3_col_double.html">Double sidebars</a></li>
</ul>
</li>
<li><a href="starters/4_col.html">4 columns</a></li>
<li>
<a href="#">Detached layout</a>
<ul>
<li><a href="starters/detached_left.html">Left sidebar</a></li>
<li><a href="starters/detached_right.html">Right sidebar</a></li>
<li><a href="starters/detached_sticky.html">Sticky sidebar</a></li>
</ul>
</li>
<li><a href="starters/layout_boxed.html">Boxed layout</a></li>
<li class="navigation-divider"></li>
<li><a href="starters/<API key>.html">Fixed main navbar</a></li>
<li><a href="starters/<API key>.html">Fixed secondary navbar</a></li>
<li><a href="starters/<API key>.html">Both navbars fixed</a></li>
<li><a href="starters/layout_fixed.html">Fixed layout</a></li>
</ul>
</li>
<li><a href="changelog.html"><i class="icon-list-unordered"></i> <span>Changelog</span></a></li>
<!-- /main -->
<!-- Forms -->
<li class="navigation-header"><span>Forms</span> <i class="icon-menu" title="Forms"></i></li>
<li>
<a href="#"><i class="icon-pencil3"></i> <span>Form components</span></a>
<ul>
<li><a href="form_inputs_basic.html">Basic inputs</a></li>
<li><a href="<API key>.html">Checkboxes & radios</a></li>
<li><a href="form_input_groups.html">Input groups</a></li>
<li><a href="<API key>.html">Extended controls</a></li>
<li>
<a href="#">Selects</a>
<ul>
<li><a href="form_select2.html">Select2 selects</a></li>
<li><a href="form_multiselect.html">Bootstrap multiselect</a></li>
<li><a href="form_select_box_it.html">SelectBoxIt selects</a></li>
<li><a href="<API key>.html">Bootstrap selects</a></li>
</ul>
</li>
<li><a href="form_tag_inputs.html">Tag inputs</a></li>
<li><a href="form_dual_listboxes.html">Dual Listboxes</a></li>
<li><a href="form_editable.html">Editable forms</a></li>
<li><a href="form_validation.html">Validation</a></li>
<li><a href="form_inputs_grid.html">Inputs grid</a></li>
</ul>
</li>
<li>
<a href="#"><i class="icon-footprint"></i> <span>Wizards</span></a>
<ul>
<li><a href="wizard_steps.html">Steps wizard</a></li>
<li><a href="wizard_form.html">Form wizard</a></li>
<li><a href="wizard_stepy.html">Stepy wizard</a></li>
</ul>
</li>
<li>
<a href="#"><i class="icon-spell-check"></i> <span>Editors</span></a>
<ul>
<li><a href="editor_summernote.html">Summernote editor</a></li>
<li><a href="editor_ckeditor.html">CKEditor</a></li>
<li><a href="editor_wysihtml5.html">WYSIHTML5 editor</a></li>
<li><a href="editor_code.html">Code editor</a></li>
</ul>
</li>
<li>
<a href="#"><i class="icon-select2"></i> <span>Pickers</span></a>
<ul>
<li><a href="picker_date.html">Date & time pickers</a></li>
<li><a href="picker_color.html">Color pickers</a></li>
<li><a href="picker_location.html">Location pickers</a></li>
</ul>
</li>
<li>
<a href="#"><i class="<API key>"></i> <span>Form layouts</span></a>
<ul>
<li><a href="<API key>.html">Vertical form</a></li>
<li><a href="<API key>.html">Horizontal form</a></li>
</ul>
</li>
<!-- /forms -->
<!-- Appearance -->
<li class="navigation-header"><span>Appearance</span> <i class="icon-menu" title="Appearance"></i></li>
<li>
<a href="#"><i class="icon-grid"></i> <span>Components</span></a>
<ul>
<li><a href="components_modals.html">Modals</a></li>
<li><a href="<API key>.html">Dropdown menus</a></li>
<li><a href="components_tabs.html">Tabs component</a></li>
<li><a href="components_pills.html">Pills component</a></li>
<li><a href="components_navs.html">Accordion and navs</a></li>
<li><a href="components_buttons.html">Buttons</a></li>
<li><a href="<API key>.html">PNotify notifications</a></li>
<li><a href="<API key>.html">Other notifications</a></li>
<li><a href="components_popups.html">Tooltips and popovers</a></li>
<li><a href="components_alerts.html">Alerts</a></li>
<li><a href="<API key>.html">Pagination</a></li>
<li><a href="components_labels.html">Labels and badges</a></li>
<li><a href="components_loaders.html">Loaders and bars</a></li>
<li><a href="<API key>.html">Thumbnails</a></li>
<li><a href="<API key>.html">Page header</a></li>
<li><a href="<API key>.html">Breadcrumbs</a></li>
<li><a href="components_media.html">Media objects</a></li>
<li><a href="components_sliders.html">Slider components</a></li>
</ul>
</li>
<li>
<a href="#"><i class="icon-puzzle2"></i> <span>Content appearance</span></a>
<ul>
<li><a href="<API key>.html">Content panels</a></li>
<li><a href="<API key>.html">Panel heading elements</a></li>
<li><a href="<API key>.html">Draggable panels</a></li>
<li><a href="<API key>.html">Text styling</a></li>
<li><a href="<API key>.html">Typography</a></li>
<li><a href="appearance_helpers.html">Helper classes</a></li>
<li><a href="<API key>.html">Syntax highlighter</a></li>
<li><a href="<API key>.html">Grid system</a></li>
</ul>
</li>
<li><a href="<API key>.html"><i class="icon-spinner3 spinner"></i> <span>CSS3 animations</span></a></li>
<li>
<a href="#"><i class="icon-gift"></i> <span>Extra components</span></a>
<ul>
<li><a href="extra_affix.html">Affix and Scrollspy</a></li>
<li><a href="<API key>.html">Session timeout</a></li>
<li><a href="extra_idle_timeout.html">Idle timeout</a></li>
<li><a href="extra_trees.html">Dynamic tree views</a></li>
<li><a href="extra_context_menu.html">Context menu</a></li>
</ul>
</li>
<li>
<a href="#"><i class="icon-thumbs-up2"></i> <span>Icons</span></a>
<ul>
<li><a href="icons_glyphicons.html">Glyphicons</a></li>
<li><a href="icons_icomoon.html">Icomoon</a></li>
<li><a href="icons_fontawesome.html">Font awesome</a></li>
</ul>
</li>
<!-- /appearance -->
<!-- Layout -->
<li class="navigation-header"><span>Layout</span> <i class="icon-menu" title="Layout options"></i></li>
<li>
<a href="#"><i class="<API key>"></i> <span>Sidebars</span></a>
<ul>
<li><a href="<API key>.html">Default collapsible</a></li>
<li><a href="<API key>.html">Default hideable</a></li>
<li><a href="<API key>.html">Mini collapsible</a></li>
<li><a href="sidebar_mini_hide.html">Mini hideable</a></li>
<li>
<a href="#">Dual sidebar</a>
<ul>
<li><a href="sidebar_dual.html">Dual sidebar</a></li>
<li><a href="<API key>.html">Dual double collapse</a></li>
<li><a href="<API key>.html">Dual double hide</a></li>
<li><a href="sidebar_dual_swap.html">Swap sidebars</a></li>
</ul>
</li>
<li>
<a href="#">Double sidebar</a>
<ul>
<li><a href="<API key>.html">Collapse main sidebar</a></li>
<li><a href="sidebar_double_hide.html">Hide main sidebar</a></li>
<li><a href="<API key>.html">Fix default width</a></li>
<li><a href="<API key>.html">Fix mini width</a></li>
<li><a href="<API key>.html">Opposite sidebar visible</a></li>
</ul>
</li>
<li>
<a href="#">Detached sidebar</a>
<ul>
<li><a href="<API key>.html">Left position</a></li>
<li><a href="<API key>.html">Right position</a></li>
<li><a href="<API key>.html">Sticky (custom scroll)</a></li>
<li><a href="<API key>.html">Sticky (native scroll)</a></li>
<li><a href="<API key>.html">Separate categories</a></li>
</ul>
</li>
<li><a href="sidebar_hidden.html">Hidden sidebar</a></li>
<li><a href="sidebar_light.html">Light sidebar</a></li>
<li><a href="sidebar_components.html">Sidebar components</a></li>
</ul>
</li>
<li>
<a href="#"><i class="icon-sort"></i> <span>Vertical navigation</span></a>
<ul>
<li><a href="<API key>.html">Collapsible menu</a></li>
<li><a href="<API key>.html">Accordion menu</a></li>
<li><a href="<API key>.html">Navigation sizing</a></li>
<li><a href="<API key>.html">Bordered navigation</a></li>
<li><a href="<API key>.html">Right icons</a></li>
<li><a href="<API key>.html">Disabled navigation links</a></li>
</ul>
</li>
<li>
<a href="#"><i class="icon-transmission"></i> <span>Horizontal navigation</span></a>
<ul>
<li><a href="<API key>.html">Submenu on click</a></li>
<li><a href="<API key>.html">Submenu on hover</a></li>
<li><a href="<API key>.html">With custom elements</a></li>
<li><a href="<API key>.html">Tabbed navigation</a></li>
<li><a href="<API key>.html">Disabled navigation links</a></li>
<li><a href="<API key>.html">Horizontal mega menu</a></li>
</ul>
</li>
<li>
<a href="#"><i class="icon-menu3"></i> <span>Navbars</span></a>
<ul>
<li><a href="navbar_single.html">Single navbar</a></li>
<li>
<a href="#">Multiple navbars</a>
<ul>
<li><a href="<API key>.html">Navbar + navbar</a></li>
<li><a href="<API key>.html">Navbar + header</a></li>
<li><a href="<API key>.html">Header + navbar</a></li>
<li><a href="<API key>.html">Top + bottom</a></li>
</ul>
</li>
<li><a href="navbar_colors.html">Color options</a></li>
<li><a href="navbar_sizes.html">Sizing options</a></li>
<li><a href="navbar_hideable.html">Hide on scroll</a></li>
<li><a href="navbar_components.html">Navbar components</a></li>
</ul>
</li>
<li>
<a href="#"><i class="icon-tree5"></i> <span>Menu levels</span></a>
<ul>
<li><a href="#"><i class="icon-IE"></i> Second level</a></li>
<li>
<a href="#"><i class="icon-firefox"></i> Second level with child</a>
<ul>
<li><a href="#"><i class="icon-android"></i> Third level</a></li>
<li>
<a href="#"><i class="icon-apple2"></i> Third level with child</a>
<ul>
<li><a href="#"><i class="icon-html5"></i> Fourth level</a></li>
<li><a href="#"><i class="icon-css3"></i> Fourth level</a></li>
</ul>
</li>
<li><a href="#"><i class="icon-windows"></i> Third level</a></li>
</ul>
</li>
<li><a href="#"><i class="icon-chrome"></i> Second level</a></li>
</ul>
</li>
<!-- /layout -->
<!-- Data visualization -->
<li class="navigation-header"><span>Data visualization</span> <i class="icon-menu" title="Data visualization"></i></li>
<li>
<a href="#"><i class="icon-graph"></i> <span>Echarts library</span></a>
<ul>
<li><a href="echarts_lines_areas.html">Lines and areas</a></li>
<li><a href="<API key>.html">Columns and waterfalls</a></li>
<li><a href="<API key>.html">Bars and tornados</a></li>
<li><a href="echarts_scatter.html">Scatter charts</a></li>
<li><a href="echarts_pies_donuts.html">Pies and donuts</a></li>
<li><a href="<API key>.html">Funnels and chords</a></li>
<li><a href="<API key>.html">Candlesticks and others</a></li>
<li><a href="<API key>.html">Chart combinations</a></li>
</ul>
</li>
<li>
<a href="#"><i class="icon-statistics"></i> <span>D3 library</span></a>
<ul>
<li><a href="d3_lines_basic.html">Simple lines</a></li>
<li><a href="d3_lines_advanced.html">Advanced lines</a></li>
<li><a href="d3_bars_basic.html">Simple bars</a></li>
<li><a href="d3_bars_advanced.html">Advanced bars</a></li>
<li><a href="d3_pies.html">Pie charts</a></li>
<li><a href="d3_circle_diagrams.html">Circle diagrams</a></li>
<li><a href="d3_tree.html">Tree layout</a></li>
<li><a href="d3_other.html">Other charts</a></li>
</ul>
</li>
<li>
<a href="#"><i class="icon-stats-dots"></i> <span>Dimple library</span></a>
<ul>
<li>
<a href="#">Line charts</a>
<ul>
<li><a href="<API key>.html">Horizontal orientation</a></li>
<li><a href="<API key>.html">Vertical orientation</a></li>
</ul>
</li>
<li>
<a href="#">Bar charts</a>
<ul>
<li><a href="<API key>.html">Horizontal orientation</a></li>
<li><a href="<API key>.html">Vertical orientation</a></li>
</ul>
</li>
<li>
<a href="#">Area charts</a>
<ul>
<li><a href="<API key>.html">Horizontal orientation</a></li>
<li><a href="<API key>.html">Vertical orientation</a></li>
</ul>
</li>
<li>
<a href="#">Step charts</a>
<ul>
<li><a href="<API key>.html">Horizontal orientation</a></li>
<li><a href="<API key>.html">Vertical orientation</a></li>
</ul>
</li>
<li><a href="dimple_pies.html">Pie charts</a></li>
<li><a href="dimple_rings.html">Ring charts</a></li>
<li><a href="dimple_scatter.html">Scatter charts</a></li>
<li><a href="dimple_bubble.html">Bubble charts</a></li>
</ul>
</li>
<li>
<a href="#"><i class="icon-stats-bars"></i> <span>C3 library</span></a>
<ul>
<li><a href="c3_lines_areas.html">Lines and areas</a></li>
<li><a href="c3_bars_pies.html">Bars and pies</a></li>
<li><a href="c3_advanced.html">Advanced examples</a></li>
<li><a href="c3_axis.html">Chart axis</a></li>
<li><a href="c3_grid.html">Grid options</a></li>
</ul>
</li>
<li>
<a href="#"><i class="icon-google"></i> <span>Google visualization</span></a>
<ul>
<li><a href="google_lines.html">Line charts</a></li>
<li><a href="google_bars.html">Bar charts</a></li>
<li><a href="google_pies.html">Pie charts</a></li>
<li><a href="<API key>.html">Bubble & scatter charts</a></li>
<li><a href="google_other.html">Other charts</a></li>
</ul>
</li>
<li>
<a href="#"><i class="icon-map5"></i> <span>Maps integration</span></a>
<ul>
<li>
<a href="#">Google maps</a>
<ul>
<li><a href="maps_google_basic.html">Basics</a></li>
<li><a href="<API key>.html">Controls</a></li>
<li><a href="maps_google_markers.html">Markers</a></li>
<li><a href="<API key>.html">Map drawings</a></li>
<li><a href="maps_google_layers.html">Layers</a></li>
</ul>
</li>
<li><a href="maps_vector.html">Vector maps</a></li>
</ul>
</li>
<!-- /data visualization -->
<!-- Extensions -->
<li class="navigation-header"><span>Extensions</span> <i class="icon-menu" title="Extensions"></i></li>
<li>
<a href="#"><i class="icon-spinner10 spinner"></i> <span>Velocity animations</span></a>
<ul>
<li><a href="<API key>.html">Basic usage</a></li>
<li><a href="<API key>.html">UI pack effects</a></li>
<li><a href="<API key>.html">Advanced examples</a></li>
</ul>
</li>
<li><a href="extension_blockui.html"><i class="icon-history"></i> <span>Block UI</span></a></li>
<li>
<a href="#"><i class="icon-upload"></i> <span>File uploaders</span></a>
<ul>
<li><a href="uploader_plupload.html">Plupload</a></li>
<li><a href="uploader_bootstrap.html">Bootstrap file uploader</a></li>
<li><a href="uploader_dropzone.html">Dropzone</a></li>
</ul>
</li>
<li><a href="<API key>.html"><i class="icon-crop2"></i> <span>Image cropper</span></a></li>
<li>
<a href="#"><i class="icon-calendar3"></i> <span>Event calendars</span></a>
<ul>
<li><a href="<API key>.html">Basic views</a></li>
<li><a href="<API key>.html">Event styling</a></li>
<li><a href="<API key>.html">Language and time</a></li>
<li><a href="<API key>.html">Advanced usage</a></li>
</ul>
</li>
<li>
<a href="#"><i class="icon-sphere"></i> <span><API key></span></a>
<ul>
<li><a href="<API key>.html">Direct translation</a></li>
<li><a href="<API key>.html">Querystring parameter</a></li>
<li><a href="<API key>.html">Set language on init</a></li>
<li><a href="<API key>.html">Set language after init</a></li>
<li><a href="<API key>.html">Language fallback</a></li>
<li><a href="<API key>.html">Callbacks</a></li>
</ul>
</li>
<!-- /extensions -->
<!-- Tables -->
<li class="navigation-header"><span>Tables</span> <i class="icon-menu" title="Tables"></i></li>
<li>
<a href="#"><i class="icon-table2"></i> <span>Basic tables</span></a>
<ul>
<li><a href="table_basic.html">Basic examples</a></li>
<li><a href="table_sizing.html">Table sizing</a></li>
<li><a href="table_borders.html">Table borders</a></li>
<li><a href="table_styling.html">Table styling</a></li>
<li><a href="table_elements.html">Table elements</a></li>
</ul>
</li>
<li>
<a href="#"><i class="icon-grid7"></i> <span>Data tables</span></a>
<ul>
<li><a href="datatable_basic.html">Basic initialization</a></li>
<li><a href="datatable_styling.html">Basic styling</a></li>
<li><a href="datatable_advanced.html">Advanced examples</a></li>
<li><a href="datatable_sorting.html">Sorting options</a></li>
<li><a href="datatable_api.html">Using API</a></li>
<li><a href="<API key>.html">Data sources</a></li>
</ul>
</li>
<li>
<a href="#"><i class="<API key>"></i> <span>Data tables extensions</span></a>
<ul>
<li><a href="<API key>.html">Columns reorder</a></li>
<li><a href="<API key>.html">Fixed columns</a></li>
<li><a href="<API key>.html">Columns visibility</a></li>
<li><a href="<API key>.html">Table tools</a></li>
<li><a href="<API key>.html">Scroller</a></li>
</ul>
</li>
<li>
<a href="#"><i class="icon-versions"></i> <span>Responsive options</span></a>
<ul>
<li><a href="table_responsive.html">Responsive basic tables</a></li>
<li><a href="<API key>.html">Responsive data tables</a></li>
</ul>
</li>
<!-- /tables -->
<!-- Page kits -->
<li class="navigation-header"><span>Page kits</span> <i class="icon-menu" title="Page kits"></i></li>
<li>
<a href="#"><i class="icon-task"></i> <span>Task manager</span></a>
<ul>
<li><a href="task_manager_grid.html">Task grid</a></li>
<li><a href="task_manager_list.html">Task list</a></li>
<li><a href="<API key>.html">Task detailed</a></li>
</ul>
</li>
<li>
<a href="#"><i class="icon-cash3"></i> <span>Invoicing</span></a>
<ul>
<li><a href="invoice_template.html">Invoice template</a></li>
<li><a href="invoice_grid.html">Invoice grid</a></li>
<li><a href="invoice_archive.html">Invoice archive</a></li>
</ul>
</li>
<li>
<a href="#"><i class="icon-people"></i> <span>User pages</span></a>
<ul>
<li><a href="user_pages_cards.html">User cards</a></li>
<li><a href="user_pages_list.html">User list</a></li>
<li><a href="user_pages_profile.html">Simple profile</a></li>
<li><a href="<API key>.html">Profile with cover</a></li>
</ul>
</li>
<li>
<a href="#"><i class="icon-user-plus"></i> <span>Login & registration</span></a>
<ul>
<li><a href="login_simple.html">Simple login</a></li>
<li><a href="login_advanced.html">More login info</a></li>
<li><a href="login_registration.html">Simple registration</a></li>
<li><a href="<API key>.html">More registration info</a></li>
<li><a href="login_unlock.html">Unlock user</a></li>
<li><a href="<API key>.html">Reset password</a></li>
<li><a href="login_hide_navbar.html">Hide navbar</a></li>
<li><a href="login_transparent.html">Transparent box</a></li>
<li><a href="login_background.html">Background option</a></li>
</ul>
</li>
<li>
<a href="#"><i class="icon-magazine"></i> <span>Timelines</span></a>
<ul>
<li><a href="timelines_left.html">Left timeline</a></li>
<li><a href="timelines_right.html">Right timeline</a></li>
<li><a href="timelines_center.html">Centered timeline</a></li>
</ul>
</li>
<li>
<a href="#"><i class="icon-lifebuoy"></i> <span>Support</span></a>
<ul>
<li><a href="<API key>.html">Conversation layouts</a></li>
<li><a href="<API key>.html">Conversation options</a></li>
<li><a href="<API key>.html">Knowledgebase</a></li>
<li><a href="support_faq.html">FAQ page</a></li>
</ul>
</li>
<li>
<a href="#"><i class="icon-search4"></i> <span>Search</span></a>
<ul>
<li><a href="search_basic.html">Basic search results</a></li>
<li><a href="search_users.html">User search results</a></li>
<li><a href="search_images.html">Image search results</a></li>
<li><a href="search_videos.html">Video search results</a></li>
</ul>
</li>
<li>
<a href="#"><i class="icon-images2"></i> <span>Gallery</span></a>
<ul>
<li><a href="gallery_grid.html">Media grid</a></li>
<li><a href="gallery_titles.html">Media with titles</a></li>
<li><a href="gallery_description.html">Media with description</a></li>
<li><a href="gallery_library.html">Media library</a></li>
</ul>
</li>
<li>
<a href="#"><i class="icon-warning"></i> <span>Error pages</span></a>
<ul>
<li><a href="error_403.html">Error 403</a></li>
<li><a href="error_404.html">Error 404</a></li>
<li><a href="error_405.html">Error 405</a></li>
<li><a href="error_500.html">Error 500</a></li>
<li><a href="error_503.html">Error 503</a></li>
<li><a href="error_offline.html">Offline page</a></li>
</ul>
</li>
<!-- /page kits -->
</ul>
</div>
</div>
<!-- /main navigation -->
</div>
</div>
<!-- /main sidebar -->
<!-- Main content -->
<div class="content-wrapper">
<!-- Page header -->
<div class="page-header">
<div class="page-header-content">
<div class="page-title">
<h4><i class="icon-arrow-left52 position-left"></i> <span class="text-semibold">Home</span> - Dashboard</h4>
</div>
<div class="heading-elements">
<div class="heading-btn-group">
<a href="#" class="btn btn-link btn-float has-text"><i class="icon-bars-alt text-primary"></i><span>Statistics</span></a>
<a href="#" class="btn btn-link btn-float has-text"><i class="icon-calculator text-primary"></i> <span>Invoices</span></a>
<a href="#" class="btn btn-link btn-float has-text"><i class="icon-calendar5 text-primary"></i> <span>Schedule</span></a>
</div>
</div>
</div>
<div class="breadcrumb-line">
<ul class="breadcrumb">
<li><a href="index.html"><i class="icon-home2 position-left"></i> Home</a></li>
<li><a href="index.html">Home</a></li>
<li class="active">Dashboard</li>
</ul>
<ul class="breadcrumb-elements">
<li><a href="#"><i class="<API key> position-left"></i> Support</a></li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
<i class="icon-gear position-left"></i>
Settings
<span class="caret"></span>
</a>
<ul class="dropdown-menu dropdown-menu-right">
<li><a href="#"><i class="icon-user-lock"></i> Account security</a></li>
<li><a href="#"><i class="icon-statistics"></i> Analytics</a></li>
<li><a href="#"><i class="icon-accessibility"></i> Accessibility</a></li>
<li class="divider"></li>
<li><a href="#"><i class="icon-gear"></i> All settings</a></li>
</ul>
</li>
</ul>
</div>
</div>
<!-- /page header -->
<!-- Content area -->
<div class="content">
<!-- Main charts -->
<div class="row">
<div class="col-lg-7">
<!-- Traffic sources -->
<div class="panel panel-flat">
<div class="panel-heading">
<h6 class="panel-title">Traffic sources</h6>
<div class="heading-elements">
<form class="heading-form" action="
<div class="form-group">
<label class="checkbox-inline checkbox-switchery checkbox-right switchery-xs">
<input type="checkbox" class="switch" checked="checked">
Live update:
</label>
</div>
</form>
</div>
</div>
<div class="container-fluid">
<div class="row">
<div class="col-lg-4">
<ul class="list-inline text-center">
<li>
<a href="#" class="btn border-teal text-teal btn-flat btn-rounded btn-icon btn-xs valign-text-bottom"><i class="icon-plus3"></i></a>
</li>
<li class="text-left">
<div class="text-semibold">New visitors</div>
<div class="text-muted">2,349 avg</div>
</li>
</ul>
<div class="col-lg-10 col-lg-offset-1">
<div class="content-group" id="new-visitors"></div>
</div>
</div>
<div class="col-lg-4">
<ul class="list-inline text-center">
<li>
<a href="#" class="btn border-warning-400 text-warning-400 btn-flat btn-rounded btn-icon btn-xs valign-text-bottom"><i class="icon-watch2"></i></a>
</li>
<li class="text-left">
<div class="text-semibold">New sessions</div>
<div class="text-muted">08:20 avg</div>
</li>
</ul>
<div class="col-lg-10 col-lg-offset-1">
<div class="content-group" id="new-sessions"></div>
</div>
</div>
<div class="col-lg-4">
<ul class="list-inline text-center">
<li>
<a href="#" class="btn border-indigo-400 text-indigo-400 btn-flat btn-rounded btn-icon btn-xs valign-text-bottom"><i class="icon-people"></i></a>
</li>
<li class="text-left">
<div class="text-semibold">Total online</div>
<div class="text-muted"><span class="status-mark border-success position-left"></span> 5,378 avg</div>
</li>
</ul>
<div class="col-lg-10 col-lg-offset-1">
<div class="content-group" id="total-online"></div>
</div>
</div>
</div>
</div>
<div class="position-relative" id="traffic-sources"></div>
</div>
<!-- /traffic sources -->
</div>
<div class="col-lg-5">
<!-- Sales stats -->
<div class="panel panel-flat">
<div class="panel-heading">
<h6 class="panel-title">Sales statistics</h6>
<div class="heading-elements">
<form class="heading-form" action="
<div class="form-group">
<select class="change-date select-sm" id="select_date">
<optgroup label="<i class='icon-watch pull-right'></i> Time period">
<option value="val1">June, 29 - July, 5</option>
<option value="val2">June, 22 - June 28</option>
<option value="val3" selected="selected">June, 15 - June, 21</option>
<option value="val4">June, 8 - June, 14</option>
</optgroup>
</select>
</div>
</form>
</div>
</div>
<div class="container-fluid">
<div class="row text-center">
<div class="col-md-4">
<div class="content-group">
<h5 class="text-semibold no-margin"><i class="icon-calendar5 position-left text-slate"></i> 5,689</h5>
<span class="text-muted text-size-small">orders weekly</span>
</div>
</div>
<div class="col-md-4">
<div class="content-group">
<h5 class="text-semibold no-margin"><i class="icon-calendar52 position-left text-slate"></i> 32,568</h5>
<span class="text-muted text-size-small">orders monthly</span>
</div>
</div>
<div class="col-md-4">
<div class="content-group">
<h5 class="text-semibold no-margin"><i class="icon-cash3 position-left text-slate"></i> $23,464</h5>
<span class="text-muted text-size-small">average revenue</span>
</div>
</div>
</div>
</div>
<div class="content-group-sm" id="app_sales"></div>
<div id="monthly-sales-stats"></div>
</div>
<!-- /sales stats -->
</div>
</div>
<!-- /main charts -->
<!-- Dashboard content -->
<div class="row">
<div class="col-lg-8">
<!-- Marketing campaigns -->
<div class="panel panel-flat">
<div class="panel-heading">
<h6 class="panel-title">Marketing campaigns</h6>
<div class="heading-elements">
<span class="label bg-success heading-text">28 active</span>
<ul class="icons-list">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class="icon-menu7"></i> <span class="caret"></span></a>
<ul class="dropdown-menu dropdown-menu-right">
<li><a href="#"><i class="icon-sync"></i> Update data</a></li>
<li><a href="#"><i class="icon-list-unordered"></i> Detailed log</a></li>
<li><a href="#"><i class="icon-pie5"></i> Statistics</a></li>
<li class="divider"></li>
<li><a href="#"><i class="icon-cross3"></i> Clear list</a></li>
</ul>
</li>
</ul>
</div>
</div>
<div class="table-responsive">
<table class="table table-lg text-nowrap">
<tbody>
<tr>
<td class="col-md-5">
<div class="media-left">
<div id="campaigns-donut"></div>
</div>
<div class="media-left">
<h5 class="text-semibold no-margin">38,289 <small class="text-success text-size-base"><i class="icon-arrow-up12"></i> (+16.2%)</small></h5>
<ul class="list-inline <API key> no-margin">
<li>
<span class="status-mark border-success"></span>
</li>
<li>
<span class="text-muted">May 12, 12:30 am</span>
</li>
</ul>
</div>
</td>
<td class="col-md-5">
<div class="media-left">
<div id="campaign-status-pie"></div>
</div>
<div class="media-left">
<h5 class="text-semibold no-margin">2,458 <small class="text-danger text-size-base"><i class="icon-arrow-down12"></i> (- 4.9%)</small></h5>
<ul class="list-inline <API key> no-margin">
<li>
<span class="status-mark border-danger"></span>
</li>
<li>
<span class="text-muted">Jun 4, 4:00 am</span>
</li>
</ul>
</div>
</td>
<td class="text-right col-md-2">
<a href="#" class="btn bg-indigo-300"><i class="icon-statistics position-left"></i> View report</a>
</td>
</tr>
</tbody>
</table>
</div>
<div class="table-responsive">
<table class="table text-nowrap">
<thead>
<tr>
<th>Campaign</th>
<th class="col-md-2">Client</th>
<th class="col-md-2">Changes</th>
<th class="col-md-2">Budget</th>
<th class="col-md-2">Status</th>
<th class="text-center" style="width: 20px;"><i class="icon-arrow-down12"></i></th>
</tr>
</thead>
<tbody>
<tr class="active border-double">
<td colspan="5">Today</td>
<td class="text-right">
<span class="progress-meter" id="today-progress" data-progress="30"></span>
</td>
</tr>
<tr>
<td>
<div class="media-left media-middle">
<a href="#"><img src="assets/images/placeholder.jpg" class="img-circle img-xs" alt=""></a>
</div>
<div class="media-left">
<div class=""><a href="#" class="text-default text-semibold">Facebook</a></div>
<div class="text-muted text-size-small">
<span class="status-mark border-blue position-left"></span>
02:00 - 03:00
</div>
</div>
</td>
<td><span class="text-muted">Mintlime</span></td>
<td><span class="text-success-600"><i class="icon-stats-growth2 position-left"></i> 2.43%</span></td>
<td><h6 class="text-semibold">$5,489</h6></td>
<td><span class="label bg-blue">Active</span></td>
<td class="text-center">
<ul class="icons-list">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class="icon-menu7"></i></a>
<ul class="dropdown-menu dropdown-menu-right">
<li><a href="#"><i class="icon-file-stats"></i> View statement</a></li>
<li><a href="#"><i class="icon-file-text2"></i> Edit campaign</a></li>
<li><a href="#"><i class="icon-file-locked"></i> Disable campaign</a></li>
<li class="divider"></li>
<li><a href="#"><i class="icon-gear"></i> Settings</a></li>
</ul>
</li>
</ul>
</td>
</tr>
<tr>
<td>
<div class="media-left media-middle">
<a href="#"><img src="assets/images/placeholder.jpg" class="img-circle img-xs" alt=""></a>
</div>
<div class="media-left">
<div class=""><a href="#" class="text-default text-semibold">Youtube videos</a></div>
<div class="text-muted text-size-small">
<span class="status-mark border-danger position-left"></span>
13:00 - 14:00
</div>
</div>
</td>
<td><span class="text-muted">CDsoft</span></td>
<td><span class="text-success-600"><i class="icon-stats-growth2 position-left"></i> 3.12%</span></td>
<td><h6 class="text-semibold">$2,592</h6></td>
<td><span class="label bg-danger">Closed</span></td>
<td class="text-center">
<ul class="icons-list">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class="icon-menu7"></i></a>
<ul class="dropdown-menu dropdown-menu-right">
<li><a href="#"><i class="icon-file-stats"></i> View statement</a></li>
<li><a href="#"><i class="icon-file-text2"></i> Edit campaign</a></li>
<li><a href="#"><i class="icon-file-locked"></i> Disable campaign</a></li>
<li class="divider"></li>
<li><a href="#"><i class="icon-gear"></i> Settings</a></li>
</ul>
</li>
</ul>
</td>
</tr>
<tr>
<td>
<div class="media-left media-middle">
<a href="#"><img src="assets/images/placeholder.jpg" class="img-circle img-xs" alt=""></a>
</div>
<div class="media-left">
<div class=""><a href="#" class="text-default text-semibold">Spotify ads</a></div>
<div class="text-muted text-size-small">
<span class="status-mark border-grey-400 position-left"></span>
10:00 - 11:00
</div>
</div>
</td>
<td><span class="text-muted">Diligence</span></td>
<td><span class="text-danger"><i class="icon-stats-decline2 position-left"></i> - 8.02%</span></td>
<td><h6 class="text-semibold">$1,268</h6></td>
<td><span class="label bg-grey-400">Hold</span></td>
<td class="text-center">
<ul class="icons-list">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class="icon-menu7"></i></a>
<ul class="dropdown-menu dropdown-menu-right">
<li><a href="#"><i class="icon-file-stats"></i> View statement</a></li>
<li><a href="#"><i class="icon-file-text2"></i> Edit campaign</a></li>
<li><a href="#"><i class="icon-file-locked"></i> Disable campaign</a></li>
<li class="divider"></li>
<li><a href="#"><i class="icon-gear"></i> Settings</a></li>
</ul>
</li>
</ul>
</td>
</tr>
<tr>
<td>
<div class="media-left media-middle">
<a href="#"><img src="assets/images/placeholder.jpg" class="img-circle img-xs" alt=""></a>
</div>
<div class="media-left">
<div class=""><a href="#" class="text-default text-semibold">Twitter ads</a></div>
<div class="text-muted text-size-small">
<span class="status-mark border-grey-400 position-left"></span>
04:00 - 05:00
</div>
</div>
</td>
<td><span class="text-muted">Deluxe</span></td>
<td><span class="text-success-600"><i class="icon-stats-growth2 position-left"></i> 2.78%</span></td>
<td><h6 class="text-semibold">$7,467</h6></td>
<td><span class="label bg-grey-400">Hold</span></td>
<td class="text-center">
<ul class="icons-list">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class="icon-menu7"></i></a>
<ul class="dropdown-menu dropdown-menu-right">
<li><a href="#"><i class="icon-file-stats"></i> View statement</a></li>
<li><a href="#"><i class="icon-file-text2"></i> Edit campaign</a></li>
<li><a href="#"><i class="icon-file-locked"></i> Disable campaign</a></li>
<li class="divider"></li>
<li><a href="#"><i class="icon-gear"></i> Settings</a></li>
</ul>
</li>
</ul>
</td>
</tr>
<tr class="active border-double">
<td colspan="5">Yesterday</td>
<td class="text-right">
<span class="progress-meter" id="yesterday-progress" data-progress="65"></span>
</td>
</tr>
<tr>
<td>
<div class="media-left media-middle">
<a href="#"><img src="assets/images/placeholder.jpg" class="img-circle img-xs" alt=""></a>
</div>
<div class="media-left">
<div class=""><a href="#" class="text-default text-semibold">Bing campaign</a></div>
<div class="text-muted text-size-small">
<span class="status-mark border-success position-left"></span>
15:00 - 16:00
</div>
</div>
</td>
<td><span class="text-muted">Metrics</span></td>
<td><span class="text-danger"><i class="icon-stats-decline2 position-left"></i> - 5.78%</span></td>
<td><h6 class="text-semibold">$970</h6></td>
<td><span class="label bg-success-400">Pending</span></td>
<td class="text-center">
<ul class="icons-list">
<li class="dropup">
<a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class="icon-menu7"></i></a>
<ul class="dropdown-menu dropdown-menu-right">
<li><a href="#"><i class="icon-file-stats"></i> View statement</a></li>
<li><a href="#"><i class="icon-file-text2"></i> Edit campaign</a></li>
<li><a href="#"><i class="icon-file-locked"></i> Disable campaign</a></li>
<li class="divider"></li>
<li><a href="#"><i class="icon-gear"></i> Settings</a></li>
</ul>
</li>
</ul>
</td>
</tr>
<tr>
<td>
<div class="media-left media-middle">
<a href="#"><img src="assets/images/placeholder.jpg" class="img-circle img-xs" alt=""></a>
</div>
<div class="media-left">
<div class=""><a href="#" class="text-default text-semibold">Amazon ads</a></div>
<div class="text-muted text-size-small">
<span class="status-mark border-danger position-left"></span>
18:00 - 19:00
</div>
</div>
</td>
<td><span class="text-muted">Blueish</span></td>
<td><span class="text-success-600"><i class="icon-stats-growth2 position-left"></i> 6.79%</span></td>
<td><h6 class="text-semibold">$1,540</h6></td>
<td><span class="label bg-blue">Active</span></td>
<td class="text-center">
<ul class="icons-list">
<li class="dropup">
<a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class="icon-menu7"></i></a>
<ul class="dropdown-menu dropdown-menu-right">
<li><a href="#"><i class="icon-file-stats"></i> View statement</a></li>
<li><a href="#"><i class="icon-file-text2"></i> Edit campaign</a></li>
<li><a href="#"><i class="icon-file-locked"></i> Disable campaign</a></li>
<li class="divider"></li>
<li><a href="#"><i class="icon-gear"></i> Settings</a></li>
</ul>
</li>
</ul>
</td>
</tr>
<tr>
<td>
<div class="media-left media-middle">
<a href="#"><img src="assets/images/placeholder.jpg" class="img-circle img-xs" alt=""></a>
</div>
<div class="media-left">
<div class=""><a href="#" class="text-default text-semibold">Dribbble ads</a></div>
<div class="text-muted text-size-small">
<span class="status-mark border-blue position-left"></span>
20:00 - 21:00
</div>
</div>
</td>
<td><span class="text-muted">Teamable</span></td>
<td><span class="text-danger"><i class="icon-stats-decline2 position-left"></i> 9.83%</span></td>
<td><h6 class="text-semibold">$8,350</h6></td>
<td><span class="label bg-danger">Closed</span></td>
<td class="text-center">
<ul class="icons-list">
<li class="dropup">
<a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class="icon-menu7"></i></a>
<ul class="dropdown-menu dropdown-menu-right">
<li><a href="#"><i class="icon-file-stats"></i> View statement</a></li>
<li><a href="#"><i class="icon-file-text2"></i> Edit campaign</a></li>
<li><a href="#"><i class="icon-file-locked"></i> Disable campaign</a></li>
<li class="divider"></li>
<li><a href="#"><i class="icon-gear"></i> Settings</a></li>
</ul>
</li>
</ul>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<!-- /marketing campaigns -->
<!-- Quick stats boxes -->
<div class="row">
<div class="col-lg-4">
<!-- Members online -->
<div class="panel bg-teal-400">
<div class="panel-body">
<div class="heading-elements">
<span class="heading-text badge bg-teal-800">+53,6%</span>
</div>
<h3 class="no-margin">3,450</h3>
Members online
<div class="text-muted text-size-small">489 avg</div>
</div>
<div class="container-fluid">
<div id="members-online"></div>
</div>
</div>
<!-- /members online -->
</div>
<div class="col-lg-4">
<!-- Current server load -->
<div class="panel bg-pink-400">
<div class="panel-body">
<div class="heading-elements">
<ul class="icons-list">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class="icon-cog3"></i> <span class="caret"></span></a>
<ul class="dropdown-menu dropdown-menu-right">
<li><a href="#"><i class="icon-sync"></i> Update data</a></li>
<li><a href="#"><i class="icon-list-unordered"></i> Detailed log</a></li>
<li><a href="#"><i class="icon-pie5"></i> Statistics</a></li>
<li><a href="#"><i class="icon-cross3"></i> Clear list</a></li>
</ul>
</li>
</ul>
</div>
<h3 class="no-margin">49.4%</h3>
Current server load
<div class="text-muted text-size-small">34.6% avg</div>
</div>
<div id="server-load"></div>
</div>
<!-- /current server load -->
</div>
<div class="col-lg-4">
<!-- Today's revenue -->
<div class="panel bg-blue-400">
<div class="panel-body">
<div class="heading-elements">
<ul class="icons-list">
<li><a data-action="reload"></a></li>
</ul>
</div>
<h3 class="no-margin">$18,390</h3>
Today's revenue
<div class="text-muted text-size-small">$37,578 avg</div>
</div>
<div id="today-revenue"></div>
</div>
<!-- /today's revenue -->
</div>
</div>
<!-- /quick stats boxes -->
<!-- Support tickets -->
<div class="panel panel-flat">
<div class="panel-heading">
<h6 class="panel-title">Support tickets</h6>
<div class="heading-elements">
<button type="button" class="btn btn-link daterange-ranges heading-btn text-semibold">
<i class="icon-calendar3 position-left"></i> <span></span> <b class="caret"></b>
</button>
</div>
</div>
<div class="table-responsive">
<table class="table table-xlg text-nowrap">
<tbody>
<tr>
<td class="col-md-4">
<div class="media-left media-middle">
<div id="tickets-status"></div>
</div>
<div class="media-left">
<h5 class="text-semibold no-margin">14,327 <small class="text-success text-size-base"><i class="icon-arrow-up12"></i> (+2.9%)</small></h5>
<span class="text-muted"><span class="status-mark border-success position-left"></span> Jun 16, 10:00 am</span>
</div>
</td>
<td class="col-md-3">
<div class="media-left media-middle">
<a href="#" class="btn border-indigo-400 text-indigo-400 btn-flat btn-rounded btn-xs btn-icon"><i class="icon-alarm-add"></i></a>
</div>
<div class="media-left">
<h5 class="text-semibold no-margin">
1,132 <small class="display-block no-margin">total tickets</small>
</h5>
</div>
</td>
<td class="col-md-3">
<div class="media-left media-middle">
<a href="#" class="btn border-indigo-400 text-indigo-400 btn-flat btn-rounded btn-xs btn-icon"><i class="icon-spinner11"></i></a>
</div>
<div class="media-left">
<h5 class="text-semibold no-margin">
06:25:00 <small class="display-block no-margin">response time</small>
</h5>
</div>
</td>
<td class="text-right col-md-2">
<a href="#" class="btn bg-teal-400"><i class="icon-statistics position-left"></i> Report</a>
</td>
</tr>
</tbody>
</table>
</div>
<div class="table-responsive">
<table class="table text-nowrap">
<thead>
<tr>
<th style="width: 50px">Due</th>
<th style="width: 300px;">User</th>
<th>Description</th>
<th class="text-center" style="width: 20px;"><i class="icon-arrow-down12"></i></th>
</tr>
</thead>
<tbody>
<tr class="active border-double">
<td colspan="3">Active tickets</td>
<td class="text-right">
<span class="badge bg-blue">24</span>
</td>
</tr>
<tr>
<td class="text-center">
<h6 class="no-margin">12 <small class="display-block text-size-small no-margin">hours</small></h6>
</td>
<td>
<div class="media-left media-middle">
<a href="#" class="btn bg-teal-400 btn-rounded btn-icon btn-xs">
<span class="letter-icon"></span>
</a>
</div>
<div class="media-body">
<a href="#" class="<API key> text-default text-semibold letter-icon-title">Annabelle Doney</a>
<div class="text-muted text-size-small"><span class="status-mark border-blue position-left"></span> Active</div>
</div>
</td>
<td>
<a href="#" class="text-default <API key>">
<span class="text-semibold">[#1183] Workaround for OS X selects printing bug</span>
<span class="display-block text-muted">Chrome fixed the bug several versions ago, thus rendering this...</span>
</a>
</td>
<td class="text-center">
<ul class="icons-list">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class="icon-menu7"></i></a>
<ul class="dropdown-menu dropdown-menu-right">
<li><a href="#"><i class="icon-undo"></i> Quick reply</a></li>
<li><a href="#"><i class="icon-history"></i> Full history</a></li>
<li class="divider"></li>
<li><a href="#"><i class="icon-checkmark3 text-success"></i> Resolve issue</a></li>
<li><a href="#"><i class="icon-cross2 text-danger"></i> Close issue</a></li>
</ul>
</li>
</ul>
</td>
</tr>
<tr>
<td class="text-center">
<h6 class="no-margin">16 <small class="display-block text-size-small no-margin">hours</small></h6>
</td>
<td>
<div class="media-left media-middle">
<a href="#"><img src="assets/images/placeholder.jpg" class="img-circle img-xs" alt=""></a>
</div>
<div class="media-body">
<a href="#" class="<API key> text-default text-semibold letter-icon-title">Chris Macintyre</a>
<div class="text-muted text-size-small"><span class="status-mark border-blue position-left"></span> Active</div>
</div>
</td>
<td>
<a href="#" class="text-default <API key>">
<span class="text-semibold">[#1249] Vertically center carousel controls</span>
<span class="display-block text-muted">Try any carousel control and reduce the screen width below...</span>
</a>
</td>
<td class="text-center">
<ul class="icons-list">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class="icon-menu7"></i></a>
<ul class="dropdown-menu dropdown-menu-right">
<li><a href="#"><i class="icon-undo"></i> Quick reply</a></li>
<li><a href="#"><i class="icon-history"></i> Full history</a></li>
<li class="divider"></li>
<li><a href="#"><i class="icon-checkmark3 text-success"></i> Resolve issue</a></li>
<li><a href="#"><i class="icon-cross2 text-danger"></i> Close issue</a></li>
</ul>
</li>
</ul>
</td>
</tr>
<tr>
<td class="text-center">
<h6 class="no-margin">20 <small class="display-block text-size-small no-margin">hours</small></h6>
</td>
<td>
<div class="media-left media-middle">
<a href="#" class="btn bg-blue btn-rounded btn-icon btn-xs">
<span class="letter-icon"></span>
</a>
</div>
<div class="media-body">
<a href="#" class="<API key> text-default text-semibold letter-icon-title">Robert Hauber</a>
<div class="text-muted text-size-small"><span class="status-mark border-blue position-left"></span> Active</div>
</div>
</td>
<td>
<a href="#" class="text-default <API key>">
<span class="text-semibold">[#1254] Inaccurate small pagination height</span>
<span class="display-block text-muted">The height of pagination elements is not consistent with...</span>
</a>
</td>
<td class="text-center">
<ul class="icons-list">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class="icon-menu7"></i></a>
<ul class="dropdown-menu dropdown-menu-right">
<li><a href="#"><i class="icon-undo"></i> Quick reply</a></li>
<li><a href="#"><i class="icon-history"></i> Full history</a></li>
<li class="divider"></li>
<li><a href="#"><i class="icon-checkmark3 text-success"></i> Resolve issue</a></li>
<li><a href="#"><i class="icon-cross2 text-danger"></i> Close issue</a></li>
</ul>
</li>
</ul>
</td>
</tr>
<tr>
<td class="text-center">
<h6 class="no-margin">40 <small class="display-block text-size-small no-margin">hours</small></h6>
</td>
<td>
<div class="media-left media-middle">
<a href="#" class="btn bg-warning-400 btn-rounded btn-icon btn-xs">
<span class="letter-icon"></span>
</a>
</div>
<div class="media-body">
<a href="#" class="<API key> text-default text-semibold letter-icon-title">Dex Sponheim</a>
<div class="text-muted text-size-small"><span class="status-mark border-blue position-left"></span> Active</div>
</div>
</td>
<td>
<a href="#" class="text-default <API key>">
<span class="text-semibold">[#1184] Round grid column gutter operations</span>
<span class="display-block text-muted">Left rounds up, right rounds down. should keep everything...</span>
</a>
</td>
<td class="text-center">
<ul class="icons-list">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class="icon-menu7"></i></a>
<ul class="dropdown-menu dropdown-menu-right">
<li><a href="#"><i class="icon-undo"></i> Quick reply</a></li>
<li><a href="#"><i class="icon-history"></i> Full history</a></li>
<li class="divider"></li>
<li><a href="#"><i class="icon-checkmark3 text-success"></i> Resolve issue</a></li>
<li><a href="#"><i class="icon-cross2 text-danger"></i> Close issue</a></li>
</ul>
</li>
</ul>
</td>
</tr>
<tr class="active border-double">
<td colspan="3">Resolved tickets</td>
<td class="text-right">
<span class="badge bg-success">42</span>
</td>
</tr>
<tr>
<td class="text-center">
<i class="icon-checkmark3 text-success"></i>
</td>
<td>
<div class="media-left media-middle">
<a href="#" class="btn bg-success-400 btn-rounded btn-icon btn-xs">
<span class="letter-icon"></span>
</a>
</div>
<div class="media-body">
<a href="#" class="<API key> text-default letter-icon-title">Alan Macedo</a>
<div class="text-muted text-size-small"><span class="status-mark border-success position-left"></span> Resolved</div>
</div>
</td>
<td>
<a href="#" class="text-default <API key>">
[#1046] Avoid some unnecessary HTML string
<span class="display-block text-muted">Rather than building a string of HTML and then parsing it...</span>
</a>
</td>
<td class="text-center">
<ul class="icons-list">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class="icon-menu7"></i></a>
<ul class="dropdown-menu dropdown-menu-right">
<li><a href="#"><i class="icon-undo"></i> Quick reply</a></li>
<li><a href="#"><i class="icon-history"></i> Full history</a></li>
<li class="divider"></li>
<li><a href="#"><i class="icon-plus3 text-blue"></i> Unresolve issue</a></li>
<li><a href="#"><i class="icon-cross2 text-danger"></i> Close issue</a></li>
</ul>
</li>
</ul>
</td>
</tr>
<tr>
<td class="text-center">
<i class="icon-checkmark3 text-success"></i>
</td>
<td>
<div class="media-left media-middle">
<a href="#" class="btn bg-pink-400 btn-rounded btn-icon btn-xs">
<span class="letter-icon"></span>
</a>
</div>
<div class="media-body">
<a href="#" class="<API key> text-default letter-icon-title">Brett Castellano</a>
<div class="text-muted text-size-small"><span class="status-mark border-success position-left"></span> Resolved</div>
</div>
</td>
<td>
<a href="#" class="text-default <API key>">
[#1038] Update json configuration
<span class="display-block text-muted">The <code>files</code> property is necessary to override the files property...</span>
</a>
</td>
<td class="text-center">
<ul class="icons-list">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class="icon-menu7"></i></a>
<ul class="dropdown-menu dropdown-menu-right">
<li><a href="#"><i class="icon-undo"></i> Quick reply</a></li>
<li><a href="#"><i class="icon-history"></i> Full history</a></li>
<li class="divider"></li>
<li><a href="#"><i class="icon-plus3 text-blue"></i> Unresolve issue</a></li>
<li><a href="#"><i class="icon-cross2 text-danger"></i> Close issue</a></li>
</ul>
</li>
</ul>
</td>
</tr>
<tr>
<td class="text-center">
<i class="icon-checkmark3 text-success"></i>
</td>
<td>
<div class="media-left media-middle">
<a href="#"><img src="assets/images/placeholder.jpg" class="img-circle img-xs" alt=""></a>
</div>
<div class="media-body">
<a href="#" class="<API key> text-default">Roxanne Forbes</a>
<div class="text-muted text-size-small"><span class="status-mark border-success position-left"></span> Resolved</div>
</div>
</td>
<td>
<a href="#" class="text-default <API key>">
[#1034] Tooltip multiple event
<span class="display-block text-muted">Fix behavior when using tooltips and popovers that are...</span>
</a>
</td>
<td class="text-center">
<ul class="icons-list">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class="icon-menu7"></i></a>
<ul class="dropdown-menu dropdown-menu-right">
<li><a href="#"><i class="icon-undo"></i> Quick reply</a></li>
<li><a href="#"><i class="icon-history"></i> Full history</a></li>
<li class="divider"></li>
<li><a href="#"><i class="icon-plus3 text-blue"></i> Unresolve issue</a></li>
<li><a href="#"><i class="icon-cross2 text-danger"></i> Close issue</a></li>
</ul>
</li>
</ul>
</td>
</tr>
<tr class="active border-double">
<td colspan="3">Closed tickets</td>
<td class="text-right">
<span class="badge bg-danger">37</span>
</td>
</tr>
<tr>
<td class="text-center">
<i class="icon-cross2 text-danger-400"></i>
</td>
<td>
<div class="media-left media-middle">
<a href="#"><img src="assets/images/placeholder.jpg" class="img-circle img-xs" alt=""></a>
</div>
<div class="media-body">
<a href="#" class="<API key> text-default">Mitchell Sitkin</a>
<div class="text-muted text-size-small"><span class="status-mark border-danger position-left"></span> Closed</div>
</div>
</td>
<td>
<a href="#" class="text-default <API key>">
[#1040] Account for static form controls in form group
<span class="display-block text-muted">Resizes control label's font-size and account for the standard...</span>
</a>
</td>
<td class="text-center">
<ul class="icons-list">
<li class="dropup">
<a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class="icon-menu7"></i></a>
<ul class="dropdown-menu dropdown-menu-right">
<li><a href="#"><i class="icon-undo"></i> Quick reply</a></li>
<li><a href="#"><i class="icon-history"></i> Full history</a></li>
<li class="divider"></li>
<li><a href="#"><i class="icon-reload-alt text-blue"></i> Reopen issue</a></li>
<li><a href="#"><i class="icon-cross2 text-danger"></i> Close issue</a></li>
</ul>
</li>
</ul>
</td>
</tr>
<tr>
<td class="text-center">
<i class="icon-cross2 text-danger"></i>
</td>
<td>
<div class="media-left media-middle">
<a href="#" class="btn bg-brown-400 btn-rounded btn-icon btn-xs">
<span class="letter-icon"></span>
</a>
</div>
<div class="media-body">
<a href="#" class="<API key> text-default letter-icon-title">Katleen Jensen</a>
<div class="text-muted text-size-small"><span class="status-mark border-danger position-left"></span> Closed</div>
</div>
</td>
<td>
<a href="#" class="text-default <API key>">
[#1038] Proper sizing of form control feedback
<span class="display-block text-muted">Feedback icon sizing inside a larger/smaller form-group...</span>
</a>
</td>
<td class="text-center">
<ul class="icons-list">
<li class="dropup">
<a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class="icon-menu7"></i></a>
<ul class="dropdown-menu dropdown-menu-right">
<li><a href="#"><i class="icon-undo"></i> Quick reply</a></li>
<li><a href="#"><i class="icon-history"></i> Full history</a></li>
<li class="divider"></li>
<li><a href="#"><i class="icon-plus3 text-blue"></i> Unresolve issue</a></li>
<li><a href="#"><i class="icon-cross2 text-danger"></i> Close issue</a></li>
</ul>
</li>
</ul>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<!-- /support tickets -->
<!-- Latest posts -->
<div class="panel panel-flat">
<div class="panel-heading">
<h6 class="panel-title">Latest posts</h6>
<div class="heading-elements">
<ul class="icons-list">
<li><a data-action="collapse"></a></li>
<li><a data-action="reload"></a></li>
<li><a data-action="close"></a></li>
</ul>
</div>
</div>
<div class="panel-body">
<div class="row">
<div class="col-lg-6">
<ul class="media-list content-group">
<li class="media <API key>">
<div class="media-left">
<div class="thumb">
<a href="
<img src="assets/images/placeholder.jpg" class="img-responsive img-rounded media-preview" alt="">
<span class="zoom-image"><i class="icon-play3"></i></span>
</a>
</div>
</div>
<div class="media-body">
<h6 class="media-heading"><a href="#">Up unpacked friendly</a></h6>
<ul class="list-inline <API key> text-muted mb-5">
<li><i class="icon-book-play position-left"></i> Video tutorials</li>
<li>14 minutes ago</li>
</ul>
The him father parish looked has sooner. Attachment frequently gay terminated son...
</div>
</li>
<li class="media <API key>">
<div class="media-left">
<div class="thumb">
<a href="
<img src="assets/images/placeholder.jpg" class="img-responsive img-rounded media-preview" alt="">
<span class="zoom-image"><i class="icon-play3"></i></span>
</a>
</div>
</div>
<div class="media-body">
<h6 class="media-heading"><a href="#">It allowance prevailed</a></h6>
<ul class="list-inline <API key> text-muted mb-5">
<li><i class="icon-book-play position-left"></i> Video tutorials</li>
<li>12 days ago</li>
</ul>
Alteration literature to or an sympathize mr imprudence. Of is ferrars subject as enjoyed...
</div>
</li>
</ul>
</div>
<div class="col-lg-6">
<ul class="media-list content-group">
<li class="media <API key>">
<div class="media-left">
<div class="thumb">
<a href="
<img src="assets/images/placeholder.jpg" class="img-responsive img-rounded media-preview" alt="">
<span class="zoom-image"><i class="icon-play3"></i></span>
</a>
</div>
</div>
<div class="media-body">
<h6 class="media-heading"><a href="#">Case read they must</a></h6>
<ul class="list-inline <API key> text-muted mb-5">
<li><i class="icon-book-play position-left"></i> Video tutorials</li>
<li>20 hours ago</li>
</ul>
On it differed repeated wandered required in. Then girl neat why yet knew rose spot...
</div>
</li>
<li class="media <API key>">
<div class="media-left">
<div class="thumb">
<a href="
<img src="assets/images/placeholder.jpg" class="img-responsive img-rounded media-preview" alt="">
<span class="zoom-image"><i class="icon-play3"></i></span>
</a>
</div>
</div>
<div class="media-body">
<h6 class="media-heading"><a href="#">Too carriage attended</a></h6>
<ul class="list-inline <API key> text-muted mb-5">
<li><i class="icon-book-play position-left"></i> FAQ section</li>
<li>2 days ago</li>
</ul>
Marianne or husbands if at stronger ye. Considered is as middletons uncommonly...
</div>
</li>
</ul>
</div>
</div>
</div>
</div>
<!-- /latest posts -->
</div>
<div class="col-lg-4">
<!-- Progress counters -->
<div class="row">
<div class="col-md-6">
<!-- Available hours -->
<div class="panel text-center">
<div class="panel-body">
<div class="heading-elements">
<ul class="icons-list">
<li class="dropdown text-muted">
<a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class="icon-cog3"></i> <span class="caret"></span></a>
<ul class="dropdown-menu dropdown-menu-right">
<li><a href="#"><i class="icon-sync"></i> Update data</a></li>
<li><a href="#"><i class="icon-list-unordered"></i> Detailed log</a></li>
<li><a href="#"><i class="icon-pie5"></i> Statistics</a></li>
<li><a href="#"><i class="icon-cross3"></i> Clear list</a></li>
</ul>
</li>
</ul>
</div>
<!-- Progress counter -->
<div class="content-group-sm svg-center position-relative" id="<API key>"></div>
<!-- /progress counter -->
<!-- Bars -->
<div id="<API key>"></div>
<!-- /bars -->
</div>
</div>
<!-- /available hours -->
</div>
<div class="col-md-6">
<!-- Productivity goal -->
<div class="panel text-center">
<div class="panel-body">
<div class="heading-elements">
<ul class="icons-list">
<li class="dropdown text-muted">
<a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class="icon-cog3"></i> <span class="caret"></span></a>
<ul class="dropdown-menu dropdown-menu-right">
<li><a href="#"><i class="icon-sync"></i> Update data</a></li>
<li><a href="#"><i class="icon-list-unordered"></i> Detailed log</a></li>
<li><a href="#"><i class="icon-pie5"></i> Statistics</a></li>
<li><a href="#"><i class="icon-cross3"></i> Clear list</a></li>
</ul>
</li>
</ul>
</div>
<!-- Progress counter -->
<div class="content-group-sm svg-center position-relative" id="goal-progress"></div>
<!-- /progress counter -->
<!-- Bars -->
<div id="goal-bars"></div>
<!-- /bars -->
</div>
</div>
<!-- /productivity goal -->
</div>
</div>
<!-- /progress counters -->
<!-- Daily sales -->
<div class="panel panel-flat">
<div class="panel-heading">
<h6 class="panel-title">Daily sales stats</h6>
<div class="heading-elements">
<span class="heading-text">Balance: <span class="text-bold text-danger-600 position-right">$4,378</span></span>
<ul class="icons-list">
<li class="dropdown text-muted">
<a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class="icon-cog3"></i> <span class="caret"></span></a>
<ul class="dropdown-menu dropdown-menu-right">
<li><a href="#"><i class="icon-sync"></i> Update data</a></li>
<li><a href="#"><i class="icon-list-unordered"></i> Detailed log</a></li>
<li><a href="#"><i class="icon-pie5"></i> Statistics</a></li>
<li class="divider"></li>
<li><a href="#"><i class="icon-cross3"></i> Clear list</a></li>
</ul>
</li>
</ul>
</div>
</div>
<div class="panel-body">
<div id="sales-heatmap"></div>
</div>
<div class="table-responsive">
<table class="table text-nowrap">
<thead>
<tr>
<th>Application</th>
<th>Time</th>
<th>Price</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<div class="media-left media-middle">
<a href="#" class="btn bg-primary-400 btn-rounded btn-icon btn-xs">
<span class="letter-icon"></span>
</a>
</div>
<div class="media-body">
<div class="media-heading">
<a href="#" class="letter-icon-title">Sigma application</a>
</div>
<div class="text-muted text-size-small"><i class="icon-checkmark3 text-size-mini position-left"></i> New order</div>
</div>
</td>
<td>
<span class="text-muted text-size-small">06:28 pm</span>
</td>
<td>
<h6 class="text-semibold no-margin">$49.90</h6>
</td>
</tr>
<tr>
<td>
<div class="media-left media-middle">
<a href="#" class="btn bg-danger-400 btn-rounded btn-icon btn-xs">
<span class="letter-icon"></span>
</a>
</div>
<div class="media-body">
<div class="media-heading">
<a href="#" class="letter-icon-title">Alpha application</a>
</div>
<div class="text-muted text-size-small"><i class="icon-spinner11 text-size-mini position-left"></i> Renewal</div>
</div>
</td>
<td>
<span class="text-muted text-size-small">04:52 pm</span>
</td>
<td>
<h6 class="text-semibold no-margin">$90.50</h6>
</td>
</tr>
<tr>
<td>
<div class="media-left media-middle">
<a href="#" class="btn bg-indigo-400 btn-rounded btn-icon btn-xs">
<span class="letter-icon"></span>
</a>
</div>
<div class="media-body">
<div class="media-heading">
<a href="#" class="letter-icon-title">Delta application</a>
</div>
<div class="text-muted text-size-small"><i class="icon-lifebuoy text-size-mini position-left"></i> Support</div>
</div>
</td>
<td>
<span class="text-muted text-size-small">01:26 pm</span>
</td>
<td>
<h6 class="text-semibold no-margin">$60.00</h6>
</td>
</tr>
<tr>
<td>
<div class="media-left media-middle">
<a href="#" class="btn bg-success-400 btn-rounded btn-icon btn-xs">
<span class="letter-icon"></span>
</a>
</div>
<div class="media-body">
<div class="media-heading">
<a href="#" class="letter-icon-title">Omega application</a>
</div>
<div class="text-muted text-size-small"><i class="icon-lifebuoy text-size-mini position-left"></i> Support</div>
</div>
</td>
<td>
<span class="text-muted text-size-small">11:46 am</span>
</td>
<td>
<h6 class="text-semibold no-margin">$55.00</h6>
</td>
</tr>
<tr>
<td>
<div class="media-left media-middle">
<a href="#" class="btn bg-danger-400 btn-rounded btn-icon btn-xs">
<span class="letter-icon"></span>
</a>
</div>
<div class="media-body">
<div class="media-heading">
<a href="#" class="letter-icon-title">Alpha application</a>
</div>
<div class="text-muted text-size-small"><i class="icon-spinner11 text-size-mini position-left"></i> Renewal</div>
</div>
</td>
<td>
<span class="text-muted text-size-small">10:29 am</span>
</td>
<td>
<h6 class="text-semibold no-margin">$90.50</h6>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<!-- /daily sales -->
<!-- My messages -->
<div class="panel panel-flat">
<div class="panel-heading">
<h6 class="panel-title">My messages</h6>
<div class="heading-elements">
<span class="heading-text"><i class="icon-history text-warning position-left"></i> Jul 7, 10:30</span>
<span class="label bg-success heading-text">Online</span>
</div>
</div>
<!-- Numbers -->
<div class="container-fluid">
<div class="row text-center">
<div class="col-md-4">
<div class="content-group">
<h6 class="text-semibold no-margin"><i class="icon-clipboard3 position-left text-slate"></i> 2,345</h6>
<span class="text-muted text-size-small">this week</span>
</div>
</div>
<div class="col-md-4">
<div class="content-group">
<h6 class="text-semibold no-margin"><i class="icon-calendar3 position-left text-slate"></i> 3,568</h6>
<span class="text-muted text-size-small">this month</span>
</div>
</div>
<div class="col-md-4">
<div class="content-group">
<h6 class="text-semibold no-margin"><i class="icon-comments position-left text-slate"></i> 32,693</h6>
<span class="text-muted text-size-small">all messages</span>
</div>
</div>
</div>
</div>
<!-- /numbers -->
<!-- Area chart -->
<div id="messages-stats"></div>
<!-- /area chart -->
<!-- Tabs -->
<ul class="nav nav-lg nav-tabs nav-justified no-margin no-border-radius bg-indigo-400 border-top <API key>">
<li class="active">
<a href="#messages-tue" class="text-size-small text-uppercase" data-toggle="tab">
Tuesday
</a>
</li>
<li>
<a href="#messages-mon" class="text-size-small text-uppercase" data-toggle="tab">
Monday
</a>
</li>
<li>
<a href="#messages-fri" class="text-size-small text-uppercase" data-toggle="tab">
Friday
</a>
</li>
</ul>
<!-- /tabs -->
<!-- Tabs content -->
<div class="tab-content">
<div class="tab-pane active fade in has-padding" id="messages-tue">
<ul class="media-list">
<li class="media">
<div class="media-left">
<img src="assets/images/placeholder.jpg" class="img-circle img-xs" alt="">
<span class="badge bg-danger-400 media-badge">8</span>
</div>
<div class="media-body">
<a href="
James Alexander
<span class="media-annotation pull-right">14:58</span>
</a>
<span class="display-block text-muted">The constitutionally inventoried precariously...</span>
</div>
</li>
<li class="media">
<div class="media-left">
<img src="assets/images/placeholder.jpg" class="img-circle img-xs" alt="">
<span class="badge bg-danger-400 media-badge">6</span>
</div>
<div class="media-body">
<a href="
Margo Baker
<span class="media-annotation pull-right">12:16</span>
</a>
<span class="display-block text-muted">Pinched a well more moral chose goodness...</span>
</div>
</li>
<li class="media">
<div class="media-left">
<img src="assets/images/placeholder.jpg" class="img-circle img-xs" alt="">
</div>
<div class="media-body">
<a href="
Jeremy Victorino
<span class="media-annotation pull-right">09:48</span>
</a>
<span class="display-block text-muted">Pert thickly mischievous clung frowned well...</span>
</div>
</li>
<li class="media">
<div class="media-left">
<img src="assets/images/placeholder.jpg" class="img-circle img-xs" alt="">
</div>
<div class="media-body">
<a href="
Beatrix Diaz
<span class="media-annotation pull-right">05:54</span>
</a>
<span class="display-block text-muted">Nightingale taped hello bucolic fussily cardinal...</span>
</div>
</li>
<li class="media">
<div class="media-left">
<img src="assets/images/placeholder.jpg" class="img-circle img-xs" alt="">
</div>
<div class="media-body">
<a href="
Richard Vango
<span class="media-annotation pull-right">01:43</span>
</a>
<span class="display-block text-muted">Amidst roadrunner distantly pompously where...</span>
</div>
</li>
</ul>
</div>
<div class="tab-pane fade has-padding" id="messages-mon">
<ul class="media-list">
<li class="media">
<div class="media-left">
<img src="assets/images/placeholder.jpg" class="img-circle img-sm" alt="">
</div>
<div class="media-body">
<a href="
Isak Temes
<span class="media-annotation pull-right">Tue, 19:58</span>
</a>
<span class="display-block text-muted">Reasonable palpably rankly expressly grimy...</span>
</div>
</li>
<li class="media">
<div class="media-left">
<img src="assets/images/placeholder.jpg" class="img-circle img-sm" alt="">
</div>
<div class="media-body">
<a href="
Vittorio Cosgrove
<span class="media-annotation pull-right">Tue, 16:35</span>
</a>
<span class="display-block text-muted">Arguably therefore more unexplainable fumed...</span>
</div>
</li>
<li class="media">
<div class="media-left">
<img src="assets/images/placeholder.jpg" class="img-circle img-sm" alt="">
</div>
<div class="media-body">
<a href="
Hilary Talaugon
<span class="media-annotation pull-right">Tue, 12:16</span>
</a>
<span class="display-block text-muted">Nicely unlike porpoise a kookaburra past more...</span>
</div>
</li>
<li class="media">
<div class="media-left">
<img src="assets/images/placeholder.jpg" class="img-circle img-sm" alt="">
</div>
<div class="media-body">
<a href="
Bobbie Seber
<span class="media-annotation pull-right">Tue, 09:20</span>
</a>
<span class="display-block text-muted">Before visual vigilantly fortuitous tortoise...</span>
</div>
</li>
<li class="media">
<div class="media-left">
<img src="assets/images/placeholder.jpg" class="img-circle img-sm" alt="">
</div>
<div class="media-body">
<a href="
Walther Laws
<span class="media-annotation pull-right">Tue, 03:29</span>
</a>
<span class="display-block text-muted">Far affecting more leered unerringly dishonest...</span>
</div>
</li>
</ul>
</div>
<div class="tab-pane fade has-padding" id="messages-fri">
<ul class="media-list">
<li class="media">
<div class="media-left">
<img src="assets/images/placeholder.jpg" class="img-circle img-sm" alt="">
</div>
<div class="media-body">
<a href="
Owen Stretch
<span class="media-annotation pull-right">Mon, 18:12</span>
</a>
<span class="display-block text-muted">Tardy rattlesnake seal raptly earthworm...</span>
</div>
</li>
<li class="media">
<div class="media-left">
<img src="assets/images/placeholder.jpg" class="img-circle img-sm" alt="">
</div>
<div class="media-body">
<a href="
Jenilee Mcnair
<span class="media-annotation pull-right">Mon, 14:03</span>
</a>
<span class="display-block text-muted">Since hello dear pushed amid darn trite...</span>
</div>
</li>
<li class="media">
<div class="media-left">
<img src="assets/images/placeholder.jpg" class="img-circle img-sm" alt="">
</div>
<div class="media-body">
<a href="
Alaster Jain
<span class="media-annotation pull-right">Mon, 13:59</span>
</a>
<span class="display-block text-muted">Dachshund cardinal dear next jeepers well...</span>
</div>
</li>
<li class="media">
<div class="media-left">
<img src="assets/images/placeholder.jpg" class="img-circle img-sm" alt="">
</div>
<div class="media-body">
<a href="
Sigfrid Thisted
<span class="media-annotation pull-right">Mon, 09:26</span>
</a>
<span class="display-block text-muted">Lighted wolf yikes less lemur crud grunted...</span>
</div>
</li>
<li class="media">
<div class="media-left">
<img src="assets/images/placeholder.jpg" class="img-circle img-sm" alt="">
</div>
<div class="media-body">
<a href="
Sherilyn Mckee
<span class="media-annotation pull-right">Mon, 06:38</span>
</a>
<span class="display-block text-muted">Less unicorn a however careless husky...</span>
</div>
</li>
</ul>
</div>
</div>
<!-- /tabs content -->
</div>
<!-- /my messages -->
<!-- Daily financials -->
<div class="panel panel-flat">
<div class="panel-heading">
<h6 class="panel-title">Daily financials</h6>
<div class="heading-elements">
<form class="heading-form" action="
<div class="form-group">
<label class="checkbox checkbox-inline checkbox-switchery checkbox-right switchery-xs">
<input type="checkbox" class="switcher" id="realtime" checked="checked">
Realtime
</label>
</div>
</form>
<span class="badge bg-danger-400 heading-text">+86</span>
</div>
</div>
<div class="panel-body">
<div class="content-group-xs" id="bullets"></div>
<ul class="media-list">
<li class="media">
<div class="media-left">
<a href="#" class="btn border-pink text-pink btn-flat btn-rounded btn-icon btn-xs"><i class="icon-statistics"></i></a>
</div>
<div class="media-body">
Stats for July, 6: 1938 orders, $4220 revenue
<div class="media-annotation">2 hours ago</div>
</div>
<div class="media-right media-middle">
<ul class="icons-list">
<li>
<a href="#"><i class="icon-arrow-right13"></i></a>
</li>
</ul>
</div>
</li>
<li class="media">
<div class="media-left">
<a href="#" class="btn border-success text-success btn-flat btn-rounded btn-icon btn-xs"><i class="icon-checkmark3"></i></a>
</div>
<div class="media-body">
Invoices <a href="#">#4732</a> and <a href="#">#4734</a> have been paid
<div class="media-annotation">Dec 18, 18:36</div>
</div>
<div class="media-right media-middle">
<ul class="icons-list">
<li>
<a href="#"><i class="icon-arrow-right13"></i></a>
</li>
</ul>
</div>
</li>
<li class="media">
<div class="media-left">
<a href="#" class="btn border-primary text-primary btn-flat btn-rounded btn-icon btn-xs"><i class="<API key>"></i></a>
</div>
<div class="media-body">
Affiliate commission for June has been paid
<div class="media-annotation">36 minutes ago</div>
</div>
<div class="media-right media-middle">
<ul class="icons-list">
<li>
<a href="#"><i class="icon-arrow-right13"></i></a>
</li>
</ul>
</div>
</li>
<li class="media">
<div class="media-left">
<a href="#" class="btn border-warning-400 text-warning-400 btn-flat btn-rounded btn-icon btn-xs"><i class="icon-spinner11"></i></a>
</div>
<div class="media-body">
Order <a href="#">#37745</a> from July, 1st has been refunded
<div class="media-annotation">4 minutes ago</div>
</div>
<div class="media-right media-middle">
<ul class="icons-list">
<li>
<a href="#"><i class="icon-arrow-right13"></i></a>
</li>
</ul>
</div>
</li>
<li class="media">
<div class="media-left">
<a href="#" class="btn border-teal-400 text-teal btn-flat btn-rounded btn-icon btn-xs"><i class="icon-redo2"></i></a>
</div>
<div class="media-body">
Invoice <a href="#">#4769</a> has been sent to <a href="#">Robert Smith</a>
<div class="media-annotation">Dec 12, 05:46</div>
</div>
<div class="media-right media-middle">
<ul class="icons-list">
<li>
<a href="#"><i class="icon-arrow-right13"></i></a>
</li>
</ul>
</div>
</li>
</ul>
</div>
</div>
<!-- /daily financials -->
</div>
</div>
<!-- /dashboard content -->
<!-- Footer -->
<div class="footer text-muted">
© 2015. <a href="
</div>
<!-- /footer -->
</div>
<!-- /content area -->
</div>
<!-- /main content -->
</div>
<!-- /page content -->
</div>
<!-- /page container -->
</body>
</html> |
package org.investovator.ui.nngaming.beans;
import java.io.Serializable;
import java.util.Comparator;
public class OrderBean implements Serializable,Comparator<OrderBean>{
private float orderValue;
private int quantity;
public OrderBean(float orderValue,int quantity){
this.orderValue = orderValue;
this.quantity = quantity;
}
public float getOrderValue() {
return orderValue;
}
public void setOrderValue(float orderValue) {
this.orderValue = orderValue;
}
public int getQuantity() {
return quantity;
}
public void setQuantity(int quantity) {
this.quantity = quantity;
}
@Override
public int compare(OrderBean o1, OrderBean o2) {
if(o1.getOrderValue() < o2.getOrderValue())
return -1;
else if(o1.getOrderValue() > o2.getOrderValue())
return 1;
else
return 0;
}
} |
# This file is part of Barman.
# Barman is free software: you can redistribute it and/or modify
# (at your option) any later version.
# Barman is distributed in the hope that it will be useful,
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
import mock
import pytest
from barman import output
from barman.infofile import BackupInfo
from barman.utils import pretty_size
from testing_helpers import <API key>, <API key>
def teardown_module(module):
"""
Set the output API to a functional state, after testing it
"""
output.set_output_writer(output.DEFAULT_WRITER)
# noinspection PyMethodMayBeStatic
class TestOutputAPI(object):
@staticmethod
def _mock_writer():
# install a fresh mocked output writer
writer = mock.Mock()
output.set_output_writer(writer)
# reset the error status
output.error_occurred = False
return writer
# noinspection PyProtectedMember,<API key>
@mock.patch.dict(output.AVAILABLE_WRITERS, mock=mock.Mock())
def <API key>(self):
old_writer = mock.Mock()
output.set_output_writer(old_writer)
assert output._writer == old_writer
args = ('1', 'two')
kwargs = dict(three=3, four=5)
output.set_output_writer('mock', *args, **kwargs)
old_writer.close.<API key>()
output.AVAILABLE_WRITERS['mock'].<API key>(*args,
**kwargs)
def test_debug(self, caplog):
# preparation
writer = self._mock_writer()
msg = 'test message'
output.debug(msg)
# logging test
for record in caplog.records:
assert record.levelname == 'DEBUG'
assert record.name == __name__
assert msg in caplog.text
# writer test
assert not writer.error_occurred.called
writer.debug.<API key>(msg)
# global status test
assert not output.error_occurred
def <API key>(self, caplog):
# preparation
writer = self._mock_writer()
msg = 'test format %02d %s'
args = (1, '2nd')
output.debug(msg, *args)
# logging test
for record in caplog.records:
assert record.levelname == 'DEBUG'
assert record.name == __name__
assert msg % args in caplog.text
# writer test
assert not writer.error_occurred.called
writer.debug.<API key>(msg, *args)
# global status test
assert not output.error_occurred
def test_debug_error(self, caplog):
# preparation
writer = self._mock_writer()
msg = 'test message'
output.debug(msg, is_error=True)
# logging test
for record in caplog.records:
assert record.levelname == 'DEBUG'
assert record.name == __name__
assert msg in caplog.text
# writer test
writer.error_occurred.<API key>()
writer.debug.<API key>(msg)
# global status test
assert output.error_occurred
def <API key>(self):
# preparation
self._mock_writer()
with pytest.raises(TypeError):
output.debug('message', bad_arg=True)
def test_info(self, caplog):
# preparation
writer = self._mock_writer()
msg = 'test message'
output.info(msg)
# logging test
for record in caplog.records:
assert record.levelname == 'INFO'
assert record.name == __name__
assert msg in caplog.text
# writer test
assert not writer.error_occurred.called
writer.info.<API key>(msg)
# global status test
assert not output.error_occurred
def test_info_with_args(self, caplog):
# preparation
writer = self._mock_writer()
msg = 'test format %02d %s'
args = (1, '2nd')
output.info(msg, *args)
# logging test
for record in caplog.records:
assert record.levelname == 'INFO'
assert record.name == __name__
assert msg % args in caplog.text
# writer test
assert not writer.error_occurred.called
writer.info.<API key>(msg, *args)
# global status test
assert not output.error_occurred
def test_info_error(self, caplog):
# preparation
writer = self._mock_writer()
msg = 'test message'
output.info(msg, is_error=True)
# logging test
for record in caplog.records:
assert record.levelname == 'INFO'
assert record.name == __name__
assert msg in caplog.text
# writer test
writer.error_occurred.<API key>()
writer.info.<API key>(msg)
# global status test
assert output.error_occurred
def test_warning(self, caplog):
# preparation
writer = self._mock_writer()
msg = 'test message'
output.warning(msg)
# logging test
for record in caplog.records:
assert record.levelname == 'WARNING'
assert record.name == __name__
assert msg in caplog.text
# writer test
assert not writer.error_occurred.called
writer.warning.<API key>(msg)
# global status test
assert not output.error_occurred
def <API key>(self, caplog):
# preparation
writer = self._mock_writer()
msg = 'test format %02d %s'
args = (1, '2nd')
output.warning(msg, *args)
# logging test
for record in caplog.records:
assert record.levelname == 'WARNING'
assert record.name == __name__
assert msg % args in caplog.text
# writer test
assert not writer.error_occurred.called
writer.warning.<API key>(msg, *args)
# global status test
assert not output.error_occurred
def test_warning_error(self, caplog):
# preparation
writer = self._mock_writer()
msg = 'test message'
output.warning(msg, is_error=True)
# logging test
for record in caplog.records:
assert record.levelname == 'WARNING'
assert record.name == __name__
assert msg in caplog.text
# writer test
writer.error_occurred.<API key>()
writer.warning.<API key>(msg)
# global status test
assert output.error_occurred
def test_error(self, caplog):
# preparation
writer = self._mock_writer()
msg = 'test message'
output.error(msg)
# logging test
for record in caplog.records:
assert record.levelname == 'ERROR'
assert record.name == __name__
assert msg in caplog.text
# writer test
writer.error_occurred.<API key>()
writer.error.<API key>(msg)
# global status test
assert output.error_occurred
def <API key>(self, caplog):
# preparation
writer = self._mock_writer()
msg = 'test format %02d %s'
args = (1, '2nd')
output.error(msg, *args)
# logging test
for record in caplog.records:
assert record.levelname == 'ERROR'
assert record.name == __name__
assert msg % args in caplog.text
# writer test
writer.error_occurred.<API key>()
writer.error.<API key>(msg, *args)
# global status test
assert output.error_occurred
def <API key>(self, caplog):
# preparation
writer = self._mock_writer()
msg = 'test format %02d %s'
args = (1, '2nd')
output.error(msg, ignore=True, *args)
# logging test
for record in caplog.records:
assert record.levelname == 'ERROR'
assert record.name == __name__
assert msg % args in caplog.text
# writer test
assert not writer.error_occurred.called
writer.error.<API key>(msg, *args)
# global status test
assert not output.error_occurred
def test_exception(self, caplog):
# preparation
writer = self._mock_writer()
msg = 'test message'
try:
raise ValueError('test exception')
except ValueError:
output.exception(msg)
# logging test
for record in caplog.records:
assert record.levelname == 'ERROR'
assert record.name == __name__
assert msg in caplog.text
assert 'Traceback' in caplog.text
# writer test
writer.error_occurred.<API key>()
writer.exception.<API key>(msg)
# global status test
assert output.error_occurred
def <API key>(self, caplog):
# preparation
writer = self._mock_writer()
msg = 'test format %02d %s'
args = (1, '2nd')
try:
raise ValueError('test exception')
except ValueError:
output.exception(msg, *args)
# logging test
for record in caplog.records:
assert record.levelname == 'ERROR'
assert record.name == __name__
assert msg % args in caplog.text
assert 'Traceback' in caplog.text
# writer test
writer.error_occurred.<API key>()
writer.exception.<API key>(msg, *args)
# global status test
assert output.error_occurred
def <API key>(self, caplog):
# preparation
writer = self._mock_writer()
msg = 'test format %02d %s'
args = (1, '2nd')
try:
raise ValueError('test exception')
except ValueError:
output.exception(msg, ignore=True, *args)
# logging test
for record in caplog.records:
assert record.levelname == 'ERROR'
assert record.name == __name__
assert msg % args in caplog.text
assert 'Traceback' in caplog.text
# writer test
assert not writer.error_occurred.called
writer.exception.<API key>(msg, *args)
# global status test
assert not output.error_occurred
def <API key>(self, caplog):
# preparation
writer = self._mock_writer()
msg = 'test format %02d %s'
args = (1, '2nd')
try:
raise ValueError('test exception')
except ValueError:
with pytest.raises(ValueError):
output.exception(msg, raise_exception=True, *args)
# logging test
for record in caplog.records:
assert record.levelname == 'ERROR'
assert record.name == __name__
assert msg % args in caplog.text
assert 'Traceback' in caplog.text
# writer test
writer.error_occurred.<API key>()
writer.exception.<API key>(msg, *args)
# global status test
assert output.error_occurred
def <API key>(self, caplog):
# preparation
writer = self._mock_writer()
msg = 'test format %02d %s'
args = (1, '2nd')
try:
raise ValueError('test exception')
except ValueError:
with pytest.raises(KeyError):
output.exception(msg, raise_exception=KeyError(), *args)
# logging test
for record in caplog.records:
assert record.levelname == 'ERROR'
assert record.name == __name__
assert msg % args in caplog.text
assert 'Traceback' in caplog.text
# writer test
writer.error_occurred.<API key>()
writer.exception.<API key>(msg, *args)
# global status test
assert output.error_occurred
def <API key>(self, caplog):
# preparation
writer = self._mock_writer()
msg = 'test format %02d %s'
args = (1, '2nd')
try:
raise ValueError('test exception')
except ValueError:
with pytest.raises(KeyError):
output.exception(msg, raise_exception=KeyError, *args)
assert msg % args in caplog.text
assert 'Traceback' in caplog.text
# logging test
for record in caplog.records:
assert record.levelname == 'ERROR'
assert record.name == __name__
# writer test
writer.error_occurred.<API key>()
writer.exception.<API key>(msg, *args)
# global status test
assert output.error_occurred
def test_init(self):
# preparation
writer = self._mock_writer()
args = ('1', 'two')
kwargs = dict(three=3, four=5)
output.init('command', *args, **kwargs)
output.init('another_command')
# writer test
writer.init_command.<API key>(*args, **kwargs)
writer.<API key>.<API key>()
@mock.patch('sys.exit')
def <API key>(self, exit_mock, caplog):
# preparation
writer = self._mock_writer()
del writer.init_bad_command
output.init('bad_command')
# logging test
for record in caplog.records:
assert record.levelname == 'ERROR'
assert 'bad_command' in caplog.text
assert 'Traceback' in caplog.text
# writer test
writer.error_occurred.<API key>()
assert writer.exception.call_count == 1
# exit with error
assert exit_mock.called
assert exit_mock.call_count == 1
assert exit_mock.call_args[0] != 0
def test_result(self):
# preparation
writer = self._mock_writer()
args = ('1', 'two')
kwargs = dict(three=3, four=5)
output.result('command', *args, **kwargs)
output.result('another_command')
# writer test
writer.result_command.<API key>(*args, **kwargs)
writer.<API key>.<API key>()
@mock.patch('sys.exit')
def <API key>(self, exit_mock, caplog):
# preparation
writer = self._mock_writer()
del writer.result_bad_command
output.result('bad_command')
# logging test
for record in caplog.records:
assert record.levelname == 'ERROR'
assert 'bad_command' in caplog.text
assert 'Traceback' in caplog.text
# writer test
writer.error_occurred.<API key>()
assert writer.exception.call_count == 1
# exit with error
assert exit_mock.called
assert exit_mock.call_count == 1
assert exit_mock.call_args[0] != 0
def test_close(self):
# preparation
writer = self._mock_writer()
output.close()
writer.close.<API key>()
@mock.patch('sys.exit')
def test_close_and_exit(self, exit_mock):
# preparation
writer = self._mock_writer()
output.close_and_exit()
writer.close.<API key>()
exit_mock.<API key>(0)
@mock.patch('sys.exit')
def <API key>(self, exit_mock):
# preparation
writer = self._mock_writer()
output.error_occurred = True
output.close_and_exit()
writer.close.<API key>()
assert exit_mock.called
assert exit_mock.call_count == 1
assert exit_mock.call_args[0] != 0
# noinspection PyMethodMayBeStatic
class TestConsoleWriter(object):
def test_debug(self, capsys):
writer = output.ConsoleOutputWriter(debug=True)
msg = 'test message'
writer.debug(msg)
(out, err) = capsys.readouterr()
assert out == ''
assert err == 'DEBUG: ' + msg + '\n'
msg = 'test arg %s'
args = ('1st',)
writer.debug(msg, *args)
(out, err) = capsys.readouterr()
assert out == ''
assert err == 'DEBUG: ' + msg % args + '\n'
msg = 'test args %d %s'
args = (1, 'two')
writer.debug(msg, *args)
(out, err) = capsys.readouterr()
assert out == ''
assert err == 'DEBUG: ' + msg % args + '\n'
msg = 'test kwargs %(num)d %(string)s'
kwargs = dict(num=1, string='two')
writer.debug(msg, kwargs)
(out, err) = capsys.readouterr()
assert out == ''
assert err == 'DEBUG: ' + msg % kwargs + '\n'
def test_debug_disabled(self, capsys):
writer = output.ConsoleOutputWriter(debug=False)
msg = 'test message'
writer.debug(msg)
(out, err) = capsys.readouterr()
assert out == ''
assert err == ''
msg = 'test arg %s'
args = ('1st',)
writer.debug(msg, *args)
(out, err) = capsys.readouterr()
assert out == ''
assert err == ''
msg = 'test args %d %s'
args = (1, 'two')
writer.debug(msg, *args)
(out, err) = capsys.readouterr()
assert out == ''
assert err == ''
msg = 'test kwargs %(num)d %(string)s'
kwargs = dict(num=1, string='two')
writer.debug(msg, kwargs)
(out, err) = capsys.readouterr()
assert out == ''
assert err == ''
def test_info_verbose(self, capsys):
writer = output.ConsoleOutputWriter(quiet=False)
msg = 'test message'
writer.info(msg)
(out, err) = capsys.readouterr()
assert out == msg + '\n'
assert err == ''
msg = 'test arg %s'
args = ('1st',)
writer.info(msg, *args)
(out, err) = capsys.readouterr()
assert out == msg % args + '\n'
assert err == ''
msg = 'test args %d %s'
args = (1, 'two')
writer.info(msg, *args)
(out, err) = capsys.readouterr()
assert out == msg % args + '\n'
assert err == ''
msg = 'test kwargs %(num)d %(string)s'
kwargs = dict(num=1, string='two')
writer.info(msg, kwargs)
(out, err) = capsys.readouterr()
assert out == msg % kwargs + '\n'
assert err == ''
def test_info_quiet(self, capsys):
writer = output.ConsoleOutputWriter(quiet=True)
msg = 'test message'
writer.info(msg)
(out, err) = capsys.readouterr()
assert out == ''
assert err == ''
msg = 'test arg %s'
args = ('1st',)
writer.info(msg, *args)
(out, err) = capsys.readouterr()
assert out == ''
assert err == ''
msg = 'test args %d %s'
args = (1, 'two')
writer.info(msg, *args)
(out, err) = capsys.readouterr()
assert out == ''
assert err == ''
msg = 'test kwargs %(num)d %(string)s'
kwargs = dict(num=1, string='two')
writer.info(msg, kwargs)
(out, err) = capsys.readouterr()
assert out == ''
assert err == ''
def test_warning(self, capsys):
writer = output.ConsoleOutputWriter()
msg = 'test message'
writer.warning(msg)
(out, err) = capsys.readouterr()
assert out == ''
assert err == 'WARNING: ' + msg + '\n'
msg = 'test arg %s'
args = ('1st',)
writer.warning(msg, *args)
(out, err) = capsys.readouterr()
assert out == ''
assert err == 'WARNING: ' + msg % args + '\n'
msg = 'test args %d %s'
args = (1, 'two')
writer.warning(msg, *args)
(out, err) = capsys.readouterr()
assert out == ''
assert err == 'WARNING: ' + msg % args + '\n'
msg = 'test kwargs %(num)d %(string)s'
kwargs = dict(num=1, string='two')
writer.warning(msg, kwargs)
(out, err) = capsys.readouterr()
assert out == ''
assert err == 'WARNING: ' + msg % kwargs + '\n'
def test_error(self, capsys):
writer = output.ConsoleOutputWriter()
msg = 'test message'
writer.error(msg)
(out, err) = capsys.readouterr()
assert out == ''
assert err == 'ERROR: ' + msg + '\n'
msg = 'test arg %s'
args = ('1st',)
writer.error(msg, *args)
(out, err) = capsys.readouterr()
assert out == ''
assert err == 'ERROR: ' + msg % args + '\n'
msg = 'test args %d %s'
args = (1, 'two')
writer.error(msg, *args)
(out, err) = capsys.readouterr()
assert out == ''
assert err == 'ERROR: ' + msg % args + '\n'
msg = 'test kwargs %(num)d %(string)s'
kwargs = dict(num=1, string='two')
writer.error(msg, kwargs)
(out, err) = capsys.readouterr()
assert out == ''
assert err == 'ERROR: ' + msg % kwargs + '\n'
def test_exception(self, capsys):
writer = output.ConsoleOutputWriter()
msg = 'test message'
writer.exception(msg)
(out, err) = capsys.readouterr()
assert out == ''
assert err == 'EXCEPTION: ' + msg + '\n'
msg = 'test arg %s'
args = ('1st',)
writer.exception(msg, *args)
(out, err) = capsys.readouterr()
assert out == ''
assert err == 'EXCEPTION: ' + msg % args + '\n'
msg = 'test args %d %s'
args = (1, 'two')
writer.exception(msg, *args)
(out, err) = capsys.readouterr()
assert out == ''
assert err == 'EXCEPTION: ' + msg % args + '\n'
msg = 'test kwargs %(num)d %(string)s'
kwargs = dict(num=1, string='two')
writer.exception(msg, kwargs)
(out, err) = capsys.readouterr()
assert out == ''
assert err == 'EXCEPTION: ' + msg % kwargs + '\n'
def test_init_check(self, capsys):
writer = output.ConsoleOutputWriter()
server = 'test'
writer.init_check(server, True)
(out, err) = capsys.readouterr()
assert out == 'Server %s:\n' % server
assert err == ''
def <API key>(self, capsys):
writer = output.ConsoleOutputWriter()
output.error_occurred = False
server = 'test'
check = 'test check'
writer.result_check(server, check, True)
(out, err) = capsys.readouterr()
assert out == '\t%s: OK\n' % check
assert err == ''
assert not output.error_occurred
def <API key>(self, capsys):
writer = output.ConsoleOutputWriter()
output.error_occurred = False
server = 'test'
check = 'test check'
hint = 'do something'
writer.result_check(server, check, True, hint)
(out, err) = capsys.readouterr()
assert out == '\t%s: OK (%s)\n' % (check, hint)
assert err == ''
assert not output.error_occurred
def <API key>(self, capsys):
writer = output.ConsoleOutputWriter()
output.error_occurred = False
server = 'test'
check = 'test check'
writer.result_check(server, check, False)
(out, err) = capsys.readouterr()
assert out == '\t%s: FAILED\n' % check
assert err == ''
assert output.error_occurred
# Test an inactive server
# Shows error, but does not change error_occurred
output.error_occurred = False
writer.init_check(server, False)
(out, err) = capsys.readouterr()
assert out == 'Server %s:\n' % server
assert err == ''
assert not output.error_occurred
writer.result_check(server, check, False)
(out, err) = capsys.readouterr()
assert out == '\t%s: FAILED\n' % check
assert err == ''
assert not output.error_occurred
def <API key>(self, capsys):
writer = output.ConsoleOutputWriter()
output.error_occurred = False
server = 'test'
check = 'test check'
hint = 'do something'
writer.result_check(server, check, False, hint)
(out, err) = capsys.readouterr()
assert out == '\t%s: FAILED (%s)\n' % (check, hint)
assert err == ''
assert output.error_occurred
def <API key>(self):
writer = output.ConsoleOutputWriter()
writer.init_list_backup('test server')
assert not writer.minimal
writer.init_list_backup('test server', True)
assert writer.minimal
def <API key>(self, capsys):
# mock the backup info
bi = <API key>()
backup_size = 12345
wal_size = 54321
retention_status = 'test status'
writer = output.ConsoleOutputWriter()
# test minimal
writer.init_list_backup(bi.server_name, True)
writer.result_list_backup(bi, backup_size, wal_size, retention_status)
writer.close()
(out, err) = capsys.readouterr()
assert writer.minimal
assert bi.backup_id in out
assert err == ''
# test status=DONE output
writer.init_list_backup(bi.server_name, False)
writer.result_list_backup(bi, backup_size, wal_size, retention_status)
writer.close()
(out, err) = capsys.readouterr()
assert not writer.minimal
assert bi.server_name in out
assert bi.backup_id in out
assert str(bi.end_time.ctime()) in out
for name, _, location in bi.tablespaces:
assert '%s:%s' % (name, location)
assert 'Size: ' + pretty_size(backup_size) in out
assert 'WAL Size: ' + pretty_size(wal_size) in out
assert err == ''
# test status = FAILED output
bi = <API key>(status=BackupInfo.FAILED)
writer.init_list_backup(bi.server_name, False)
writer.result_list_backup(bi, backup_size, wal_size, retention_status)
writer.close()
(out, err) = capsys.readouterr()
assert not writer.minimal
assert bi.server_name in out
assert bi.backup_id in out
assert bi.status in out
def <API key>(self, capsys):
# mock the backup ext info
wal_per_second = 0.01
ext_info = <API key>(wals_per_second=wal_per_second)
writer = output.ConsoleOutputWriter()
# test minimal
writer.result_show_backup(ext_info)
writer.close()
(out, err) = capsys.readouterr()
assert ext_info['server_name'] in out
assert ext_info['backup_id'] in out
assert ext_info['status'] in out
assert str(ext_info['end_time']) in out
for name, _, location in ext_info['tablespaces']:
assert '%s: %s' % (name, location) in out
assert (pretty_size(ext_info['size'] + ext_info['wal_size'])) in out
assert (pretty_size(ext_info['wal_until_next_size'])) in out
assert 'WAL rate : %0.2f/hour' % \
(wal_per_second * 3600) in out
# TODO: this test can be expanded
assert err == ''
def <API key>(self, capsys):
# mock the backup ext info
msg = 'test error message'
ext_info = <API key>(status=BackupInfo.FAILED, error=msg)
writer = output.ConsoleOutputWriter()
# test minimal
writer.result_show_backup(ext_info)
writer.close()
(out, err) = capsys.readouterr()
assert ext_info['server_name'] in out
assert ext_info['backup_id'] in out
assert ext_info['status'] in out
assert str(ext_info['end_time']) not in out
assert msg in out
assert err == ''
def test_init_status(self, capsys):
writer = output.ConsoleOutputWriter()
server = 'test'
writer.init_status(server)
(out, err) = capsys.readouterr()
assert out == 'Server %s:\n' % server
assert err == ''
def test_result_status(self, capsys):
writer = output.ConsoleOutputWriter()
server = 'test'
name = 'test name'
description = 'test description'
message = 'test message'
writer.result_status(server, name, description, message)
(out, err) = capsys.readouterr()
assert out == '\t%s: %s\n' % (description, message)
assert err == ''
def <API key>(self, capsys):
writer = output.ConsoleOutputWriter()
server = 'test'
name = 'test name'
description = 'test description'
message = 1
writer.result_status(server, name, description, message)
(out, err) = capsys.readouterr()
assert out == '\t%s: %s\n' % (description, message)
assert err == ''
# noinspection PyMethodMayBeStatic
class TestNagiosWriter(object):
def test_debug(self, capsys):
writer = output.NagiosOutputWriter()
msg = 'test message'
writer.debug(msg)
(out, err) = capsys.readouterr()
assert out == ''
assert err == ''
msg = 'test arg %s'
args = ('1st',)
writer.debug(msg, *args)
(out, err) = capsys.readouterr()
assert out == ''
assert err == ''
msg = 'test args %d %s'
args = (1, 'two')
writer.debug(msg, *args)
(out, err) = capsys.readouterr()
assert out == ''
assert err == ''
msg = 'test kwargs %(num)d %(string)s'
kwargs = dict(num=1, string='two')
writer.debug(msg, kwargs)
(out, err) = capsys.readouterr()
assert out == ''
assert err == ''
def test_debug_disabled(self, capsys):
writer = output.NagiosOutputWriter(debug=False)
msg = 'test message'
writer.debug(msg)
(out, err) = capsys.readouterr()
assert out == ''
assert err == ''
msg = 'test arg %s'
args = ('1st',)
writer.debug(msg, *args)
(out, err) = capsys.readouterr()
assert out == ''
assert err == ''
msg = 'test args %d %s'
args = (1, 'two')
writer.debug(msg, *args)
(out, err) = capsys.readouterr()
assert out == ''
assert err == ''
msg = 'test kwargs %(num)d %(string)s'
kwargs = dict(num=1, string='two')
writer.debug(msg, kwargs)
(out, err) = capsys.readouterr()
assert out == ''
assert err == ''
def test_info(self, capsys):
writer = output.NagiosOutputWriter()
msg = 'test message'
writer.info(msg)
(out, err) = capsys.readouterr()
assert out == ''
assert err == ''
msg = 'test arg %s'
args = ('1st',)
writer.info(msg, *args)
(out, err) = capsys.readouterr()
assert out == ''
assert err == ''
msg = 'test args %d %s'
args = (1, 'two')
writer.info(msg, *args)
(out, err) = capsys.readouterr()
assert out == ''
assert err == ''
msg = 'test kwargs %(num)d %(string)s'
kwargs = dict(num=1, string='two')
writer.info(msg, kwargs)
(out, err) = capsys.readouterr()
assert out == ''
assert err == ''
def test_warning(self, capsys):
writer = output.NagiosOutputWriter()
msg = 'test message'
writer.warning(msg)
(out, err) = capsys.readouterr()
assert out == ''
assert err == ''
msg = 'test arg %s'
args = ('1st',)
writer.warning(msg, *args)
(out, err) = capsys.readouterr()
assert out == ''
assert err == ''
msg = 'test args %d %s'
args = (1, 'two')
writer.warning(msg, *args)
(out, err) = capsys.readouterr()
assert out == ''
assert err == ''
msg = 'test kwargs %(num)d %(string)s'
kwargs = dict(num=1, string='two')
writer.warning(msg, kwargs)
(out, err) = capsys.readouterr()
assert out == ''
assert err == ''
def test_error(self, capsys):
writer = output.NagiosOutputWriter()
msg = 'test message'
writer.error(msg)
(out, err) = capsys.readouterr()
assert out == ''
assert err == ''
msg = 'test arg %s'
args = ('1st',)
writer.error(msg, *args)
(out, err) = capsys.readouterr()
assert out == ''
assert err == ''
msg = 'test args %d %s'
args = (1, 'two')
writer.error(msg, *args)
(out, err) = capsys.readouterr()
assert out == ''
assert err == ''
msg = 'test kwargs %(num)d %(string)s'
kwargs = dict(num=1, string='two')
writer.error(msg, kwargs)
(out, err) = capsys.readouterr()
assert out == ''
assert err == ''
def test_exception(self, capsys):
writer = output.NagiosOutputWriter()
msg = 'test message'
writer.exception(msg)
(out, err) = capsys.readouterr()
assert out == ''
assert err == ''
msg = 'test arg %s'
args = ('1st',)
writer.exception(msg, *args)
(out, err) = capsys.readouterr()
assert out == ''
assert err == ''
msg = 'test args %d %s'
args = (1, 'two')
writer.exception(msg, *args)
(out, err) = capsys.readouterr()
assert out == ''
assert err == ''
msg = 'test kwargs %(num)d %(string)s'
kwargs = dict(num=1, string='two')
writer.exception(msg, kwargs)
(out, err) = capsys.readouterr()
assert out == ''
assert err == ''
def <API key>(self, capsys):
writer = output.NagiosOutputWriter()
output.error_occurred = False
# one server with no error
writer.result_check('a', 'test', True, None)
writer.close()
(out, err) = capsys.readouterr()
assert out == 'BARMAN OK - Ready to serve the Espresso backup ' \
'for a\n'
assert err == ''
assert not output.error_occurred
def test_result_check(self, capsys):
writer = output.NagiosOutputWriter()
output.error_occurred = False
# three server with no error
writer.result_check('a', 'test', True, None)
writer.result_check('b', 'test', True, None)
writer.result_check('c', 'test', True, None)
writer.close()
(out, err) = capsys.readouterr()
assert out == 'BARMAN OK - Ready to serve the Espresso backup ' \
'for 3 server(s) * a * b * c\n'
assert err == ''
assert not output.error_occurred
def <API key>(self, capsys):
writer = output.NagiosOutputWriter()
output.error_occurred = False
# one server with one error
writer.result_check('a', 'test', False, None)
writer.close()
(out, err) = capsys.readouterr()
assert out == 'BARMAN CRITICAL - server a has issues * ' \
'a FAILED: test\na.test: FAILED\n'
assert err == ''
assert output.error_occurred
assert output.error_exit_code == 2
def <API key>(self, capsys):
writer = output.NagiosOutputWriter()
output.error_occurred = False
# three server with one error
writer.result_check('a', 'test', True, None)
writer.result_check('b', 'test', False, None)
writer.result_check('c', 'test', True, None)
writer.close()
(out, err) = capsys.readouterr()
assert out == 'BARMAN CRITICAL - 1 server out of 3 have issues * ' \
'b FAILED: test\nb.test: FAILED\n'
assert err == ''
assert output.error_occurred
assert output.error_exit_code == 2 |
import os
import sys
import json
import yaml
import getpass
import boto
"""
Configure VDC instance, or read config'd settings into class
This will read a default yaml file and output to a instance-specific file,
to be read by processes as needed
"""
from reporting import ErrorObject
from global_vars import *
class OVConfig:
def __init__(self, configure=False, **kwargs):
"""
Attempt to open and read yaml file
"""
self.configure = configure
self.settings_yaml = kwargs.get(
'settings_yaml',
os.path.join(
os.path.dirname(os.path.dirname(os.path.abspath(__file__))),
'instance_config.yaml'
)
)
self.settings_dict = {}
self.encode_library = None
def run(self):
if self.configure is True:
self._configure()
if self.configure is False:
self._read_settings()
self.<API key>()
def <API key>(self):
"""
Do the necessaries
"""
try:
self.settings_dict['workdir']
except:
return None
if not os.path.exists(self.settings_dict['workdir']):
os.mkdir(self.settings_dict['workdir'])
"""
BOTO Config
"""
try:
boto.config.add_section('Boto')
except:
pass
boto.config.set(
'Boto','http_socket_timeout',
str(BOTO_TIMEOUT)
)
def _read_settings(self):
"""
Read Extant Settings or Generate New Ones
"""
if not os.path.exists(self.settings_yaml):
self.settings_yaml = DEFAULT_YAML
if not os.path.exists(self.settings_yaml):
return None
with open(self.settings_yaml, 'r') as stream:
try:
self.settings_dict = yaml.load(stream)
except yaml.YAMLError as exc:
raise ErrorObject().print_error(
message='Invalid Config YAML'
)
if self.settings_dict['workdir'] is None or \
len(self.settings_dict['workdir']) == 0:
self.settings_dict['workdir'] = os.path.join(
os.path.dirname(os.path.dirname(os.path.abspath(__file__))),
'VEDA_WORKING'
)
self.settings_dict['encode_library'] = self.<API key>()
if not os.path.exists(os.path.join(
os.path.dirname(os.path.dirname(os.path.abspath(__file__))),
'ffmpeg_binary.yaml'
)):
self.settings_dict['ffmpeg'] = 'ffmpeg'
self.settings_dict['ffprobe'] = 'ffprobe'
else:
with open(os.path.join(
os.path.dirname(os.path.dirname(os.path.abspath(__file__))),
'ffmpeg_binary.yaml'
), 'r') as stream:
ffdict = yaml.load(stream)
self.settings_dict['ffmpeg'] = ffdict['ffmpeg']
self.settings_dict['ffprobe'] = ffdict['ffprobe']
def _configure(self):
config_list = [
'workdir',
'aws_storage_bucket',
'aws_deliver_bucket',
'aws_ingest_bucket',
'val_token_url',
'val_api_url',
'val_username',
'val_password',
'val_client_id',
'val_secret_key',
]
<API key> = {
'workdir': 'VEDA Working Directory [defaults to repo dir]',
'aws_storage_bucket': 'AWS S3 Storage Bucket Name: ',
'aws_deliver_bucket': 'AWS S3 Deliver Bucket Name: ',
'aws_ingest_bucket': 'Studio Ingest Bucket Name [optional]: ',
'val_token_url': 'VAL Token URL [optional]: ',
'val_api_url': 'VAL API URL: ',
'val_username': 'VAL Username: ',
'val_password': 'P VAL Password: ',
'val_client_id': 'VAL Client ID: ',
'val_secret_key': 'P VAL Secret Key: ',
}
def _input_pretty(parameter):
"""
Just to make this more polite
"""
if 'P ' in <API key>[c]:
print '--Input Hidden
new_value = getpass.getpass(
<API key>[c].replace('P ', '')
)
else:
new_value = raw_input(<API key>[c])
return new_value
val = None
for c in config_list:
if 'val' not in c:
param = _input_pretty(parameter=c)
elif c == 'val_token_url':
param = _input_pretty(parameter=c)
if param is None or len(param) == 0:
val = False
param = None
else:
if val is not False:
param = _input_pretty(parameter=c)
else:
param = None
self.settings_dict[c] = param
with open(self.settings_yaml, 'w') as outfile:
outfile.write(
yaml.dump(
self.settings_dict,
default_flow_style=False
)
)
self._read_settings()
self.ENCODE_PROFILES = self.<API key>()
def <API key>(self):
if self.encode_library is None:
self.encode_library = os.path.join(
os.path.dirname(os.path.dirname(
os.path.abspath(__file__))
),
'<API key>.json'
)
with open(self.encode_library) as data_file:
data = json.load(data_file)
return data["ENCODE_PROFILES"]
def main():
"""
For example
"""
veda_configuration = OVConfig(settings_yaml=DEFAULT_YAML)
veda_configuration.run()
if __name__ == '__main__':
sys.exit(main()) |
**ABOUT**
This program resides in /home/flag14/flag14. It encrypts input and writes it to standard output. An encrypted token file is also in that home directory, decrypt it :)
**Source**
No source included. It's left up to you to figure out how the application encrypts and decrypts the data.
**Walkthrough**
See the [Walkthrough Document](./WALKTHROUGH.md) for the solution |
using CP77.CR2W.Reflection;
namespace CP77.CR2W.Types
{
[REDMeta]
public class <API key> : redEvent
{
public <API key>(CR2WFile cr2w, CVariable parent, string name) : base(cr2w, parent, name) { }
}
} |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using GeneratorLib;
namespace Spooky2
{
class Spooky2Preset : IProgram
{
// Typically a file
string Path { get; }
public string Name => System.IO.Path.<API key>(Path);
IProgram[] steps;
public IEnumerable<IProgram> Programs { get { Load(); return steps; } }
public IEnumerable<IStep> Steps => Enumerable.Empty<IStep>();
public TimeSpan Duration(RunningOptions options) => Programs.Aggregate(default(TimeSpan), (a, b) => a + b.Duration(options));
public string PresetName { get; private set; }
string description;
public string Description { get { Load(); return description; } }
bool loaded = false;
void Load()
{
if (loaded) return;
var contents = FileUtils.ParseKeyValues(FileUtils.ReadQuotedLines(Path));
List<string> programs = new List<string>();
List<string> frequencies = new List<string>();
foreach (var c in contents)
{
if (c.Key == "PresetName")
PresetName = c.Value;
else if (c.Key == "Preset_Notes")
description = c.Value;
else if (c.Key == "Loaded_Programs")
programs.Add(c.Value);
else if (c.Key == "Loaded_Frequencies")
frequencies.Add(c.Value);
}
// !! Read the step size from the preset
steps = programs.Zip(frequencies, (p, f) => new Spooky2Program(p, f, 180)).ToArray();
loaded = true;
}
public Spooky2Preset(string filename)
{
Path = filename;
}
public IEnumerable<ICommand> Commands => Enumerable.Empty<ICommand>();
}
public class Spooky2Program : IProgram
{
public string Description => Name;
public Spooky2Program(string name, string command, double stepSize)
{
Name = name;
commands = ProgramParser.Parse(command).ToArray();
// Debug - reconstruct the program.
var debug = StoredProgramData.SetCommands(commands);
if (debug != command)
{
}
}
IStep[] commands;
public string Name { get; private set; }
public IEnumerable<IProgram> Programs => Enumerable.Empty<IProgram>();
public IEnumerable<IStep> Steps => commands;
public TimeSpan Duration(RunningOptions options) => Steps.Aggregate(default(TimeSpan), (a, b) => a + b.Duration(options));
public IEnumerable<ICommand> Commands => Enumerable.Empty<ICommand>();
}
} |
// KERNEL TO EXTRAPOLATE SINGLE TIME STEP - CONSTANT DENSITY TIPO_EQUACAO = 0
void <API key>(float* gU0, float* gU1, float* gVorg,
int nnoi, int nnoj, int k0, int k1,
float FATMDFX, float FATMDFY, float FATMDFZ, float *W){
int index_X, index_Y; // X, Y grid position
int stride = nnoi * nnoj; // stride to next Z
int index, k;
#pragma omp parallel for default(shared) private(index_X, index_Y, index, k)
for(index_X = 0; index_X < nnoi; index_X++)
for(k = 0; k < k1 - k0; k++){
#pragma simd
for(index_Y = 0; index_Y < nnoj; index_Y++){
index = (index_Y * nnoi + index_X) + (k0 + k) * stride;
// Wavefield Extrapolation Only on Interior Points
if(gVorg[index] > 0.0f){
gU1[index] = 2.0f * gU0[index] - gU1[index]
+ FATMDFX * gVorg[index] * gVorg[index] * (
+ W[6] * (gU0[index - 6] + gU0[index + 6])
+ W[5] * (gU0[index - 5] + gU0[index + 5])
+ W[4] * (gU0[index - 4] + gU0[index + 4])
+ W[3] * (gU0[index - 3] + gU0[index + 3])
+ W[2] * (gU0[index - 2] + gU0[index + 2])
+ W[1] * (gU0[index - 1] + gU0[index + 1])
+ W[0] * gU0[index]
)
+ FATMDFY * gVorg[index] * gVorg[index] * (
+ W[6] * (gU0[index - 6 * nnoi] + gU0[index + 6 * nnoi])
+ W[5] * (gU0[index - 5 * nnoi] + gU0[index + 5 * nnoi])
+ W[4] * (gU0[index - 4 * nnoi] + gU0[index + 4 * nnoi])
+ W[3] * (gU0[index - 3 * nnoi] + gU0[index + 3 * nnoi])
+ W[2] * (gU0[index - 2 * nnoi] + gU0[index + 2 * nnoi])
+ W[1] * (gU0[index - nnoi] + gU0[index + nnoi])
+ W[0] * gU0[index]
)
+ FATMDFZ * gVorg[index] * gVorg[index] * (
+ W[6] * (gU0[index + 6 * stride] + gU0[index - 6 * stride])
+ W[5] * (gU0[index + 5 * stride] + gU0[index - 5 * stride])
+ W[4] * (gU0[index + 4 * stride] + gU0[index - 4 * stride])
+ W[3] * (gU0[index + 3 * stride] + gU0[index - 3 * stride])
+ W[2] * (gU0[index + 2 * stride] + gU0[index - 2 * stride])
+ W[1] * (gU0[index + stride] + gU0[index - stride])
+ W[0] * gU0[index]
);
} // end if
} // end for k
}
} // end function |
<?php
namespace Investigaciones;
/**
* Clase <API key>
*/
class <API key> extends \Base\Publicacion {
/**
* Constructor
*/
public function __construct() {
$this->nombre = 'Profesionistas Torreón - Metodología';
$this->autor = 'CIDAC';
$this->fecha = '2016-04-25T14:30';
$this->archivo = '<API key>';
$this->imagen = '<API key>/imagen.png';
$this->imagen_previa = '<API key>/imagen-previa.png';
$this->descripcion = 'Se realizó una encuesta a los establecimientos de los sectores previamente identificados como prioritarios con base a la generación de empleo y valor agregado.';
$this->claves = 'IMPLAN, Torreon';
$this->directorio = 'investigaciones';
$this->nombre_menu = 'Investigaciones';
$this->estado = 'revisar';
$this-><API key> = false;
// El contenido es estructurado en un esquema
$schema = new \Base\SchemaArticle();
$schema->description = $this->descripcion;
$schema->image = $this->imagen;
$schema->image_show = $this-><API key>;
$schema->name = $this->nombre;
$schema->author = $this->autor;
$schema->datePublished = $this->fecha;
$schema->headline_style = $this->encabezado_color;
// El contenido es una instancia de SchemaBlogPosting
$this->contenido = $schema;
$this-><API key> = 'lib/Investigaciones/<API key>.md';
// Para el Organizador
$this->categorias = array('Bienestar', 'Educación', 'Empleo', 'Empresas');
$this->fuentes = array('Centro de Investigación para el Desarrollo, A.C. (CIDAC)');
$this->regiones = array('Torreón', 'Gómez Palacio', 'Lerdo', 'Matamoros', 'La Laguna');
} // constructor
} // Clase <API key>
?> |
from django.db import models
# Create your models here.
class Record(models.Model):
description=models.TextField()
distance=models.IntegerField()
reg_date=models.DateTimeField('date published')
reg_user=models.IntegerField() |
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head>
<title>south florida cars & trucks - all classifieds - craigslist</title>
<meta name="description" content="south florida cars & trucks - all classifieds - craigslist">
<meta name="viewport" content="user-scalable=1;">
<link rel="alternate" type="application/rss+xml" href="/cta/index.rss" title="RSS feed for craigslist | cars & trucks - all in south florida ">
<link type="text/css" rel="stylesheet" media="all" href="http:
<script type="text/javascript" src="http:
<script type="text/javascript" src="http:
<script type="text/javascript" src="http:
<script type="text/javascript" src="http:
<script type="text/javascript"><!
var <API key> = "unmappable items not shown";
var mapViewText = "show on map";
var showImageText = "show images";
var showMapTabs = 0;
var lessInfoText = "less info";
var <API key> = "remove from shortlist";
var shortlistViewText = "shortlist view";
var shortlistNoteText = "SHORTLISTED";
var listViewText = "show as list";
var viewPostingText = "view posting";
var clearShortlistText = "clear shortlist";
var moreInfoText = "more info";
var showInfoText = "show info";
var pagetype = "tocs";
var pID = null;
var addToShortlistText = "add to shortlist";
--></script>
<script type="text/javascript" src="http:
</head>
<body class="toc">
<a name="top"></a>
<div class="bchead">
<span id="ef"><span id="timestamp" style="font-size:small;" title="hide/show images link now near search results.">Mon, 26 Nov 21:45:21</span> [ <a href="http:
<a href="http:
<div id="satabs" class="tabcontainer"><b>all south florida</b><a href="/mdc/cta/">miami / dade</a><a href="/brw/cta/">broward county</a><a href="/pbc/cta/">palm beach co</a></div>
</div>
<blockquote>
<form action="/search/cta" id="searchform" method="get">
<script type="text/javascript"><!
var catAbb = "cta";
--></script>
<script type="text/javascript"><!
function flipCatAndSubmit(cat) {
var sf = document.getElementById('searchform');
var cs = document.getElementById('catAbb');
for(var i=0; i < cs.length; i++) {
if(cs[i].value == cat) {
cs[i].selected = true;
}
}
sf.submit();
}
</script>
<fieldset id="searchfieldset">
<legend id="searchlegend">cars + trucks: <a href="javascript:flipCatAndSubmit('cto');">by-owner</a> | <a href="javascript:flipCatAndSubmit('ctd');">by-dealer</a> | <b>both</b></legend>
<table id="searchtable" width="100%" cellpadding="2" summary="">
<tr>
<td align="right" width="1">search for:</td>
<td colspan="2" width="30%"><input id="query" name="query" size="30" value=""> in:
<select id="catAbb" name="catAbb">
<option value="ccc">all community
<option value="eee">all event
<option value="sss">all for sale / wanted
<option disabled value="">
<option value="ata"> antiques
<option value="atd"> antiques - by dealer
<option value="atq"> antiques - by owner
<option value="ppa"> appliances
<option value="ppd"> appliances - by dealer
<option value="app"> appliances - by owner
<option value="ard"> arts & crafts - by dealer
<option value="art"> arts & crafts - by owner
<option value="ara"> arts+crafts
<option value="pta"> auto parts
<option value="ptd"> auto parts - by dealer
<option value="pts"> auto parts - by owner
<option value="bad"> baby & kid stuff - by dealer
<option value="bab"> baby & kid stuff - by owner
<option value="baa"> baby+kids
<option value="bar"> barter
<option value="haa"> beauty+hlth
<option value="bid"> bicycles - by dealer
<option value="bik"> bicycles - by owner
<option value="bia"> bikes
<option value="boo"> boats
<option value="bod"> boats - by dealer
<option value="boa"> boats - by owner
<option value="bka"> books
<option value="bkd"> books & magazines - by dealer
<option value="bks"> books & magazines - by owner
<option value="bfa"> business
<option value="bfd"> business/commercial - by dealer
<option value="bfs"> business/commercial - by owner
<option value="ctd"> cars & trucks - by dealer
<option value="cto"> cars & trucks - by owner
<option value="cta" selected> cars+trucks
<option value="emq"> cds / dvds / vhs - by dealer
<option value="emd"> cds / dvds / vhs - by owner
<option value="ema"> cds/dvd/vhs
<option value="moa"> cell phones
<option value="mod"> cell phones - by dealer
<option value="mob"> cell phones - by owner
<option value="cla"> clothes+acc
<option value="cld"> clothing & accessories - by deal
<option value="clo"> clothing & accessories - by owne
<option value="cba"> collectibles
<option value="cbd"> collectibles - by dealer
<option value="clt"> collectibles - by owner
<option value="sya"> computers
<option value="syd"> computers - by dealer
<option value="sys"> computers - by owner
<option value="ela"> electronics
<option value="eld"> electronics - by dealer
<option value="ele"> electronics - by owner
<option value="grq"> farm & garden - by dealer
<option value="grd"> farm & garden - by owner
<option value="gra"> farm+garden
<option value="ssq"> for sale by dealer
<option value="sso"> for sale by owner
<option value="zip"> free stuff
<option value="fua"> furniture
<option value="fud"> furniture - by dealer
<option value="fuo"> furniture - by owner
<option value="gms"> garage sales
<option value="foa"> general
<option value="fod"> general for sale - by dealer
<option value="for"> general for sale - by owner
<option value="had"> health and beauty - by dealer
<option value="hab"> health and beauty - by owner
<option value="hsa"> household
<option value="hsd"> household items - by dealer
<option value="hsh"> household items - by owner
<option value="wan"> items wanted
<option value="jwa"> jewelry
<option value="jwd"> jewelry - by dealer
<option value="jwl"> jewelry - by owner
<option value="maa"> materials
<option value="mad"> materials - by dealer
<option value="mat"> materials - by owner
<option value="mca"> motorcycles
<option value="mcd"> motorcycles/scooters - by dealer
<option value="mcy"> motorcycles/scooters - by owner
<option value="msa"> music instr
<option value="msd"> musical instruments - by dealer
<option value="msg"> musical instruments - by owner
<option value="pha"> photo+video
<option value="phd"> photo/video - by dealer
<option value="pho"> photo/video - by owner
<option value="rva"> recreational vehicles
<option value="rvd"> rvs - by dealer
<option value="rvs"> rvs - by owner
<option value="sga"> sporting
<option value="sgd"> sporting goods - by dealer
<option value="spo"> sporting goods - by owner
<option value="tia"> tickets
<option value="tid"> tickets - by dealer
<option value="tix"> tickets - by owner
<option value="tla"> tools
<option value="tld"> tools - by dealer
<option value="tls"> tools - by owner
<option value="tad"> toys & games - by dealer
<option value="tag"> toys & games - by owner
<option value="taa"> toys+games
<option value="vga"> video gaming
<option value="vgd"> video gaming - by dealer
<option value="vgm"> video gaming - by owner
<option disabled value="">
<option value="ggg">all gigs
<option value="hhh">all housing
<option value="jjj">all jobs
<option value="ppp">all personals
<option value="res">all resume
<option value="bbb">all services offered
</select>
</td>
<td>
<label><input type="radio" name="srchType" value="T" checked="checked"
title="search only posting titles">title only</label>
<label><input type="radio" name="srchType" value="A"
title="search the entire posting">entire post</label>
<label id="usemapcheck" style="display:none;"><input type="checkbox" name="useMap" value="1" >show map</label>
<label id="shortlistcheck" style="display:none;"><input type="checkbox" name="shortlistOnly" value="1" >show shortlisted items only</label>
<input type="submit" value="Search">
</td>
</tr>
<tr>
<td align="right" width="1">price:</td>
<td><input name="minAsk" class="min" size="6" value=""> <input name="maxAsk" class="max" size="6" value=""> </td>
<td id="hoodpicker"></td>
<td align="left"><label><input type="checkbox" name="hasPic" value="1">has image</label></td>
</tr>
</table>
</fieldset>
</form>
</blockquote>
<span id="showPics"></span><span id="hidePics"></span>
<blockquote id="toc_rows">
<div id="messagestable" style="width:100%; float:right;">
<div id="messages" style="float:right; vertical-align:top; width:75%;"><span class="hl"><a href="http:
</div>
<div id="tocpix" style="float: left;"><span id="hideImgs"><a href="#" onclick="hideImgs();return false;"><strong>hide images</strong></a> </span><span id="showImgs"><a href="#" onclick="showImgs();return false;"><strong>show images</strong></a> </span></div>
<h4 class="ban">Mon Nov 26</h4>
<p class="row" data-latitude="" data-longitude="">
<span class="ih"> </span>
<span class="itemdate"></span>
<a href="http://miami.craigslist.org/pbc/ctd/3437084110.html">#2009 Lexus GS 450h 4dr Car Hybrid (only 20,733 miles)</a>
<span class="itemsep"> - </span>
<span class="itemph"></span>
<span class="itempp"></span>
<span class="itempn"><font size="-1"> (Lake Worth)</font></span>
<span class="itempx"> <span class="p"> img</span></span>
<span class="itemcg" title="ctd"> <small class="gc"><a href="/ctd/">dealer</a></small></span><br class="c">
</p>
<p class="row" data-latitude="" data-longitude="">
<span class="ih"> </span>
<span class="itemdate"></span>
<a href="http://miami.craigslist.org/brw/ctd/3437083983.html">we buy junk-bus-truck- car for cash!!$500-$5000-5612062848 </a>
<span class="itemsep"> - </span>
<span class="itemph"></span>
<span class="itempp"> $5000</span>
<span class="itempn"><font size="-1"> (all over)</font></span>
<span class="itempx"></span>
<span class="itemcg" title="ctd"> <small class="gc"><a href="/ctd/">dealer</a></small></span><br class="c">
</p>
<p class="row" data-latitude="" data-longitude="">
<span class="ih" id="images:<API key>.jpg"> </span>
<span class="itemdate"></span>
<a href="http://miami.craigslist.org/brw/cto/3437083907.html">98 Ford Explorer for 1700 OBO</a>
<span class="itemsep"> - </span>
<span class="itemph"></span>
<span class="itempp"> $1700</span>
<span class="itempn"><font size="-1"> (Oakland Park)</font></span>
<span class="itempx"> <span class="p"> pic</span></span>
<span class="itemcg" title="cto"> <small class="gc"><a href="/cto/">owner</a></small></span><br class="c">
</p>
<p class="row" data-latitude="" data-longitude="">
<span class="ih" id="images:<API key>.jpg"> </span>
<span class="itemdate"></span>
<a href="http://miami.craigslist.org/mdc/ctd/3390256668.html">►08 CADILLAC CTS BUY HERE PAY HERE NO CREDIT CHECK 954-986-6600</a>
<span class="itemsep"> - </span>
<span class="itemph"></span>
<span class="itempp"></span>
<span class="itempn"><font size="-1"> ($2200 DOWN AND $94 PER WEEK)</font></span>
<span class="itempx"> <span class="p"> pic</span></span>
<span class="itemcg" title="ctd"> <small class="gc"><a href="/ctd/">dealer</a></small></span><br class="c">
</p>
<p class="row" data-latitude="" data-longitude="">
<span class="ih"> </span>
<span class="itemdate"></span>
<a href="http://miami.craigslist.org/mdc/ctd/3437082808.html">#2008 Lexus ES 350 4dr Car </a>
<span class="itemsep"> - </span>
<span class="itemph"></span>
<span class="itempp"></span>
<span class="itempn"><font size="-1"> (Lake Worth)</font></span>
<span class="itempx"> <span class="p"> img</span></span>
<span class="itemcg" title="ctd"> <small class="gc"><a href="/ctd/">dealer</a></small></span><br class="c">
</p>
<p class="row" data-latitude="" data-longitude="">
<span class="ih" id="images:<API key>.jpg"> </span>
<span class="itemdate"></span>
<a href="http://miami.craigslist.org/mdc/ctd/3437082488.html">2002 bus eldorado</a>
<span class="itemsep"> - </span>
<span class="itemph"></span>
<span class="itempp"> $3900</span>
<span class="itempn"><font size="-1"> (miami)</font></span>
<span class="itempx"> <span class="p"> pic</span></span>
<span class="itemcg" title="ctd"> <small class="gc"><a href="/ctd/">dealer</a></small></span><br class="c">
</p>
<p class="row" data-latitude="" data-longitude="">
<span class="ih" id="images:<API key>.jpg"> </span>
<span class="itemdate"></span>
<a href="http://miami.craigslist.org/mdc/cto/3437082353.html">DODGE STEALTH R/T AWD FOR SALE OR TRADE?</a>
<span class="itemsep"> - </span>
<span class="itemph"></span>
<span class="itempp"> $1</span>
<span class="itempn"></span>
<span class="itempx"> <span class="p"> pic</span></span>
<span class="itemcg" title="cto"> <small class="gc"><a href="/cto/">owner</a></small></span><br class="c">
</p>
<p class="row" data-latitude="" data-longitude="">
<span class="ih" id="images:<API key>.jpg"> </span>
<span class="itemdate"></span>
<a href="http://miami.craigslist.org/pbc/cto/3437082217.html">Oldsmobile Aurora 1997 </a>
<span class="itemsep"> - </span>
<span class="itemph"></span>
<span class="itempp"> $2850</span>
<span class="itempn"><font size="-1"> (West Palm Beach)</font></span>
<span class="itempx"> <span class="p"> pic</span></span>
<span class="itemcg" title="cto"> <small class="gc"><a href="/cto/">owner</a></small></span><br class="c">
</p>
<p class="row" data-latitude="" data-longitude="">
<span class="ih" id="images:<API key>.jpg"> </span>
<span class="itemdate"></span>
<a href="http://miami.craigslist.org/mdc/cto/3437082240.html">chevrolet impal</a>
<span class="itemsep"> - </span>
<span class="itemph"></span>
<span class="itempp"> $2800</span>
<span class="itempn"><font size="-1"> (hialeah)</font></span>
<span class="itempx"> <span class="p"> pic</span></span>
<span class="itemcg" title="cto"> <small class="gc"><a href="/cto/">owner</a></small></span><br class="c">
</p>
<p class="row" data-latitude="" data-longitude="">
<span class="ih" id="images:<API key>.jpg"> </span>
<span class="itemdate"></span>
<a href="http://miami.craigslist.org/pbc/cto/3437082177.html">2003 FORD ESCORT ZX2 ( GAS SAVER )</a>
<span class="itemsep"> - </span>
<span class="itemph"></span>
<span class="itempp"> $2100</span>
<span class="itempn"><font size="-1"> ((obo) ( Lehigh))</font></span>
<span class="itempx"> <span class="p"> pic</span></span>
<span class="itemcg" title="cto"> <small class="gc"><a href="/cto/">owner</a></small></span><br class="c">
</p>
<p class="row" data-latitude="" data-longitude="">
<span class="ih"> </span>
<span class="itemdate"></span>
<a href="http://miami.craigslist.org/mdc/ctd/3427792062.html">USED 2007 Honda Accord Sdn EX-L</a>
<span class="itemsep"> - </span>
<span class="itemph"></span>
<span class="itempp"> $11526</span>
<span class="itempn"></span>
<span class="itempx"> <span class="p"> img</span></span>
<span class="itemcg" title="ctd"> <small class="gc"><a href="/ctd/">dealer</a></small></span><br class="c">
</p>
<p class="row" data-latitude="" data-longitude="">
<span class="ih" id="images:<API key>.jpg"> </span>
<span class="itemdate"></span>
<a href="http://miami.craigslist.org/pbc/ctd/3375557016.html">2003 Mitsubishi Montero Sport 4dr LS </a>
<span class="itemsep"> - </span>
<span class="itemph"></span>
<span class="itempp"> $3900</span>
<span class="itempn"><font size="-1"> (Lake Worth)</font></span>
<span class="itempx"> <span class="p"> pic img</span></span>
<span class="itemcg" title="ctd"> <small class="gc"><a href="/ctd/">dealer</a></small></span><br class="c">
</p>
<p class="row" data-latitude="" data-longitude="">
<span class="ih"> </span>
<span class="itemdate"></span>
<a href="http://miami.craigslist.org/mdc/ctd/3432339232.html">USED 2012 Jeep Wrangler </a>
<span class="itemsep"> - </span>
<span class="itemph"></span>
<span class="itempp"></span>
<span class="itempn"></span>
<span class="itempx"> <span class="p"> img</span></span>
<span class="itemcg" title="ctd"> <small class="gc"><a href="/ctd/">dealer</a></small></span><br class="c">
</p>
<p class="row" data-latitude="" data-longitude="">
<span class="ih" id="images:<API key>.jpg"> </span>
<span class="itemdate"></span>
<a href="http://miami.craigslist.org/pbc/cto/3437081260.html">Chevy Chevelle Wagon 1972</a>
<span class="itemsep"> - </span>
<span class="itemph"></span>
<span class="itempp"> $24500</span>
<span class="itempn"><font size="-1"> (Wellington,Fl)</font></span>
<span class="itempx"> <span class="p"> pic</span></span>
<span class="itemcg" title="cto"> <small class="gc"><a href="/cto/">owner</a></small></span><br class="c">
</p>
<p class="row" data-latitude="" data-longitude="">
<span class="ih"> </span>
<span class="itemdate"></span>
<a href="http://miami.craigslist.org/brw/ctd/3437081012.html">we buy-bus-truck- junk cars-$500-5000$-9542976670-cashhhh </a>
<span class="itemsep"> - </span>
<span class="itemph"></span>
<span class="itempp"> $5000</span>
<span class="itempn"><font size="-1"> (all over)</font></span>
<span class="itempx"></span>
<span class="itemcg" title="ctd"> <small class="gc"><a href="/ctd/">dealer</a></small></span><br class="c">
</p>
<p class="row" data-latitude="" data-longitude="">
<span class="ih"> </span>
<span class="itemdate"></span>
<a href="http://miami.craigslist.org/brw/ctd/3437080916.html">☎ Financing you can rely on even with BAD CREDIT.Zero Down Programs.</a>
<span class="itemsep"> - </span>
<span class="itemph"></span>
<span class="itempp"> $2325</span>
<span class="itempn"><font size="-1"> (Broward County)</font></span>
<span class="itempx"> <span class="p"> img</span></span>
<span class="itemcg" title="ctd"> <small class="gc"><a href="/ctd/">dealer</a></small></span><br class="c">
</p>
<p class="row" data-latitude="" data-longitude="">
<span class="ih"> </span>
<span class="itemdate"></span>
<a href="http://miami.craigslist.org/brw/ctd/3437080648.html">Kia Soul 2011</a>
<span class="itemsep"> - </span>
<span class="itemph"></span>
<span class="itempp"></span>
<span class="itempn"></span>
<span class="itempx"></span>
<span class="itemcg" title="ctd"> <small class="gc"><a href="/ctd/">dealer</a></small></span><br class="c">
</p>
<p class="row" data-latitude="" data-longitude="">
<span class="ih"> </span>
<span class="itemdate"></span>
<a href="http://miami.craigslist.org/brw/ctd/3427972777.html">USED 2011 HONDA CIVIC LX-S</a>
<span class="itemsep"> - </span>
<span class="itemph"></span>
<span class="itempp"> $19479</span>
<span class="itempn"></span>
<span class="itempx"> <span class="p"> img</span></span>
<span class="itemcg" title="ctd"> <small class="gc"><a href="/ctd/">dealer</a></small></span><br class="c">
</p>
<p class="row" data-latitude="" data-longitude="">
<span class="ih"> </span>
<span class="itemdate"></span>
<a href="http://miami.craigslist.org/mdc/ctd/3437079893.html"># 2006 #Kia # Sportage SUV </a>
<span class="itemsep"> - </span>
<span class="itemph"></span>
<span class="itempp"> $7991</span>
<span class="itempn"><font size="-1"> (Miami Lakes)</font></span>
<span class="itempx"> <span class="p"> img</span></span>
<span class="itemcg" title="ctd"> <small class="gc"><a href="/ctd/">dealer</a></small></span><br class="c">
</p>
<p class="row" data-latitude="" data-longitude="">
<span class="ih" id="images:<API key>.jpg"> </span>
<span class="itemdate"></span>
<a href="http://miami.craigslist.org/mdc/cto/3437079882.html">1999 Mustang GT w/ '08 3 Valve Engine Swap</a>
<span class="itemsep"> - </span>
<span class="itemph"></span>
<span class="itempp"> $8500</span>
<span class="itempn"><font size="-1"> (Homestead)</font></span>
<span class="itempx"> <span class="p"> pic</span></span>
<span class="itemcg" title="cto"> <small class="gc"><a href="/cto/">owner</a></small></span><br class="c">
</p>
<p class="row" data-latitude="" data-longitude="">
<span class="ih" id="images:<API key>.jpg"> </span>
<span class="itemdate"></span>
<a href="http://miami.craigslist.org/brw/cto/3437079719.html">1998 Buick Century </a>
<span class="itemsep"> - </span>
<span class="itemph"></span>
<span class="itempp"> $2200</span>
<span class="itempn"><font size="-1"> (Tamarac)</font></span>
<span class="itempx"> <span class="p"> pic</span></span>
<span class="itemcg" title="cto"> <small class="gc"><a href="/cto/">owner</a></small></span><br class="c">
</p>
<p class="row" data-latitude="" data-longitude="">
<span class="ih"> </span>
<span class="itemdate"></span>
<a href="http://miami.craigslist.org/pbc/ctd/3437079536.html">#2009 BMW Z4 Convertible sDrive35i Convertible</a>
<span class="itemsep"> - </span>
<span class="itemph"></span>
<span class="itempp"></span>
<span class="itempn"><font size="-1"> (Lake Worth)</font></span>
<span class="itempx"> <span class="p"> img</span></span>
<span class="itemcg" title="ctd"> <small class="gc"><a href="/ctd/">dealer</a></small></span><br class="c">
</p>
<p class="row" data-latitude="" data-longitude="">
<span class="ih"> </span>
<span class="itemdate"></span>
<a href="http://miami.craigslist.org/pbc/ctd/3437079376.html">2010 Ford Escape</a>
<span class="itemsep"> - </span>
<span class="itemph"></span>
<span class="itempp"> $150</span>
<span class="itempn"><font size="-1"> (we welcome all credit)</font></span>
<span class="itempx"> <span class="p"> img</span></span>
<span class="itemcg" title="ctd"> <small class="gc"><a href="/ctd/">dealer</a></small></span><br class="c">
</p>
<p class="row" data-latitude="" data-longitude="">
<span class="ih"> </span>
<span class="itemdate"></span>
<a href="http://miami.craigslist.org/mdc/ctd/3437079094.html">2011 MAZDA MAZDA3 I SPORT $123 MONTHLY </a>
<span class="itemsep"> - </span>
<span class="itemph"></span>
<span class="itempp"></span>
<span class="itempn"><font size="-1"> (APPLY TODAY)</font></span>
<span class="itempx"> <span class="p"> img</span></span>
<span class="itemcg" title="ctd"> <small class="gc"><a href="/ctd/">dealer</a></small></span><br class="c">
</p>
<p class="row" data-latitude="" data-longitude="">
<span class="ih"> </span>
<span class="itemdate"></span>
<a href="http://miami.craigslist.org/mdc/ctd/3437078916.html">2010 Dodge Challenger Coupe SRT8 w/Navigation (only 8,423 miles)</a>
<span class="itemsep"> - </span>
<span class="itemph"></span>
<span class="itempp"></span>
<span class="itempn"><font size="-1"> (Margate)</font></span>
<span class="itempx"> <span class="p"> img</span></span>
<span class="itemcg" title="ctd"> <small class="gc"><a href="/ctd/">dealer</a></small></span><br class="c">
</p>
<p class="row" data-latitude="" data-longitude="">
<span class="ih"> </span>
<span class="itemdate"></span>
<a href="http://miami.craigslist.org/pbc/ctd/3437078855.html">#2012 Mercedes-Benz M-Class Sport Utility ML350 4MATIC AWD</a>
<span class="itemsep"> - </span>
<span class="itemph"></span>
<span class="itempp"></span>
<span class="itempn"><font size="-1"> (Lake Worth)</font></span>
<span class="itempx"> <span class="p"> img</span></span>
<span class="itemcg" title="ctd"> <small class="gc"><a href="/ctd/">dealer</a></small></span><br class="c">
</p>
<p class="row" data-latitude="" data-longitude="">
<span class="ih"> </span>
<span class="itemdate"></span>
<a href="http://miami.craigslist.org/mdc/ctd/3437078420.html">2009 Accord Sdn Honda</a>
<span class="itemsep"> - </span>
<span class="itemph"></span>
<span class="itempp"></span>
<span class="itempn"></span>
<span class="itempx"></span>
<span class="itemcg" title="ctd"> <small class="gc"><a href="/ctd/">dealer</a></small></span><br class="c">
</p>
<p class="row" data-latitude="" data-longitude="">
<span class="ih"> </span>
<span class="itemdate"></span>
<a href="http://miami.craigslist.org/brw/ctd/3437078293.html">we pay cash money for your -buses-trucks-junk car!!$500-$6000-3058794628 </a>
<span class="itemsep"> - </span>
<span class="itemph"></span>
<span class="itempp"> $6000</span>
<span class="itempn"><font size="-1"> (all over)</font></span>
<span class="itempx"></span>
<span class="itemcg" title="ctd"> <small class="gc"><a href="/ctd/">dealer</a></small></span><br class="c">
</p>
<p class="row" data-latitude="" data-longitude="">
<span class="ih"> </span>
<span class="itemdate"></span>
<a href="http://miami.craigslist.org/mdc/cto/3437078323.html">2005 Ford Ranger 4x4 Super A/C </a>
<span class="itemsep"> - </span>
<span class="itemph"></span>
<span class="itempp"> $5495</span>
<span class="itempn"><font size="-1"> (Hollywood)</font></span>
<span class="itempx"></span>
<span class="itemcg" title="cto"> <small class="gc"><a href="/cto/">owner</a></small></span><br class="c">
</p>
<p class="row" data-latitude="" data-longitude="">
<span class="ih"> </span>
<span class="itemdate"></span>
<a href="http://miami.craigslist.org/brw/ctd/3437078176.html">#2009 Mercedes-Benz SLK-Class Convertible SLK300 Convertible (only 20,424 miles)</a>
<span class="itemsep"> - </span>
<span class="itemph"></span>
<span class="itempp"></span>
<span class="itempn"><font size="-1"> (Lake Worth)</font></span>
<span class="itempx"> <span class="p"> img</span></span>
<span class="itemcg" title="ctd"> <small class="gc"><a href="/ctd/">dealer</a></small></span><br class="c">
</p>
<p class="row" data-latitude="" data-longitude="">
<span class="ih" id="images:<API key>.jpg"> </span>
<span class="itemdate"></span>
<a href="http://miami.craigslist.org/mdc/cto/3437077653.html">2005 suburban 4x4</a>
<span class="itemsep"> - </span>
<span class="itemph"></span>
<span class="itempp"> $7900</span>
<span class="itempn"><font size="-1"> (miami)</font></span>
<span class="itempx"> <span class="p"> pic</span></span>
<span class="itemcg" title="cto"> <small class="gc"><a href="/cto/">owner</a></small></span><br class="c">
</p>
<p class="row" data-latitude="" data-longitude="">
<span class="ih"> </span>
<span class="itemdate"></span>
<a href="http://miami.craigslist.org/mdc/ctd/3437077383.html">✿ IF YOUR CREDIT IS A MESS and you have ZERO DOWN. Let us Help You.</a>
<span class="itemsep"> - </span>
<span class="itemph"></span>
<span class="itempp"> $1850</span>
<span class="itempn"><font size="-1"> (Miami / Dade County)</font></span>
<span class="itempx"> <span class="p"> img</span></span>
<span class="itemcg" title="ctd"> <small class="gc"><a href="/ctd/">dealer</a></small></span><br class="c">
</p>
<p class="row" data-latitude="" data-longitude="">
<span class="ih" id="images:<API key>.jpg"> </span>
<span class="itemdate"></span>
<a href="http://miami.craigslist.org/brw/cto/3437076413.html">1997 Mazda se B2300 pickup truck 5 speed 4 cylinder </a>
<span class="itemsep"> - </span>
<span class="itemph"></span>
<span class="itempp"> $2150</span>
<span class="itempn"><font size="-1"> (Fort Lauderdale )</font></span>
<span class="itempx"> <span class="p"> pic</span></span>
<span class="itemcg" title="cto"> <small class="gc"><a href="/cto/">owner</a></small></span><br class="c">
</p>
<p class="row" data-latitude="" data-longitude="">
<span class="ih"> </span>
<span class="itemdate"></span>
<a href="http://miami.craigslist.org/mdc/cto/3437076376.html">Chevy Caprice (1973 )</a>
<span class="itemsep"> - </span>
<span class="itemph"></span>
<span class="itempp"></span>
<span class="itempn"><font size="-1"> (South Miami Heights)</font></span>
<span class="itempx"> <span class="p"> img</span></span>
<span class="itemcg" title="cto"> <small class="gc"><a href="/cto/">owner</a></small></span><br class="c">
</p>
<p class="row" data-latitude="" data-longitude="">
<span class="ih" id="images:<API key>.jpg"> </span>
<span class="itemdate"></span>
<a href="http://miami.craigslist.org/brw/cto/3411489257.html">1991 Nissan 240sx Coupe Turbo</a>
<span class="itemsep"> - </span>
<span class="itemph"></span>
<span class="itempp"> $4200</span>
<span class="itempn"><font size="-1"> (Pembroke Pines)</font></span>
<span class="itempx"> <span class="p"> pic</span></span>
<span class="itemcg" title="cto"> <small class="gc"><a href="/cto/">owner</a></small></span><br class="c">
</p>
<p class="row" data-latitude="" data-longitude="">
<span class="ih"> </span>
<span class="itemdate"></span>
<a href="http://miami.craigslist.org/brw/ctd/3437076144.html">2012 Ford Fusion</a>
<span class="itemsep"> - </span>
<span class="itemph"></span>
<span class="itempp"> $155</span>
<span class="itempn"><font size="-1"> (POOR CREDIT FINANCE)</font></span>
<span class="itempx"> <span class="p"> img</span></span>
<span class="itemcg" title="ctd"> <small class="gc"><a href="/ctd/">dealer</a></small></span><br class="c">
</p>
<p class="row" data-latitude="" data-longitude="">
<span class="ih" id="images:<API key>.jpg"> </span>
<span class="itemdate"></span>
<a href="http://miami.craigslist.org/mdc/cto/3437076131.html">Nissan Sentra 2005 red</a>
<span class="itemsep"> - </span>
<span class="itemph"></span>
<span class="itempp"> $4000</span>
<span class="itempn"><font size="-1"> (Miami - Kendall)</font></span>
<span class="itempx"> <span class="p"> pic</span></span>
<span class="itemcg" title="cto"> <small class="gc"><a href="/cto/">owner</a></small></span><br class="c">
</p>
<p class="row" data-latitude="" data-longitude="">
<span class="ih"> </span>
<span class="itemdate"></span>
<a href="http://miami.craigslist.org/mdc/cto/3437075883.html">95 impala ss!!!!!!! 383 bondi beach GFG air ride NEW FRESH OUT THE LAB</a>
<span class="itemsep"> - </span>
<span class="itemph"></span>
<span class="itempp"> $12000</span>
<span class="itempn"><font size="-1"> (FIRM)</font></span>
<span class="itempx"> <span class="p"> img</span></span>
<span class="itemcg" title="cto"> <small class="gc"><a href="/cto/">owner</a></small></span><br class="c">
</p>
<p class="row" data-latitude="" data-longitude="">
<span class="ih"> </span>
<span class="itemdate"></span>
<a href="http://miami.craigslist.org/brw/ctd/3437075677.html">2010 MERCEDES-BENZ S-CLASS NOW AVAILABLE</a>
<span class="itemsep"> - </span>
<span class="itemph"></span>
<span class="itempp"> $2000</span>
<span class="itempn"><font size="-1"> (Coral Springs)</font></span>
<span class="itempx"> <span class="p"> img</span></span>
<span class="itemcg" title="ctd"> <small class="gc"><a href="/ctd/">dealer</a></small></span><br class="c">
</p>
<p class="row" data-latitude="" data-longitude="">
<span class="ih"> </span>
<span class="itemdate"></span>
<a href="http://miami.craigslist.org/brw/ctd/3437075495.html">AVAILABLE NOW 2010 VOLVO XC60</a>
<span class="itemsep"> - </span>
<span class="itemph"></span>
<span class="itempp"> $2200</span>
<span class="itempn"><font size="-1"> (Margate)</font></span>
<span class="itempx"> <span class="p"> img</span></span>
<span class="itemcg" title="ctd"> <small class="gc"><a href="/ctd/">dealer</a></small></span><br class="c">
</p>
<p class="row" data-latitude="" data-longitude="">
<span class="ih" id="images:<API key>.jpg"> </span>
<span class="itemdate"></span>
<a href="http://miami.craigslist.org/pbc/cto/3415825931.html">Very cool '02 Chevy Suburban</a>
<span class="itemsep"> - </span>
<span class="itemph"></span>
<span class="itempp"> $6495</span>
<span class="itempn"><font size="-1"> (Orlando area)</font></span>
<span class="itempx"> <span class="p"> pic</span></span>
<span class="itemcg" title="cto"> <small class="gc"><a href="/cto/">owner</a></small></span><br class="c">
</p>
<p class="row" data-latitude="" data-longitude="">
<span class="ih"> </span>
<span class="itemdate"></span>
<a href="http://miami.craigslist.org/pbc/ctd/3437075183.html">#2011 Nissan Sentra 4dr Car 2.0</a>
<span class="itemsep"> - </span>
<span class="itemph"></span>
<span class="itempp"></span>
<span class="itempn"><font size="-1"> (Lake Worth)</font></span>
<span class="itempx"> <span class="p"> img</span></span>
<span class="itemcg" title="ctd"> <small class="gc"><a href="/ctd/">dealer</a></small></span><br class="c">
</p>
<p class="row" data-latitude="" data-longitude="">
<span class="ih"> </span>
<span class="itemdate"></span>
<a href="http://miami.craigslist.org/brw/ctd/3437075114.html">$$$$cash cash$$$ 4 any bus-truck- car!!!$500-$5000-9542976670 </a>
<span class="itemsep"> - </span>
<span class="itemph"></span>
<span class="itempp"> $5000</span>
<span class="itempn"><font size="-1"> (all over)</font></span>
<span class="itempx"></span>
<span class="itemcg" title="ctd"> <small class="gc"><a href="/ctd/">dealer</a></small></span><br class="c">
</p>
<p class="row" data-latitude="" data-longitude="">
<span class="ih" id="images:<API key>.jpg"> </span>
<span class="itemdate"></span>
<a href="http://miami.craigslist.org/mdc/cto/3397910692.html">Toyota Camry 1993</a>
<span class="itemsep"> - </span>
<span class="itemph"></span>
<span class="itempp"> $1500</span>
<span class="itempn"><font size="-1"> (Miami Gardens)</font></span>
<span class="itempx"> <span class="p"> pic</span></span>
<span class="itemcg" title="cto"> <small class="gc"><a href="/cto/">owner</a></small></span><br class="c">
</p>
<p class="row" data-latitude="" data-longitude="">
<span class="ih"> </span>
<span class="itemdate"></span>
<a href="http://miami.craigslist.org/mdc/ctd/3437074926.html">#2011 Chevrolet Impala # Sedan LT Fleet</a>
<span class="itemsep"> - </span>
<span class="itemph"></span>
<span class="itempp"></span>
<span class="itempn"><font size="-1"> (Miami)</font></span>
<span class="itempx"> <span class="p"> img</span></span>
<span class="itemcg" title="ctd"> <small class="gc"><a href="/ctd/">dealer</a></small></span><br class="c">
</p>
<p class="row" data-latitude="" data-longitude="">
<span class="ih" id="images:<API key>.jpg"> </span>
<span class="itemdate"></span>
<a href="http://miami.craigslist.org/mdc/cto/3437074699.html">2000 Nissan Altima</a>
<span class="itemsep"> - </span>
<span class="itemph"></span>
<span class="itempp"> $3500</span>
<span class="itempn"><font size="-1"> (Miami)</font></span>
<span class="itempx"> <span class="p"> pic</span></span>
<span class="itemcg" title="cto"> <small class="gc"><a href="/cto/">owner</a></small></span><br class="c">
</p>
<p class="row" data-latitude="" data-longitude="">
<span class="ih"> </span>
<span class="itemdate"></span>
<a href="http://miami.craigslist.org/pbc/ctd/3437074043.html">#2009 Honda Odyssey Mini-van, Passenger EX-L</a>
<span class="itemsep"> - </span>
<span class="itemph"></span>
<span class="itempp"></span>
<span class="itempn"><font size="-1"> (Lake Worth)</font></span>
<span class="itempx"> <span class="p"> img</span></span>
<span class="itemcg" title="ctd"> <small class="gc"><a href="/ctd/">dealer</a></small></span><br class="c">
</p>
<p class="row" data-latitude="" data-longitude="">
<span class="ih"> </span>
<span class="itemdate"></span>
<a href="http://miami.craigslist.org/mdc/cto/3437073703.html">2000 Buick Lesabre Limited 70K ml</a>
<span class="itemsep"> - </span>
<span class="itemph"></span>
<span class="itempp"> $2795</span>
<span class="itempn"><font size="-1"> ( hollywood)</font></span>
<span class="itempx"></span>
<span class="itemcg" title="cto"> <small class="gc"><a href="/cto/">owner</a></small></span><br class="c">
</p>
<p class="row" data-latitude="" data-longitude="">
<span class="ih"> </span>
<span class="itemdate"></span>
<a href="http://miami.craigslist.org/brw/ctd/3437073540.html">1995 Ford Explorer Cloth Bright White</a>
<span class="itemsep"> - </span>
<span class="itemph"></span>
<span class="itempp"></span>
<span class="itempn"><font size="-1"> (Hollywood, FL - NO DEALER FEE! - SAVE BIG!)</font></span>
<span class="itempx"> <span class="p"> img</span></span>
<span class="itemcg" title="ctd"> <small class="gc"><a href="/ctd/">dealer</a></small></span><br class="c">
</p>
<p class="row" data-latitude="" data-longitude="">
<span class="ih"> </span>
<span class="itemdate"></span>
<a href="http://miami.craigslist.org/brw/ctd/3437073490.html">2007 CADILLAC ESCALADE ESV AWD W/ NAV $215 MONTHLY NEED CAR FAST</a>
<span class="itemsep"> - </span>
<span class="itemph"></span>
<span class="itempp"></span>
<span class="itempn"></span>
<span class="itempx"> <span class="p"> img</span></span>
<span class="itemcg" title="ctd"> <small class="gc"><a href="/ctd/">dealer</a></small></span><br class="c">
</p>
<p class="row" data-latitude="" data-longitude="">
<span class="ih" id="images:<API key>.jpg"> </span>
<span class="itemdate"></span>
<a href="http://miami.craigslist.org/pbc/cto/3437073398.html">2004 F-150 Ford Lariot Truck</a>
<span class="itemsep"> - </span>
<span class="itemph"></span>
<span class="itempp"> $7999</span>
<span class="itempn"><font size="-1"> (Boca Raton)</font></span>
<span class="itempx"> <span class="p"> pic</span></span>
<span class="itemcg" title="cto"> <small class="gc"><a href="/cto/">owner</a></small></span><br class="c">
</p>
<p class="row" data-latitude="" data-longitude="">
<span class="ih"> </span>
<span class="itemdate"></span>
<a href="http://miami.craigslist.org/pbc/ctd/3437072980.html">- Rates as low as 1.99% - 2006 Dodge Charger SE Sedan - </a>
<span class="itemsep"> - </span>
<span class="itemph"></span>
<span class="itempp"></span>
<span class="itempn"><font size="-1"> (Miami)</font></span>
<span class="itempx"> <span class="p"> img</span></span>
<span class="itemcg" title="ctd"> <small class="gc"><a href="/ctd/">dealer</a></small></span><br class="c">
</p>
<p class="row" data-latitude="" data-longitude="">
<span class="ih" id="images:<API key>.jpg"> </span>
<span class="itemdate"></span>
<a href="http://miami.craigslist.org/mdc/cto/3437072556.html">Volvo s60 turbo</a>
<span class="itemsep"> - </span>
<span class="itemph"></span>
<span class="itempp"> $9500</span>
<span class="itempn"><font size="-1"> (Sw Miami)</font></span>
<span class="itempx"> <span class="p"> pic</span></span>
<span class="itemcg" title="cto"> <small class="gc"><a href="/cto/">owner</a></small></span><br class="c">
</p>
<p class="row" data-latitude="" data-longitude="">
<span class="ih"> </span>
<span class="itemdate"></span>
<a href="http://miami.craigslist.org/mdc/ctd/3437072562.html">2011 Toyota Sienna</a>
<span class="itemsep"> - </span>
<span class="itemph"></span>
<span class="itempp"></span>
<span class="itempn"></span>
<span class="itempx"> <span class="p"> img</span></span>
<span class="itemcg" title="ctd"> <small class="gc"><a href="/ctd/">dealer</a></small></span><br class="c">
</p>
<p class="row" data-latitude="" data-longitude="">
<span class="ih"> </span>
<span class="itemdate"></span>
<a href="http://miami.craigslist.org/mdc/ctd/3437072457.html">2011 Toyota RAV4 Super Easy Financing $0 Down Approved Now</a>
<span class="itemsep"> - </span>
<span class="itemph"></span>
<span class="itempp"> $1834</span>
<span class="itempn"><font size="-1"> (Miami / Dade County)</font></span>
<span class="itempx"> <span class="p"> img</span></span>
<span class="itemcg" title="ctd"> <small class="gc"><a href="/ctd/">dealer</a></small></span><br class="c">
</p>
<p class="row" data-latitude="" data-longitude="">
<span class="ih"> </span>
<span class="itemdate"></span>
<a href="http://miami.craigslist.org/mdc/cto/3437072309.html">1973 chevy caprice (Fixed up)</a>
<span class="itemsep"> - </span>
<span class="itemph"></span>
<span class="itempp"></span>
<span class="itempn"><font size="-1"> (Miami)</font></span>
<span class="itempx"> <span class="p"> img</span></span>
<span class="itemcg" title="cto"> <small class="gc"><a href="/cto/">owner</a></small></span><br class="c">
</p>
<p class="row" data-latitude="" data-longitude="">
<span class="ih"> </span>
<span class="itemdate"></span>
<a href="http://miami.craigslist.org/pbc/ctd/3406527907.html">2010 DODGE RAM 1500 CREW CAB $201 MONTHLY FAST INSTANT APPROVALS</a>
<span class="itemsep"> - </span>
<span class="itemph"></span>
<span class="itempp"></span>
<span class="itempn"><font size="-1"> (APPLY TODAY DRIVE TODAY)</font></span>
<span class="itempx"> <span class="p"> img</span></span>
<span class="itemcg" title="ctd"> <small class="gc"><a href="/ctd/">dealer</a></small></span><br class="c">
</p>
<p class="row" data-latitude="" data-longitude="">
<span class="ih"> </span>
<span class="itemdate"></span>
<a href="http://miami.craigslist.org/mdc/cto/3373633550.html">1970 camaro parts car $500 786.299.2121</a>
<span class="itemsep"> - </span>
<span class="itemph"></span>
<span class="itempp"> $500</span>
<span class="itempn"><font size="-1"> (miami gardens)</font></span>
<span class="itempx"></span>
<span class="itemcg" title="cto"> <small class="gc"><a href="/cto/">owner</a></small></span><br class="c">
</p>
<p class="row" data-latitude="" data-longitude="">
<span class="ih" id="images:<API key>.jpg"> </span>
<span class="itemdate"></span>
<a href="http://miami.craigslist.org/brw/ctd/3423252097.html">2011 Kia Soul Come See this car Today!</a>
<span class="itemsep"> - </span>
<span class="itemph"></span>
<span class="itempp"></span>
<span class="itempn"><font size="-1"> (Pembroke Pines)</font></span>
<span class="itempx"> <span class="p"> pic img</span></span>
<span class="itemcg" title="ctd"> <small class="gc"><a href="/ctd/">dealer</a></small></span><br class="c">
</p>
<p class="row" data-latitude="" data-longitude="">
<span class="ih"> </span>
<span class="itemdate"></span>
<a href="http://miami.craigslist.org/pbc/ctd/3437071278.html">2011 Nissan Versa bad credit? need a car?</a>
<span class="itemsep"> - </span>
<span class="itemph"></span>
<span class="itempp"> $154</span>
<span class="itempn"><font size="-1"> (All Credit Ok)</font></span>
<span class="itempx"> <span class="p"> img</span></span>
<span class="itemcg" title="ctd"> <small class="gc"><a href="/ctd/">dealer</a></small></span><br class="c">
</p>
<p class="row" data-latitude="" data-longitude="">
<span class="ih"> </span>
<span class="itemdate"></span>
<a href="http://miami.craigslist.org/pbc/ctd/3437070809.html">☞ GET A CAR..Even With Poor Credit, No money Down Programs.</a>
<span class="itemsep"> - </span>
<span class="itemph"></span>
<span class="itempp"> $1988</span>
<span class="itempn"><font size="-1"> (Palm Beach County)</font></span>
<span class="itempx"> <span class="p"> img</span></span>
<span class="itemcg" title="ctd"> <small class="gc"><a href="/ctd/">dealer</a></small></span><br class="c">
</p>
<p class="row" data-latitude="" data-longitude="">
<span class="ih" id="images:<API key>.jpg"> </span>
<span class="itemdate"></span>
<a href="http://miami.craigslist.org/brw/cto/3437070752.html">Freightliner Sprinter</a>
<span class="itemsep"> - </span>
<span class="itemph"></span>
<span class="itempp"> $9300</span>
<span class="itempn"><font size="-1"> (Pompano Beach)</font></span>
<span class="itempx"> <span class="p"> pic</span></span>
<span class="itemcg" title="cto"> <small class="gc"><a href="/cto/">owner</a></small></span><br class="c">
</p>
<p class="row" data-latitude="" data-longitude="">
<span class="ih"> </span>
<span class="itemdate"></span>
<a href="http://miami.craigslist.org/mdc/ctd/3432386184.html">2009-2011 Toyota Venza</a>
<span class="itemsep"> - </span>
<span class="itemph"></span>
<span class="itempp"> $19950</span>
<span class="itempn"><font size="-1"> (within 15 miles of Miami, FL)</font></span>
<span class="itempx"> <span class="p"> img</span></span>
<span class="itemcg" title="ctd"> <small class="gc"><a href="/ctd/">dealer</a></small></span><br class="c">
</p>
<p class="row" data-latitude="" data-longitude="">
<span class="ih" id="images:<API key>.jpg"> </span>
<span class="itemdate"></span>
<a href="http://miami.craigslist.org/mdc/ctd/3412667002.html">LAND ROVER RANGE ROVER HSE 2004</a>
<span class="itemsep"> - </span>
<span class="itemph"></span>
<span class="itempp"> $18990</span>
<span class="itempn"><font size="-1"> (MIAMI / BROWARD)</font></span>
<span class="itempx"> <span class="p"> pic</span></span>
<span class="itemcg" title="ctd"> <small class="gc"><a href="/ctd/">dealer</a></small></span><br class="c">
</p>
<p class="row" data-latitude="" data-longitude="">
<span class="ih" id="images:<API key>.jpg"> </span>
<span class="itemdate"></span>
<a href="http://miami.craigslist.org/mdc/cto/3378459414.html">1974 Chevy Nova For Sale or Trade</a>
<span class="itemsep"> - </span>
<span class="itemph"></span>
<span class="itempp"> $3500</span>
<span class="itempn"><font size="-1"> (Kendall / Westchester)</font></span>
<span class="itempx"> <span class="p"> pic</span></span>
<span class="itemcg" title="cto"> <small class="gc"><a href="/cto/">owner</a></small></span><br class="c">
</p>
<p class="row" data-latitude="" data-longitude="">
<span class="ih"> </span>
<span class="itemdate"></span>
<a href="http://miami.craigslist.org/brw/ctd/3437069958.html">junk car 4 top money in cash!!$500-$5000-5612062848 </a>
<span class="itemsep"> - </span>
<span class="itemph"></span>
<span class="itempp"> $5000</span>
<span class="itempn"><font size="-1"> (all over)</font></span>
<span class="itempx"></span>
<span class="itemcg" title="ctd"> <small class="gc"><a href="/ctd/">dealer</a></small></span><br class="c">
</p>
<p class="row" data-latitude="" data-longitude="">
<span class="ih" id="images:<API key>.jpg"> </span>
<span class="itemdate"></span>
<a href="http://miami.craigslist.org/mdc/ctd/3411330632.html">TOYOTA CAMRY 2005 LE</a>
<span class="itemsep"> - </span>
<span class="itemph"></span>
<span class="itempp"> $9950</span>
<span class="itempn"><font size="-1"> (MIAMI / BROWARD)</font></span>
<span class="itempx"> <span class="p"> pic</span></span>
<span class="itemcg" title="ctd"> <small class="gc"><a href="/ctd/">dealer</a></small></span><br class="c">
</p>
<p class="row" data-latitude="" data-longitude="">
<span class="ih"> </span>
<span class="itemdate"></span>
<a href="http://miami.craigslist.org/pbc/ctd/3437069348.html">## 2012 Nissan Altima 2.5 Sedan 4D </a>
<span class="itemsep"> - </span>
<span class="itemph"></span>
<span class="itempp"></span>
<span class="itempn"><font size="-1"> (north palm beach)</font></span>
<span class="itempx"> <span class="p"> img</span></span>
<span class="itemcg" title="ctd"> <small class="gc"><a href="/ctd/">dealer</a></small></span><br class="c">
</p>
<p class="row" data-latitude="" data-longitude="">
<span class="ih" id="images:<API key>.jpg"> </span>
<span class="itemdate"></span>
<a href="http://miami.craigslist.org/mdc/cto/3414477410.html">KIA SEPHIA GS 1997 </a>
<span class="itemsep"> - </span>
<span class="itemph"></span>
<span class="itempp"> $2000</span>
<span class="itempn"><font size="-1"> (MIAMI / BROWARD)</font></span>
<span class="itempx"> <span class="p"> pic</span></span>
<span class="itemcg" title="cto"> <small class="gc"><a href="/cto/">owner</a></small></span><br class="c">
</p>
<p class="row" data-latitude="" data-longitude="">
<span class="ih" id="images:<API key>.jpg"> </span>
<span class="itemdate"></span>
<a href="http://miami.craigslist.org/mdc/cto/3437068818.html">2000 Isuzu Trooper // BLACK 4x4 SUPERclean//SPACIOUS//V6!GREAT4aFAMILY</a>
<span class="itemsep"> - </span>
<span class="itemph"></span>
<span class="itempp"> $3200</span>
<span class="itempn"><font size="-1"> (Miami)</font></span>
<span class="itempx"> <span class="p"> pic</span></span>
<span class="itemcg" title="cto"> <small class="gc"><a href="/cto/">owner</a></small></span><br class="c">
</p>
<p class="row" data-latitude="" data-longitude="">
<span class="ih" id="images:<API key>.jpg"> </span>
<span class="itemdate"></span>
<a href="http://miami.craigslist.org/mdc/ctd/3412488471.html">NISSAN ALTIMA 2006</a>
<span class="itemsep"> - </span>
<span class="itemph"></span>
<span class="itempp"> $10990</span>
<span class="itempn"><font size="-1"> (MIAMI / BROWARD)</font></span>
<span class="itempx"> <span class="p"> pic</span></span>
<span class="itemcg" title="ctd"> <small class="gc"><a href="/ctd/">dealer</a></small></span><br class="c">
</p>
<p class="row" data-latitude="" data-longitude="">
<span class="ih"> </span>
<span class="itemdate"></span>
<a href="http://miami.craigslist.org/brw/ctd/3437068327.html">2011 Chevrolet Malibu</a>
<span class="itemsep"> - </span>
<span class="itemph"></span>
<span class="itempp"></span>
<span class="itempn"></span>
<span class="itempx"> <span class="p"> img</span></span>
<span class="itemcg" title="ctd"> <small class="gc"><a href="/ctd/">dealer</a></small></span><br class="c">
</p>
<p class="row" data-latitude="" data-longitude="">
<span class="ih" id="images:<API key>.jpg"> </span>
<span class="itemdate"></span>
<a href="http://miami.craigslist.org/mdc/cto/3437068107.html">Honda civic 2001</a>
<span class="itemsep"> - </span>
<span class="itemph"></span>
<span class="itempp"> $3600</span>
<span class="itempn"><font size="-1"> (Kendall area)</font></span>
<span class="itempx"> <span class="p"> pic</span></span>
<span class="itemcg" title="cto"> <small class="gc"><a href="/cto/">owner</a></small></span><br class="c">
</p>
<p class="row" data-latitude="" data-longitude="">
<span class="ih" id="images:<API key>.jpg"> </span>
<span class="itemdate"></span>
<a href="http://miami.craigslist.org/mdc/cto/3378804562.html">Corvette 1993 40th anniversary </a>
<span class="itemsep"> - </span>
<span class="itemph"></span>
<span class="itempp"> $4800</span>
<span class="itempn"><font size="-1"> (Miami/kendall)</font></span>
<span class="itempx"> <span class="p"> pic</span></span>
<span class="itemcg" title="cto"> <small class="gc"><a href="/cto/">owner</a></small></span><br class="c">
</p>
<p class="row" data-latitude="" data-longitude="">
<span class="ih"> </span>
<span class="itemdate"></span>
<a href="http://miami.craigslist.org/mdc/ctd/3437067875.html">> 2004 >MITSUBISHI > ENDEAVOR </a>
<span class="itemsep"> - </span>
<span class="itemph"></span>
<span class="itempp"> $6995</span>
<span class="itempn"><font size="-1"> (Pembroke Pines)</font></span>
<span class="itempx"> <span class="p"> img</span></span>
<span class="itemcg" title="ctd"> <small class="gc"><a href="/ctd/">dealer</a></small></span><br class="c">
</p>
<p class="row" data-latitude="" data-longitude="">
<span class="ih"> </span>
<span class="itemdate"></span>
<a href="http://miami.craigslist.org/mdc/ctd/3437067645.html">2005 DODGE CARAVAN PASSENGER NOW AVAILABLE</a>
<span class="itemsep"> - </span>
<span class="itemph"></span>
<span class="itempp"> $1500</span>
<span class="itempn"><font size="-1"> (Opa~Locka)</font></span>
<span class="itempx"> <span class="p"> img</span></span>
<span class="itemcg" title="ctd"> <small class="gc"><a href="/ctd/">dealer</a></small></span><br class="c">
</p>
<p class="row" data-latitude="" data-longitude="">
<span class="ih"> </span>
<span class="itemdate"></span>
<a href="http://miami.craigslist.org/mdc/ctd/3437066597.html">#2012 Ford Econoline Wagon Full-size Passenger Van XLT 15 Passenger</a>
<span class="itemsep"> - </span>
<span class="itemph"></span>
<span class="itempp"></span>
<span class="itempn"><font size="-1"> (Lake Worth)</font></span>
<span class="itempx"> <span class="p"> img</span></span>
<span class="itemcg" title="ctd"> <small class="gc"><a href="/ctd/">dealer</a></small></span><br class="c">
</p>
<p class="row" data-latitude="" data-longitude="">
<span class="ih"> </span>
<span class="itemdate"></span>
<a href="http://miami.craigslist.org/brw/ctd/3437066369.html">USED 2003 Hyundai Sonata </a>
<span class="itemsep"> - </span>
<span class="itemph"></span>
<span class="itempp"></span>
<span class="itempn"></span>
<span class="itempx"> <span class="p"> img</span></span>
<span class="itemcg" title="ctd"> <small class="gc"><a href="/ctd/">dealer</a></small></span><br class="c">
</p>
<p class="row" data-latitude="" data-longitude="">
<span class="ih"> </span>
<span class="itemdate"></span>
<a href="http://miami.craigslist.org/mdc/ctd/3437066216.html">Raider Mitsubishi 2006</a>
<span class="itemsep"> - </span>
<span class="itemph"></span>
<span class="itempp"></span>
<span class="itempn"></span>
<span class="itempx"> <span class="p"> img</span></span>
<span class="itemcg" title="ctd"> <small class="gc"><a href="/ctd/">dealer</a></small></span><br class="c">
</p>
<p class="row" data-latitude="" data-longitude="">
<span class="ih" id="images:<API key>.jpg"> </span>
<span class="itemdate"></span>
<a href="http://miami.craigslist.org/mdc/cto/3437065995.html">2005 Black Pontiac Sunfire Black Chrome Rims 36MPG *Must Go*</a>
<span class="itemsep"> - </span>
<span class="itemph"></span>
<span class="itempp"> $2600</span>
<span class="itempn"><font size="-1"> (Miami)</font></span>
<span class="itempx"> <span class="p"> pic</span></span>
<span class="itemcg" title="cto"> <small class="gc"><a href="/cto/">owner</a></small></span><br class="c">
</p>
<p class="row" data-latitude="" data-longitude="">
<span class="ih"> </span>
<span class="itemdate"></span>
<a href="http://miami.craigslist.org/brw/ctd/3437065924.html">AVAILABLE 2011 KIA OPTIMA</a>
<span class="itemsep"> - </span>
<span class="itemph"></span>
<span class="itempp"> $1100</span>
<span class="itempn"><font size="-1"> (Pembroke Pines)</font></span>
<span class="itempx"> <span class="p"> img</span></span>
<span class="itemcg" title="ctd"> <small class="gc"><a href="/ctd/">dealer</a></small></span><br class="c">
</p>
<p class="row" data-latitude="" data-longitude="">
<span class="ih" id="images:<API key>.jpg"> </span>
<span class="itemdate"></span>
<a href="http://miami.craigslist.org/pbc/ctd/3437065429.html">Need to get Boats Shipped?</a>
<span class="itemsep"> - </span>
<span class="itemph"></span>
<span class="itempp"></span>
<span class="itempn"><font size="-1"> (International)</font></span>
<span class="itempx"> <span class="p"> pic</span></span>
<span class="itemcg" title="ctd"> <small class="gc"><a href="/ctd/">dealer</a></small></span><br class="c">
</p>
<p class="row" data-latitude="" data-longitude="">
<span class="ih"> </span>
<span class="itemdate"></span>
<a href="http://miami.craigslist.org/brw/ctd/3437065437.html">➍ GET ROLLING TODAY -- Any Credit..Low, Low Downpayments.</a>
<span class="itemsep"> - </span>
<span class="itemph"></span>
<span class="itempp"> $1855</span>
<span class="itempn"><font size="-1"> (Broward County)</font></span>
<span class="itempx"> <span class="p"> img</span></span>
<span class="itemcg" title="ctd"> <small class="gc"><a href="/ctd/">dealer</a></small></span><br class="c">
</p>
<p class="row" data-latitude="" data-longitude="">
<span class="ih"> </span>
<span class="itemdate"></span>
<a href="http://miami.craigslist.org/pbc/ctd/3437064934.html">@ @ Guaranteed Approval ! 2009 Chevrolet Impala LT Sedan @ @ </a>
<span class="itemsep"> - </span>
<span class="itemph"></span>
<span class="itempp"></span>
<span class="itempn"><font size="-1"> (Miami)</font></span>
<span class="itempx"> <span class="p"> img</span></span>
<span class="itemcg" title="ctd"> <small class="gc"><a href="/ctd/">dealer</a></small></span><br class="c">
</p>
<p class="row" data-latitude="" data-longitude="">
<span class="ih"> </span>
<span class="itemdate"></span>
<a href="http://miami.craigslist.org/mdc/ctd/3437064656.html">2012 Jeep Wrangler</a>
<span class="itemsep"> - </span>
<span class="itemph"></span>
<span class="itempp"> $150</span>
<span class="itempn"><font size="-1"> (financing all credit)</font></span>
<span class="itempx"> <span class="p"> img</span></span>
<span class="itemcg" title="ctd"> <small class="gc"><a href="/ctd/">dealer</a></small></span><br class="c">
</p>
<p class="row" data-latitude="" data-longitude="">
<span class="ih"> </span>
<span class="itemdate"></span>
<a href="http://miami.craigslist.org/brw/ctd/3437064510.html">2008 ACURA MDX 5DR !!</a>
<span class="itemsep"> - </span>
<span class="itemph"></span>
<span class="itempp"></span>
<span class="itempn"><font size="-1"> (Ft. Lauderdale)</font></span>
<span class="itempx"> <span class="p"> img</span></span>
<span class="itemcg" title="ctd"> <small class="gc"><a href="/ctd/">dealer</a></small></span><br class="c">
</p>
<p class="row" data-latitude="" data-longitude="">
<span class="ih"> </span>
<span class="itemdate"></span>
<a href="http://miami.craigslist.org/brw/ctd/3437064526.html">we buy cars in cash!!$600-$6000-7864160322 </a>
<span class="itemsep"> - </span>
<span class="itemph"></span>
<span class="itempp"> $6000</span>
<span class="itempn"><font size="-1"> (all over)</font></span>
<span class="itempx"></span>
<span class="itemcg" title="ctd"> <small class="gc"><a href="/ctd/">dealer</a></small></span><br class="c">
</p>
<p class="row" data-latitude="" data-longitude="">
<span class="ih"> </span>
<span class="itemdate"></span>
<a href="http://miami.craigslist.org/mdc/ctd/3437064127.html">Kia 2009 Rio</a>
<span class="itemsep"> - </span>
<span class="itemph"></span>
<span class="itempp"></span>
<span class="itempn"></span>
<span class="itempx"> <span class="p"> img</span></span>
<span class="itemcg" title="ctd"> <small class="gc"><a href="/ctd/">dealer</a></small></span><br class="c">
</p>
<p class="row" data-latitude="" data-longitude="">
<span class="ih"> </span>
<span class="itemdate"></span>
<a href="http://miami.craigslist.org/mdc/cto/3385816764.html">2003 toyota corolla automatico </a>
<span class="itemsep"> - </span>
<span class="itemph"></span>
<span class="itempp"> $5200</span>
<span class="itempn"><font size="-1"> (miami/westchester)</font></span>
<span class="itempx"> <span class="p"> img</span></span>
<span class="itemcg" title="cto"> <small class="gc"><a href="/cto/">owner</a></small></span><br class="c">
</p>
<p class="row" data-latitude="" data-longitude="">
<span class="ih"> </span>
<span class="itemdate"></span>
<a href="http://miami.craigslist.org/mdc/cto/3420076171.html"> CHRYSKER SEBRING 2.7L V6 </a>
<span class="itemsep"> - </span>
<span class="itemph"></span>
<span class="itempp"> $3750</span>
<span class="itempn"><font size="-1"> (CORAL WAY 32 AV )</font></span>
<span class="itempx"></span>
<span class="itemcg" title="cto"> <small class="gc"><a href="/cto/">owner</a></small></span><br class="c">
</p>
<p class="row" data-latitude="" data-longitude="">
<span class="ih" id="images:<API key>.jpg"> </span>
<span class="itemdate"></span>
<a href="http:
<span class="itemsep"> - </span>
<span class="itemph"></span>
<span class="itempp"> $2000</span>
<span class="itempn"><font size="-1"> (Deerfield Beach Area)</font></span>
<span class="itempx"> <span class="p"> pic</span></span>
<span class="itemcg" title="cto"> <small class="gc"><a href="/cto/">owner</a></small></span><br class="c">
</p>
<p class="row" data-latitude="" data-longitude="">
<span class="ih"> </span>
<span class="itemdate"></span>
<a href="http://miami.craigslist.org/brw/ctd/3432322864.html">USED 2002 Buick Regal </a>
<span class="itemsep"> - </span>
<span class="itemph"></span>
<span class="itempp"></span>
<span class="itempn"></span>
<span class="itempx"> <span class="p"> img</span></span>
<span class="itemcg" title="ctd"> <small class="gc"><a href="/ctd/">dealer</a></small></span><br class="c">
</p>
<p class="row" data-latitude="" data-longitude="">
<span class="ih"> </span>
<span class="itemdate"></span>
<a href="http://miami.craigslist.org/brw/ctd/3408703728.html">USED 2004 Toyota Camry Solara SLE</a>
<span class="itemsep"> - </span>
<span class="itemph"></span>
<span class="itempp"></span>
<span class="itempn"></span>
<span class="itempx"> <span class="p"> img</span></span>
<span class="itemcg" title="ctd"> <small class="gc"><a href="/ctd/">dealer</a></small></span><br class="c">
</p>
<p class="row" data-latitude="" data-longitude="">
<span class="ih"> </span>
<span class="itemdate"></span>
<a href="http://miami.craigslist.org/brw/ctd/3432322614.html">USED 2003 Jeep Grand Cherokee Laredo</a>
<span class="itemsep"> - </span>
<span class="itemph"></span>
<span class="itempp"></span>
<span class="itempn"></span>
<span class="itempx"> <span class="p"> img</span></span>
<span class="itemcg" title="ctd"> <small class="gc"><a href="/ctd/">dealer</a></small></span><br class="c">
</p>
<p class="row" data-latitude="" data-longitude="">
<span class="ih"> </span>
<span class="itemdate"></span>
<a href="http://miami.craigslist.org/mdc/ctd/3409341235.html">USED 2003 Honda Civic LX</a>
<span class="itemsep"> - </span>
<span class="itemph"></span>
<span class="itempp"> $7337</span>
<span class="itempn"></span>
<span class="itempx"> <span class="p"> img</span></span>
<span class="itemcg" title="ctd"> <small class="gc"><a href="/ctd/">dealer</a></small></span><br class="c">
</p>
<p class="row" data-latitude="" data-longitude="">
<span class="ih"> </span>
<span class="itemdate"></span>
<a href="http://miami.craigslist.org/mdc/ctd/3427961503.html">CERTIFIED 2010 Honda Civic Sdn LX</a>
<span class="itemsep"> - </span>
<span class="itemph"></span>
<span class="itempp"> $15726</span>
<span class="itempn"></span>
<span class="itempx"> <span class="p"> img</span></span>
<span class="itemcg" title="ctd"> <small class="gc"><a href="/ctd/">dealer</a></small></span><br class="c">
</p>
<p class="row" data-latitude="" data-longitude="">
<span class="ih"> </span>
<span class="itemdate"></span>
<a href="http://miami.craigslist.org/mdc/cto/3381453092.html">2004 MAZDA3 S HATCH WAGON honda civic</a>
<span class="itemsep"> - </span>
<span class="itemph"></span>
<span class="itempp"> $5900</span>
<span class="itempn"><font size="-1"> (miami westchester)</font></span>
<span class="itempx"> <span class="p"> img</span></span>
<span class="itemcg" title="cto"> <small class="gc"><a href="/cto/">owner</a></small></span><br class="c">
</p>
<p class="row" data-latitude="" data-longitude="">
<span class="ih" id="images:<API key>.jpg"> </span>
<span class="itemdate"></span>
<a href="http://miami.craigslist.org/mdc/cto/3437062685.html">1999 oldsmobile intrigue GL 4 dr</a>
<span class="itemsep"> - </span>
<span class="itemph"></span>
<span class="itempp"> $1500</span>
<span class="itempn"><font size="-1"> (broward / Miami dade )</font></span>
<span class="itempx"> <span class="p"> pic</span></span>
<span class="itemcg" title="cto"> <small class="gc"><a href="/cto/">owner</a></small></span><br class="c">
</p>
<p class="row" data-latitude="" data-longitude="">
<span class="ih"> </span>
<span class="itemdate"></span>
<a href="http://miami.craigslist.org/mdc/ctd/3437062518.html"># 2012 Nissan Versa Hatchback </a>
<span class="itemsep"> - </span>
<span class="itemph"></span>
<span class="itempp"> $12791</span>
<span class="itempn"><font size="-1"> (Miami Lakes)</font></span>
<span class="itempx"> <span class="p"> img</span></span>
<span class="itemcg" title="ctd"> <small class="gc"><a href="/ctd/">dealer</a></small></span><br class="c">
</p>
<p class="row" data-latitude="" data-longitude="">
<span class="ih"> </span>
<span class="itemdate"></span>
<a href="http://miami.craigslist.org/brw/ctd/3427702167.html">USED 2010 NISSAN MAXIMA 3.5 SV</a>
<span class="itemsep"> - </span>
<span class="itemph"></span>
<span class="itempp"> $26244</span>
<span class="itempn"></span>
<span class="itempx"> <span class="p"> img</span></span>
<span class="itemcg" title="ctd"> <small class="gc"><a href="/ctd/">dealer</a></small></span><br class="c">
</p>
<p id="nextpage" align="center"><font size="4"><a href="index100.html">next 100 postings</a></font></p>
<div id="footer">
<hr>
<span id="copy">
Copyright © 2012 craigslist, inc.<br>
</span>
<span class="rss">
<a class="l" href="/cta/index.rss">RSS</a>
<a href="http:
</span>
</div>
<br><br>
<div id="floater"> </div>
</blockquote>
<script type="text/javascript">
<!
window.tocpix=1
</script>
</body>
</html> |
package de.awisus.refugeeaid.views.profile;
import android.app.Activity;
import android.app.Dialog;
import android.content.DialogInterface;
import android.support.v7.app.AlertDialog;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;
import com.google.gson.Gson;
import java.io.IOException;
import de.awisus.refugeeaid.R;
import de.awisus.refugeeaid.LoginData;
import de.awisus.refugeeaid.ViewModel;
import de.awisus.refugeeaid.models.Nutzer;
import de.awisus.refugeeaid.net.WebFlirt;
import de.awisus.refugeeaid.util.BackgroundTask;
import de.awisus.refugeeaid.util.Datei;
import de.awisus.refugeeaid.views.<API key>;
public class FragmentEditUser extends <API key> {
// Attributes //////////////////////////////////////////////////////////////////
private TextView deleteName, deleteMail, deletePasswort, deleteConfirmation;
private Nutzer nutzer;
// Constructor /////////////////////////////////////////////////////////////////
/**
* Public factory method giving the model's reference
*
* @param model ViewModel to log in user
* @return new Login Fragment
*/
public static FragmentEditUser newInstance(ViewModel model, int titelID, int layoutID) {
FragmentEditUser frag = new FragmentEditUser();
frag.model = model;
frag.nutzer = model.getNutzer();
frag.layoutID = layoutID;
frag.titelID = titelID;
return frag;
}
@Override
public void onStart() {
super.onStart();
final AlertDialog dialog = (AlertDialog) getDialog();
if(dialog != null) {
Button positiveButton = dialog.getButton(Dialog.BUTTON_POSITIVE);
positiveButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
patch();
}
});
}
}
@Override
protected void initElements(View view) {
super.initElements(view);
deleteName = (TextView) view.findViewById(R.id.btDeleteName);
deleteMail = (TextView) view.findViewById(R.id.btDeleteMail);
deletePasswort = (TextView) view.findViewById(R.id.btDeletePasswort);
deleteConfirmation = (TextView) view.findViewById(R.id.<API key>);
setTexts();
}
private void setTexts() {
try {
etName.setText(nutzer.getName());
etMail.setText(nutzer.getMail());
String datei = Datei.getInstance().lesen(getActivity(), "login.json");
LoginData login = new Gson().fromJson(datei, LoginData.class);
etPasswort.setText(login.getPasswort());
etConfirmation.setText(login.getPasswort());
} catch (IOException e) {
Log.e("Laden", "Fehler beim Lesen der Logindatei");
}
}
@Override
protected void setButtonListeners(View view) {
deleteName.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
etName.setText(null);
}
});
deleteMail.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
etMail.setText(null);
}
});
deletePasswort.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
etPasswort.setText(null);
etConfirmation.setText(null);
}
});
deleteConfirmation.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
etConfirmation.setText(null);
}
});
Button btDeleteAccount = (Button) view.findViewById(R.id.btDeleteAccount);
btDeleteAccount.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
builder.setMessage(R.string.dialog_sicher);
builder.setCancelable(false);
builder.setPositiveButton(R.string.dialog_ja, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
delete();
}
});
builder.setNegativeButton(R.string.dialog_nein, null);
builder.show();
}
});
}
private void patch() {
String id = String.valueOf(nutzer.getId());
String name = etName.getText().toString();
String mail = etMail.getText().toString();
String passwort = etPasswort.getText().toString();
String confirmation = etConfirmation.getText().toString();
new NutzerPatch(getActivity(), R.string.<API key>, new LoginData(name, mail, passwort))
.execute(
"id", id,
"name", name,
"mail", mail,
"password", passwort,
"<API key>", confirmation);
}
private class NutzerPatch extends BackgroundTask<String, String, Nutzer> {
private LoginData login;
NutzerPatch(Activity context, int textID, LoginData login) {
super(context, textID);
this.login = login;
}
@Override
protected Nutzer doInBackground(String... params) {
String antwort = WebFlirt.patch("users_remote", params);
return antwort.equals("OK") ? nutzer : null;
}
@Override
protected void doPostExecute(Nutzer result) {
if(result == null) {
Toast.makeText(context, R.string.warnung_signup, Toast.LENGTH_SHORT).show();
} else {
try {
Datei.getInstance().schreiben(context, "login.json", new Gson().toJson(login));
nutzer.setName(login.getName());
nutzer.setMail(login.getMail());
} catch (IOException e) {
Log.e("Anmelden", "Fehler beim Speichern der Logindatei");
}
dismiss();
}
}
}
private void delete() {
String id = String.valueOf(nutzer.getId());
new NutzerDelete(getActivity(), R.string.meldung_entfernen).execute("id", id);
}
private class NutzerDelete extends BackgroundTask<String, Integer, String> {
NutzerDelete(Activity context, int textID) {
super(context, textID);
}
@Override
protected String doInBackground(String... params) {
String antwort = WebFlirt.delete("users_remote", params);
return antwort.equals("OK") ? antwort : null;
}
@Override
protected void doPostExecute(String result) {
if(result == null) {
Toast.makeText(context, R.string.warnung_fehler, Toast.LENGTH_SHORT).show();
} else {
try {
Datei.getInstance().loeschen(getActivity(), "login.json");
} catch (IOException e) {
Log.e("Abmelden", "Fehler beim Löschen der Nutzerdaten");
}
dismiss();
model.abmelden();
}
}
}
} |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http:
<html>
<head>
<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<title>Clang - Getting Started</title>
<link type="text/css" rel="stylesheet" href="menu.css" />
<link type="text/css" rel="stylesheet" href="content.css" />
</head>
<body>
<!--#include virtual="menu.html.incl"-->
<div id="content">
<h1>Getting Started: Building and Running Clang</h1>
<p>This page gives you the shortest path to checking out Clang and demos a few
options. This should get you up and running with the minimum of muss and fuss.
If you like what you see, please consider <a href="get_involved.html">getting
involved</a> with the Clang community. If you run into problems, please file
bugs in <a href="http://llvm.org/bugs/">LLVM Bugzilla</a> or bring up the issue
on the
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev">Clang development
mailing list</a>.</p>
<h2 id="build">Building Clang and Working with the Code</h2>
<h3 id="buildNix">On Unix-like Systems</h3>
<p>If you would like to check out and build Clang, the current procedure is as
follows:</p>
<ol>
<li>Get the required tools.
<ul>
<li>See
<a href="http://llvm.org/docs/GettingStarted.html#requirements">
Getting Started with the LLVM System - Requirements</a>.</li>
<li>Note also that Python is needed for running the test suite.
Get it at: <a href="http:
http:
</ul>
<li>Checkout LLVM:</li>
<ul>
<li>Change directory to where you want the llvm directory placed.</li>
<li><tt>svn co http://llvm.org/svn/llvm-project/llvm/trunk llvm</tt></li>
</ul>
<li>Checkout Clang:</li>
<ul>
<li><tt>cd llvm/tools</tt>
<li><tt>svn co http://llvm.org/svn/llvm-project/cfe/trunk clang</tt></li>
</ul>
<li>Build LLVM and Clang:</li>
<ul>
<li><tt>cd ..</tt> (back to llvm)</li>
<li><tt>./configure</tt></li>
<li><tt>make</tt></li>
<li>This builds both LLVM and Clang for debug mode.</li>
<li>Note: For subsequent Clang development, you can just do make at the
clang directory level.</li>
</ul>
<p>It is also possible to use CMake instead of the makefiles. With CMake it
is also possible to generate project files for several IDEs: Eclipse CDT4,
CodeBlocks, Qt-Creator (use the CodeBlocks generator), KDevelop3.</p>
<li>If you intend to work on Clang C++ support, you may need to tell it how
to find your C++ standard library headers. If Clang cannot find your
system libstdc++ headers, please follow these instructions:</li>
<ul>
<li>'<tt>gcc -v -x c++ /dev/null -fsyntax-only</tt>' to get the
path.</li>
<li>Look for the comment "FIXME: temporary hack:
hard-coded paths" in <tt>clang/lib/Frontend/InitHeaderSearch.cpp</tt> and
change the lines below to include that path.</li>
</ul>
<li>Try it out (assuming you add llvm/Debug+Asserts/bin to your path):</li>
<ul>
<li><tt>clang --help</tt></li>
<li><tt>clang file.c -fsyntax-only</tt> (check for correctness)</li>
<li><tt>clang file.c -S -emit-llvm -o -</tt> (print out unoptimized llvm code)</li>
<li><tt>clang file.c -S -emit-llvm -o - -O3</tt></li>
<li><tt>clang file.c -S -O3 -o -</tt> (output native machine code)</li>
</ul>
</ol>
<p>Note that the C front-end uses LLVM, but does not depend on llvm-gcc. If you
encounter problems with building Clang, make sure you have the latest SVN
version of LLVM. LLVM contains support libraries for Clang that will be updated
as well as development on Clang progresses.</p>
<h3>Simultaneously Building Clang and LLVM:</h3>
<p>Once you have checked out Clang into the llvm source tree it will build along
with the rest of <tt>llvm</tt>. To build all of LLVM and Clang together all at
once simply run <tt>make</tt> from the root LLVM directory.</p>
<p><em>Note:</em> Observe that Clang is technically part of a separate
Subversion repository. As mentioned above, the latest Clang sources are tied to
the latest sources in the LLVM tree. You can update your toplevel LLVM project
and all (possibly unrelated) projects inside it with <tt><b>make
update</b></tt>. This will run <tt>svn update</tt> on all subdirectories related
to subversion. </p>
<h3 id="buildWindows">Using Visual Studio</h3>
<p>The following details setting up for and building Clang on Windows using
Visual Studio:</p>
<ol>
<li>Get the required tools:</li>
<ul>
<li><b>Subversion</b>. Source code control program. Get it from:
<a href="http://subversion.tigris.org/getting.html">
http://subversion.tigris.org/getting.html</a></li>
<li><b>cmake</b>. This is used for generating Visual Studio solution and
project files. Get it from:
<a href="http:
http:
<li><b>Visual Studio 2005 or 2008</b></li>
<li><b>Python</b>. This is needed only if you will be running the tests
(which is essential, if you will be developing for clang).
Get it from:
<a href="http:
http:
<li><b>GnuWin32 tools</b>
These are also necessary for running the tests.
(Note that the grep from MSYS or Cygwin doesn't work with the tests
because of embedded double-quotes in the search strings. The GNU
grep does work in this case.)
Get them from <a href="http://getgnuwin32.sourceforge.net">
http://getgnuwin32.sourceforge.net</a>.</li>
</ul>
<li>Checkout LLVM:</li>
<ul>
<li><tt>svn co http://llvm.org/svn/llvm-project/llvm/trunk llvm</tt></li>
</ul>
<li>Checkout Clang:</li>
<ul>
<li><tt>cd llvm\tools</tt>
<li><tt>svn co http://llvm.org/svn/llvm-project/cfe/trunk clang</tt></li>
</ul>
<li>Run cmake to generate the Visual Studio solution and project files:</li>
<ul>
<li><tt>cd ..</tt> (Change directory back to the llvm top.)</li>
<li>If you are using Visual Studio 2005: <tt>cmake .</tt></li>
<li>Or if you are using Visual Studio 2008: <tt>cmake -G "Visual Studio 9 2008" .</tt></li>
<li>The above, if successful, will have created an LLVM.sln file in the
llvm directory.
</ul>
<li>Build Clang:</li>
<ul>
<li>Open LLVM.sln in Visual Studio.</li>
<li>Build the "clang" project for just the compiler driver and front end, or
the "ALL_BUILD" project to build everything, including tools.</li>
</ul>
<li>Try it out (assuming you added llvm/debug/bin to your path). (See the
running examples from above.)</li>
<li>See <a href="hacking.html#testingWindows">
Hacking on clang - Testing using Visual Studio on Windows</a> for information
on running regression tests on Windows.</li>
</ol>
<p>Note that once you have checked out both llvm and clang, to synchronize
to the latest code base, use the <tt>svn update</tt> command in both the
llvm and llvm\tools\clang directories, as they are separate repositories.</p>
<a name="driver"><h2>Clang Compiler Driver (Drop-in Substitute for GCC)</h2></a>
<p>The <tt>clang</tt> tool is the compiler driver and front-end, which is
designed to be a drop-in replacement for the <tt>gcc</tt> command. Here are
some examples of how to use the high-level driver:
</p>
<pre class="code">
$ <b>cat t.c</b>
#include <stdio.h>
int main(int argc, char **argv) { printf("hello world\n"); }
$ <b>clang t.c</b>
$ <b>./a.out</b>
hello world
</pre>
<p>The 'clang' driver is designed to work as closely to GCC as possible to
maximize portability. The only major difference between the two is that
Clang defaults to gnu99 mode while GCC defaults to gnu89 mode. If you see
weird link-time errors relating to inline functions, try passing -std=gnu89
to clang.</p>
<h2>Examples of using Clang</h2>
<!-- Thanks to
http://shiflett.org/blog/2006/oct/<API key>
Site suggested using pre in CSS, but doesn't work in IE, so went for the <pre>
tag.
<pre class="code">
$ <b>cat ~/t.c</b>
typedef float V __attribute__((vector_size(16)));
V foo(V a, V b) { return a+b*a; }
</pre>
<h3>Preprocessing:</h3>
<pre class="code">
$ <b>clang ~/t.c -E</b>
# 1 "/Users/sabre/t.c" 1
typedef float V __attribute__((vector_size(16)));
V foo(V a, V b) { return a+b*a; }
</pre>
<h3>Type checking:</h3>
<pre class="code">
$ <b>clang -fsyntax-only ~/t.c</b>
</pre>
<h3>GCC options:</h3>
<pre class="code">
$ <b>clang -fsyntax-only ~/t.c -pedantic</b>
/Users/sabre/t.c:2:17: warning: extension used
typedef float V __attribute__((vector_size(16)));
^
1 diagnostic generated.
</pre>
<h3>Pretty printing from the AST:</h3>
<p>Note, the <tt>-cc1</tt> argument indicates the the compiler front-end, and
not the driver, should be run. The compiler front-end has several additional
Clang specific features which are not exposed through the GCC compatible driver
interface.</p>
<pre class="code">
$ <b>clang -cc1 ~/t.c -ast-print</b>
typedef float V __attribute__(( vector_size(16) ));
V foo(V a, V b) {
return a + b * a;
}
</pre>
<h3>Code generation with LLVM:</h3>
<pre class="code">
$ <b>clang ~/t.c -S -emit-llvm -o -</b>
define <4 x float> @foo(<4 x float> %a, <4 x float> %b) {
entry:
%mul = mul <4 x float> %b, %a
%add = add <4 x float> %mul, %a
ret <4 x float> %add
}
$ <b>clang -fomit-frame-pointer -O3 -S -o - t.c</b> <i># On x86_64</i>
_foo:
Leh_func_begin1:
mulps %xmm0, %xmm1
addps %xmm1, %xmm0
ret
Leh_func_end1:
</pre>
</div>
</body>
</html> |
#include <phapp.h>
typedef struct <API key>
{
PPH_SERVICE_ITEM *Services;
ULONG NumberOfServices;
<API key> <API key>;
PWSTR ListViewSettingName;
PH_LAYOUT_MANAGER LayoutManager;
HWND WindowHandle;
} PH_SERVICES_CONTEXT, *<API key>;
VOID NTAPI <API key>(
__in_opt PVOID Parameter,
__in_opt PVOID Context
);
INT_PTR CALLBACK PhpServicesPageProc(
__in HWND hwndDlg,
__in UINT uMsg,
__in WPARAM wParam,
__in LPARAM lParam
);
/**
* Creates a service list property page.
*
* \param ParentWindowHandle The parent of the service list.
* \param Services An array of service items. Each
* service item must have a reference that is transferred
* to this function. The array must be allocated using
* PhAllocate() and must not be freed by the caller; it
* will be freed automatically when no longer needed.
* \param NumberOfServices The number of service items
* in \a Services.
*/
HWND <API key>(
__in HWND ParentWindowHandle,
__in PPH_SERVICE_ITEM *Services,
__in ULONG NumberOfServices
)
{
HWND windowHandle;
<API key> servicesContext;
servicesContext = PhAllocate(sizeof(PH_SERVICES_CONTEXT));
memset(servicesContext, 0, sizeof(PH_SERVICES_CONTEXT));
servicesContext->Services = Services;
servicesContext->NumberOfServices = NumberOfServices;
windowHandle = CreateDialogParam(
PhInstanceHandle,
MAKEINTRESOURCE(IDD_SRVLIST),
ParentWindowHandle,
PhpServicesPageProc,
(LPARAM)servicesContext
);
if (!windowHandle)
{
PhFree(servicesContext);
return windowHandle;
}
return windowHandle;
}
static VOID NTAPI <API key>(
__in_opt PVOID Parameter,
__in_opt PVOID Context
)
{
<API key> serviceModifiedData = (<API key>)Parameter;
<API key> servicesContext = (<API key>)Context;
<API key> copy;
copy = PhAllocateCopy(serviceModifiedData, sizeof(<API key>));
PostMessage(servicesContext->WindowHandle, <API key>, 0, (LPARAM)copy);
}
VOID <API key>(
__in HWND hWnd,
__in_opt PPH_SERVICE_ITEM ServiceItem
)
{
HWND startButton;
HWND pauseButton;
HWND descriptionLabel;
startButton = GetDlgItem(hWnd, IDC_START);
pauseButton = GetDlgItem(hWnd, IDC_PAUSE);
descriptionLabel = GetDlgItem(hWnd, IDC_DESCRIPTION);
if (ServiceItem)
{
SC_HANDLE serviceHandle;
PPH_STRING description;
switch (ServiceItem->State)
{
case SERVICE_RUNNING:
{
SetWindowText(startButton, L"S&top");
SetWindowText(pauseButton, L"&Pause");
EnableWindow(startButton, ServiceItem->ControlsAccepted & SERVICE_ACCEPT_STOP);
EnableWindow(pauseButton, ServiceItem->ControlsAccepted & <API key>);
}
break;
case SERVICE_PAUSED:
{
SetWindowText(startButton, L"S&top");
SetWindowText(pauseButton, L"C&ontinue");
EnableWindow(startButton, ServiceItem->ControlsAccepted & SERVICE_ACCEPT_STOP);
EnableWindow(pauseButton, ServiceItem->ControlsAccepted & <API key>);
}
break;
case SERVICE_STOPPED:
{
SetWindowText(startButton, L"&Start");
SetWindowText(pauseButton, L"&Pause");
EnableWindow(startButton, TRUE);
EnableWindow(pauseButton, FALSE);
}
break;
case <API key>:
case <API key>:
case <API key>:
case <API key>:
{
SetWindowText(startButton, L"&Start");
SetWindowText(pauseButton, L"&Pause");
EnableWindow(startButton, FALSE);
EnableWindow(pauseButton, FALSE);
}
break;
}
if (serviceHandle = PhOpenService(
ServiceItem->Name->Buffer,
<API key>
))
{
if (description = <API key>(serviceHandle))
{
SetWindowText(descriptionLabel, description->Buffer);
PhDereferenceObject(description);
}
CloseServiceHandle(serviceHandle);
}
}
else
{
SetWindowText(startButton, L"&Start");
SetWindowText(pauseButton, L"&Pause");
EnableWindow(startButton, FALSE);
EnableWindow(pauseButton, FALSE);
SetWindowText(descriptionLabel, L"");
}
}
INT_PTR CALLBACK PhpServicesPageProc(
__in HWND hwndDlg,
__in UINT uMsg,
__in WPARAM wParam,
__in LPARAM lParam
)
{
<API key> servicesContext;
HWND lvHandle;
if (uMsg == WM_INITDIALOG)
{
servicesContext = (<API key>)lParam;
SetProp(hwndDlg, PhMakeContextAtom(), (HANDLE)servicesContext);
}
else
{
servicesContext = (<API key>)GetProp(hwndDlg, PhMakeContextAtom());
if (uMsg == WM_DESTROY)
{
RemoveProp(hwndDlg, PhMakeContextAtom());
}
}
if (!servicesContext)
return FALSE;
lvHandle = GetDlgItem(hwndDlg, IDC_LIST);
switch (uMsg)
{
case WM_INITDIALOG:
{
ULONG i;
PhRegisterCallback(
&<API key>,
<API key>,
servicesContext,
&servicesContext-><API key>
);
servicesContext->WindowHandle = hwndDlg;
// Initialize the list.
PhSetListViewStyle(lvHandle, TRUE, TRUE);
PhSetControlTheme(lvHandle, L"explorer");
PhAddListViewColumn(lvHandle, 0, 0, 0, LVCFMT_LEFT, 120, L"Name");
PhAddListViewColumn(lvHandle, 1, 1, 1, LVCFMT_LEFT, 220, L"Display Name");
<API key>(lvHandle);
for (i = 0; i < servicesContext->NumberOfServices; i++)
{
PPH_SERVICE_ITEM serviceItem;
INT lvItemIndex;
serviceItem = servicesContext->Services[i];
lvItemIndex = PhAddListViewItem(lvHandle, MAXINT, serviceItem->Name->Buffer, serviceItem);
<API key>(lvHandle, lvItemIndex, 1, serviceItem->DisplayName->Buffer);
}
<API key>(lvHandle);
<API key>(hwndDlg, NULL);
<API key>(&servicesContext->LayoutManager, hwndDlg);
PhAddLayoutItem(&servicesContext->LayoutManager, GetDlgItem(hwndDlg, IDC_LIST),
NULL, PH_ANCHOR_ALL);
PhAddLayoutItem(&servicesContext->LayoutManager, GetDlgItem(hwndDlg, IDC_DESCRIPTION),
NULL, PH_ANCHOR_LEFT | PH_ANCHOR_RIGHT | PH_ANCHOR_BOTTOM);
PhAddLayoutItem(&servicesContext->LayoutManager, GetDlgItem(hwndDlg, IDC_START),
NULL, PH_ANCHOR_RIGHT | PH_ANCHOR_BOTTOM);
PhAddLayoutItem(&servicesContext->LayoutManager, GetDlgItem(hwndDlg, IDC_PAUSE),
NULL, PH_ANCHOR_RIGHT | PH_ANCHOR_BOTTOM);
}
break;
case WM_DESTROY:
{
ULONG i;
for (i = 0; i < servicesContext->NumberOfServices; i++)
PhDereferenceObject(servicesContext->Services[i]);
PhFree(servicesContext->Services);
<API key>(
&<API key>,
&servicesContext-><API key>
);
if (servicesContext->ListViewSettingName)
<API key>(servicesContext->ListViewSettingName, lvHandle);
<API key>(&servicesContext->LayoutManager);
PhFree(servicesContext);
}
break;
case WM_COMMAND:
{
INT id = LOWORD(wParam);
switch (id)
{
case IDC_START:
{
PPH_SERVICE_ITEM serviceItem = <API key>(lvHandle);
if (serviceItem)
{
switch (serviceItem->State)
{
case SERVICE_RUNNING:
PhUiStopService(hwndDlg, serviceItem);
break;
case SERVICE_PAUSED:
PhUiStopService(hwndDlg, serviceItem);
break;
case SERVICE_STOPPED:
PhUiStartService(hwndDlg, serviceItem);
break;
}
}
}
break;
case IDC_PAUSE:
{
PPH_SERVICE_ITEM serviceItem = <API key>(lvHandle);
if (serviceItem)
{
switch (serviceItem->State)
{
case SERVICE_RUNNING:
PhUiPauseService(hwndDlg, serviceItem);
break;
case SERVICE_PAUSED:
PhUiContinueService(hwndDlg, serviceItem);
break;
}
}
}
break;
}
}
break;
case WM_NOTIFY:
{
LPNMHDR header = (LPNMHDR)lParam;
<API key>(lParam, lvHandle);
switch (header->code)
{
case NM_DBLCLK:
{
if (header->hwndFrom == lvHandle)
{
PPH_SERVICE_ITEM serviceItem = <API key>(lvHandle);
if (serviceItem)
{
<API key>(hwndDlg, serviceItem);
}
}
}
break;
case LVN_ITEMCHANGED:
{
if (header->hwndFrom == lvHandle)
{
//LPNMITEMACTIVATE itemActivate = (LPNMITEMACTIVATE)header;
PPH_SERVICE_ITEM serviceItem = NULL;
if (<API key>(lvHandle) == 1)
serviceItem = <API key>(lvHandle);
<API key>(hwndDlg, serviceItem);
}
}
break;
}
}
break;
case WM_SIZE:
{
<API key>(&servicesContext->LayoutManager);
}
break;
case <API key>:
{
<API key> serviceModifiedData = (<API key>)lParam;
PPH_SERVICE_ITEM serviceItem = NULL;
if (<API key>(lvHandle) == 1)
serviceItem = <API key>(lvHandle);
if (serviceModifiedData->Service == serviceItem)
{
<API key>(hwndDlg, serviceItem);
}
PhFree(serviceModifiedData);
}
break;
case <API key>:
{
PWSTR settingName = (PWSTR)lParam;
servicesContext->ListViewSettingName = settingName;
<API key>(settingName, lvHandle);
}
break;
}
return FALSE;
} |
#include "Copter.h"
#if MODE_GUIDED_ENABLED == ENABLED
/*
* Init and run calls for guided flight mode
*/
#ifndef <API key>
# define <API key> 500 // point nose at target if it is more than 5m away
#endif
#define <API key> 3000 // guided mode's position-velocity controller times out after 3seconds with no new updates
#define <API key> 1000 // guided mode's attitude controller times out after 1 second with no new updates
static Vector3f <API key>; // position target (used by posvel controller only)
static Vector3f <API key>; // velocity target (used by velocity controller and posvel controller)
static uint32_t <API key>; // system time of last target update to posvel controller (i.e. position and velocity update)
static uint32_t vel_update_time_ms; // system time of last target update to velocity controller
struct {
uint32_t update_time_ms;
float roll_cd;
float pitch_cd;
float yaw_cd;
float yaw_rate_cds;
float climb_rate_cms; // climb rate in cms. Used if use_thrust is false
float thrust; // thrust from -1 to 1. Used if use_thrust is true
bool use_yaw_rate;
bool use_thrust;
} static guided_angle_state;
struct Guided_Limit {
uint32_t timeout_ms; // timeout (in seconds) from the time that guided is invoked
float alt_min_cm; // lower altitude limit in cm above home (0 = no limit)
float alt_max_cm; // upper altitude limit in cm above home (0 = no limit)
float horiz_max_cm; // horizontal position limit in cm from where guided mode was initiated (0 = no limit)
uint32_t start_time;// system time in milliseconds that control was handed to the external computer
Vector3f start_pos; // start position as a distance from home in cm. used for checking horiz_max limit
} guided_limit;
// guided_init - initialise guided controller
bool ModeGuided::init(bool ignore_checks)
{
// start in position control mode
pos_control_start();
return true;
}
// guided_run - runs the guided controller
// should be called at 100hz or more
void ModeGuided::run()
{
// call the correct auto controller
switch (guided_mode) {
case Guided_TakeOff:
// run takeoff controller
takeoff_run();
break;
case Guided_WP:
// run position controller
pos_control_run();
break;
case Guided_Velocity:
// run velocity controller
vel_control_run();
break;
case Guided_PosVel:
// run position-velocity controller
posvel_control_run();
break;
case Guided_Angle:
// run angle controller
angle_control_run();
break;
}
}
bool ModeGuided::allows_arming(bool from_gcs) const
{
// always allow arming from the ground station
if (from_gcs) {
return true;
}
// optionally allow arming from the transmitter
return (copter.g2.guided_options & (uint32_t)Options::AllowArmingFromTX) != 0;
};
// <API key> - initialises waypoint controller to implement take-off
bool ModeGuided::<API key>(float takeoff_alt_cm)
{
guided_mode = Guided_TakeOff;
// initialise wpnav destination
Location target_loc = copter.current_loc;
Location::AltFrame frame = Location::AltFrame::ABOVE_HOME;
if (wp_nav-><API key>() &&
wp_nav->get_terrain_source() == AC_WPNav::TerrainSource::<API key> &&
takeoff_alt_cm < copter.rangefinder.<API key>(ROTATION_PITCH_270)) {
// can't takeoff downwards
if (takeoff_alt_cm <= copter.rangefinder_state.alt_cm) {
return false;
}
frame = Location::AltFrame::ABOVE_TERRAIN;
}
target_loc.set_alt_cm(takeoff_alt_cm, frame);
if (!wp_nav->set_wp_destination(target_loc)) {
// failure to set destination can only be because of missing terrain data
AP::logger().Write_Error(LogErrorSubsystem::NAVIGATION, LogErrorCode::<API key>);
// failure is propagated to GCS with NAK
return false;
}
// initialise yaw
auto_yaw.set_mode(AUTO_YAW_HOLD);
// clear i term when we're taking off
<API key>();
// get initial alt for WP_NAVALT_MIN
<API key>();
return true;
}
// initialise guided mode's position controller
void ModeGuided::pos_control_start()
{
// set to position control mode
guided_mode = Guided_WP;
// initialise waypoint and spline controller
wp_nav->wp_and_spline_init();
// initialise wpnav to stopping point
Vector3f stopping_point;
wp_nav-><API key>(stopping_point);
// no need to check return status because terrain data is not used
wp_nav->set_wp_destination(stopping_point, false);
// initialise yaw
auto_yaw.set_mode_to_default(false);
}
// initialise guided mode's velocity controller
void ModeGuided::vel_control_start()
{
// set guided_mode to velocity controller
guided_mode = Guided_Velocity;
// initialise horizontal speed, acceleration
pos_control->set_max_speed_xy(wp_nav-><API key>());
pos_control->set_max_accel_xy(wp_nav->get_wp_acceleration());
// initialize vertical speeds and acceleration
pos_control->set_max_speed_z(-get_pilot_speed_dn(), g.pilot_speed_up);
pos_control->set_max_accel_z(g.pilot_accel_z);
// initialise velocity controller
pos_control-><API key>();
}
// initialise guided mode's posvel controller
void ModeGuided::<API key>()
{
// set guided_mode to velocity controller
guided_mode = Guided_PosVel;
pos_control->init_xy_controller();
// set speed and acceleration from wpnav's speed and acceleration
pos_control->set_max_speed_xy(wp_nav-><API key>());
pos_control->set_max_accel_xy(wp_nav->get_wp_acceleration());
const Vector3f& curr_pos = inertial_nav.get_position();
const Vector3f& curr_vel = inertial_nav.get_velocity();
// set target position and velocity to current position and velocity
pos_control->set_xy_target(curr_pos.x, curr_pos.y);
pos_control-><API key>(curr_vel.x, curr_vel.y);
// set vertical speed and acceleration
pos_control->set_max_speed_z(wp_nav-><API key>(), wp_nav-><API key>());
pos_control->set_max_accel_z(wp_nav->get_accel_z());
// pilot always controls yaw
auto_yaw.set_mode(AUTO_YAW_HOLD);
}
bool ModeGuided::is_taking_off() const
{
return guided_mode == Guided_TakeOff;
}
// initialise guided mode's angle controller
void ModeGuided::angle_control_start()
{
// set guided_mode to velocity controller
guided_mode = Guided_Angle;
// set vertical speed and acceleration
pos_control->set_max_speed_z(wp_nav-><API key>(), wp_nav-><API key>());
pos_control->set_max_accel_z(wp_nav->get_accel_z());
// initialise position and desired velocity
if (!pos_control->is_active_z()) {
pos_control-><API key>();
pos_control-><API key>(inertial_nav.get_velocity_z());
}
// initialise targets
guided_angle_state.update_time_ms = millis();
guided_angle_state.roll_cd = ahrs.roll_sensor;
guided_angle_state.pitch_cd = ahrs.pitch_sensor;
guided_angle_state.yaw_cd = ahrs.yaw_sensor;
guided_angle_state.climb_rate_cms = 0.0f;
guided_angle_state.yaw_rate_cds = 0.0f;
guided_angle_state.use_yaw_rate = false;
// pilot always controls yaw
auto_yaw.set_mode(AUTO_YAW_HOLD);
}
// <API key> - sets guided mode's target destination
// Returns true if the fence is enabled and guided waypoint is within the fence
// else return false if the waypoint is outside the fence
bool ModeGuided::set_destination(const Vector3f& destination, bool use_yaw, float yaw_cd, bool use_yaw_rate, float yaw_rate_cds, bool relative_yaw, bool terrain_alt)
{
#if AC_FENCE == ENABLED
// reject destination if outside the fence
const Location dest_loc(destination);
if (!copter.fence.<API key>(dest_loc)) {
AP::logger().Write_Error(LogErrorSubsystem::NAVIGATION, LogErrorCode::DEST_OUTSIDE_FENCE);
// failure is propagated to GCS with NAK
return false;
}
#endif
// ensure we are in position control mode
if (guided_mode != Guided_WP) {
pos_control_start();
}
// set yaw state
set_yaw_state(use_yaw, yaw_cd, use_yaw_rate, yaw_rate_cds, relative_yaw);
// no need to check return status because terrain data is not used
wp_nav->set_wp_destination(destination, terrain_alt);
// log target
copter.<API key>(guided_mode, destination, Vector3f());
return true;
}
bool ModeGuided::get_wp(Location& destination)
{
if (guided_mode != Guided_WP) {
return false;
}
return wp_nav-><API key>(destination);
}
// sets guided mode's target from a Location object
// returns false if destination could not be set (probably caused by missing terrain data)
// or if the fence is enabled and guided waypoint is outside the fence
bool ModeGuided::set_destination(const Location& dest_loc, bool use_yaw, float yaw_cd, bool use_yaw_rate, float yaw_rate_cds, bool relative_yaw)
{
#if AC_FENCE == ENABLED
// reject destination outside the fence.
// Note: there is a danger that a target specified as a terrain altitude might not be checked if the conversion to alt-above-home fails
if (!copter.fence.<API key>(dest_loc)) {
AP::logger().Write_Error(LogErrorSubsystem::NAVIGATION, LogErrorCode::DEST_OUTSIDE_FENCE);
// failure is propagated to GCS with NAK
return false;
}
#endif
// ensure we are in position control mode
if (guided_mode != Guided_WP) {
pos_control_start();
}
if (!wp_nav->set_wp_destination(dest_loc)) {
// failure to set destination can only be because of missing terrain data
AP::logger().Write_Error(LogErrorSubsystem::NAVIGATION, LogErrorCode::<API key>);
// failure is propagated to GCS with NAK
return false;
}
// set yaw state
set_yaw_state(use_yaw, yaw_cd, use_yaw_rate, yaw_rate_cds, relative_yaw);
// log target
copter.<API key>(guided_mode, Vector3f(dest_loc.lat, dest_loc.lng, dest_loc.alt),Vector3f());
return true;
}
// guided_set_velocity - sets guided mode's target velocity
void ModeGuided::set_velocity(const Vector3f& velocity, bool use_yaw, float yaw_cd, bool use_yaw_rate, float yaw_rate_cds, bool relative_yaw, bool log_request)
{
// check we are in velocity control mode
if (guided_mode != Guided_Velocity) {
vel_control_start();
}
// set yaw state
set_yaw_state(use_yaw, yaw_cd, use_yaw_rate, yaw_rate_cds, relative_yaw);
// record velocity target
<API key> = velocity;
vel_update_time_ms = millis();
// log target
if (log_request) {
copter.<API key>(guided_mode, Vector3f(), velocity);
}
}
// set guided mode posvel target
bool ModeGuided::<API key>(const Vector3f& destination, const Vector3f& velocity, bool use_yaw, float yaw_cd, bool use_yaw_rate, float yaw_rate_cds, bool relative_yaw)
{
#if AC_FENCE == ENABLED
// reject destination if outside the fence
const Location dest_loc(destination);
if (!copter.fence.<API key>(dest_loc)) {
AP::logger().Write_Error(LogErrorSubsystem::NAVIGATION, LogErrorCode::DEST_OUTSIDE_FENCE);
// failure is propagated to GCS with NAK
return false;
}
#endif
// check we are in velocity control mode
if (guided_mode != Guided_PosVel) {
<API key>();
}
// set yaw state
set_yaw_state(use_yaw, yaw_cd, use_yaw_rate, yaw_rate_cds, relative_yaw);
<API key> = millis();
<API key> = destination;
<API key> = velocity;
copter.pos_control->set_pos_target(<API key>);
// log target
copter.<API key>(guided_mode, destination, velocity);
return true;
}
// set guided mode angle target and climbrate
void ModeGuided::set_angle(const Quaternion &q, float <API key>, bool use_yaw_rate, float yaw_rate_rads, bool use_thrust)
{
// check we are in velocity control mode
if (guided_mode != Guided_Angle) {
angle_control_start();
}
// convert quaternion to euler angles
q.to_euler(guided_angle_state.roll_cd, guided_angle_state.pitch_cd, guided_angle_state.yaw_cd);
guided_angle_state.roll_cd = ToDeg(guided_angle_state.roll_cd) * 100.0f;
guided_angle_state.pitch_cd = ToDeg(guided_angle_state.pitch_cd) * 100.0f;
guided_angle_state.yaw_cd = wrap_180_cd(ToDeg(guided_angle_state.yaw_cd) * 100.0f);
guided_angle_state.yaw_rate_cds = ToDeg(yaw_rate_rads) * 100.0f;
guided_angle_state.use_yaw_rate = use_yaw_rate;
guided_angle_state.use_thrust = use_thrust;
if (use_thrust) {
guided_angle_state.thrust = <API key>;
guided_angle_state.climb_rate_cms = 0.0f;
} else {
guided_angle_state.thrust = 0.0f;
guided_angle_state.climb_rate_cms = <API key>;
}
guided_angle_state.update_time_ms = millis();
// log target
copter.<API key>(guided_mode,
Vector3f(guided_angle_state.roll_cd, guided_angle_state.pitch_cd, guided_angle_state.yaw_cd),
Vector3f(0.0f, 0.0f, <API key>));
}
// guided_takeoff_run - takeoff in guided mode
// called by guided_run at 100hz or more
void ModeGuided::takeoff_run()
{
auto_takeoff_run();
if (wp_nav-><API key>()) {
// optionally retract landing gear
copter.landinggear.<API key>();
// switch to position control mode but maintain current target
const Vector3f target = wp_nav->get_wp_destination();
set_destination(target, false, 0, false, 0, false, wp_nav-><API key>());
}
}
// <API key> - runs the guided position controller
// called from guided_run
void ModeGuided::pos_control_run()
{
// process pilot's yaw input
float target_yaw_rate = 0;
if (!copter.failsafe.radio && use_pilot_yaw()) {
// get pilot's desired yaw rate
target_yaw_rate = <API key>(channel_yaw->get_control_in());
if (!is_zero(target_yaw_rate)) {
auto_yaw.set_mode(AUTO_YAW_HOLD);
}
}
// if not armed set throttle to zero and exit immediately
if (<API key>()) {
<API key>();
return;
}
// set motors to full range
motors-><API key>(AP_Motors::DesiredSpoolState::THROTTLE_UNLIMITED);
// run waypoint controller
copter.<API key>(wp_nav->update_wpnav());
// call z-axis position controller (wpnav should have already updated it's alt target)
pos_control->update_z_controller();
// call attitude controller
if (auto_yaw.mode() == AUTO_YAW_HOLD) {
// roll & pitch from waypoint controller, yaw rate from pilot
attitude_control-><API key>(wp_nav->get_roll(), wp_nav->get_pitch(), target_yaw_rate);
} else if (auto_yaw.mode() == AUTO_YAW_RATE) {
// roll & pitch from waypoint controller, yaw rate from mavlink command or mission item
attitude_control-><API key>(wp_nav->get_roll(), wp_nav->get_pitch(), auto_yaw.rate_cds());
} else {
// roll, pitch from waypoint controller, yaw heading from GCS or auto_heading()
attitude_control-><API key>(wp_nav->get_roll(), wp_nav->get_pitch(), auto_yaw.yaw(), true);
}
}
// <API key> - runs the guided velocity controller
// called from guided_run
void ModeGuided::vel_control_run()
{
// process pilot's yaw input
float target_yaw_rate = 0;
if (!copter.failsafe.radio && use_pilot_yaw()) {
// get pilot's desired yaw rate
target_yaw_rate = <API key>(channel_yaw->get_control_in());
if (!is_zero(target_yaw_rate)) {
auto_yaw.set_mode(AUTO_YAW_HOLD);
}
}
// landed with positive desired climb rate, initiate takeoff
if (motors->armed() && copter.ap.auto_armed && copter.ap.land_complete && is_positive(<API key>.z)) {
<API key>();
motors-><API key>(AP_Motors::DesiredSpoolState::THROTTLE_UNLIMITED);
if (motors->get_spool_state() == AP_Motors::SpoolState::THROTTLE_UNLIMITED) {
set_land_complete(false);
<API key>();
}
return;
}
// if not armed set throttle to zero and exit immediately
if (<API key>()) {
<API key>();
return;
}
// set motors to full range
motors-><API key>(AP_Motors::DesiredSpoolState::THROTTLE_UNLIMITED);
// set velocity to zero and stop rotating if no updates received for 3 seconds
uint32_t tnow = millis();
if (tnow - vel_update_time_ms > <API key>) {
if (!pos_control-><API key>().is_zero()) {
<API key>(Vector3f(0.0f, 0.0f, 0.0f));
}
if (auto_yaw.mode() == AUTO_YAW_RATE) {
auto_yaw.set_rate(0.0f);
}
} else {
<API key>(<API key>);
}
// call velocity controller which includes z axis controller
pos_control-><API key>();
// call attitude controller
if (auto_yaw.mode() == AUTO_YAW_HOLD) {
// roll & pitch from waypoint controller, yaw rate from pilot
attitude_control-><API key>(pos_control->get_roll(), pos_control->get_pitch(), target_yaw_rate);
} else if (auto_yaw.mode() == AUTO_YAW_RATE) {
// roll & pitch from velocity controller, yaw rate from mavlink command or mission item
attitude_control-><API key>(pos_control->get_roll(), pos_control->get_pitch(), auto_yaw.rate_cds());
} else {
// roll, pitch from waypoint controller, yaw heading from GCS or auto_heading()
attitude_control-><API key>(pos_control->get_roll(), pos_control->get_pitch(), auto_yaw.yaw(), true);
}
}
// <API key> - runs the guided spline controller
// called from guided_run
void ModeGuided::posvel_control_run()
{
// process pilot's yaw input
float target_yaw_rate = 0;
if (!copter.failsafe.radio && use_pilot_yaw()) {
// get pilot's desired yaw rate
target_yaw_rate = <API key>(channel_yaw->get_control_in());
if (!is_zero(target_yaw_rate)) {
auto_yaw.set_mode(AUTO_YAW_HOLD);
}
}
// if not armed set throttle to zero and exit immediately
if (<API key>()) {
<API key>();
return;
}
// set motors to full range
motors-><API key>(AP_Motors::DesiredSpoolState::THROTTLE_UNLIMITED);
// set velocity to zero and stop rotating if no updates received for 3 seconds
uint32_t tnow = millis();
if (tnow - <API key> > <API key>) {
<API key>.zero();
if (auto_yaw.mode() == AUTO_YAW_RATE) {
auto_yaw.set_rate(0.0f);
}
}
// calculate dt
float dt = pos_control-><API key>();
// sanity check dt
if (dt >= 0.2f) {
dt = 0.0f;
}
// advance position target using velocity target
<API key> += <API key> * dt;
// send position and velocity targets to position controller
pos_control->set_pos_target(<API key>);
pos_control-><API key>(<API key>.x, <API key>.y);
// run position controllers
pos_control-><API key>();
pos_control->update_z_controller();
// call attitude controller
if (auto_yaw.mode() == AUTO_YAW_HOLD) {
// roll & pitch from waypoint controller, yaw rate from pilot
attitude_control-><API key>(pos_control->get_roll(), pos_control->get_pitch(), target_yaw_rate);
} else if (auto_yaw.mode() == AUTO_YAW_RATE) {
// roll & pitch from position-velocity controller, yaw rate from mavlink command or mission item
attitude_control-><API key>(pos_control->get_roll(), pos_control->get_pitch(), auto_yaw.rate_cds());
} else {
// roll, pitch from waypoint controller, yaw heading from GCS or auto_heading()
attitude_control-><API key>(pos_control->get_roll(), pos_control->get_pitch(), auto_yaw.yaw(), true);
}
}
// <API key> - runs the guided angle controller
// called from guided_run
void ModeGuided::angle_control_run()
{
// constrain desired lean angles
float roll_in = guided_angle_state.roll_cd;
float pitch_in = guided_angle_state.pitch_cd;
float total_in = norm(roll_in, pitch_in);
float angle_max = MIN(attitude_control-><API key>(), copter.aparm.angle_max);
if (total_in > angle_max) {
float ratio = angle_max / total_in;
roll_in *= ratio;
pitch_in *= ratio;
}
// wrap yaw request
float yaw_in = wrap_180_cd(guided_angle_state.yaw_cd);
float yaw_rate_in = guided_angle_state.yaw_rate_cds;
float climb_rate_cms = 0.0f;
if (!guided_angle_state.use_thrust) {
// constrain climb rate
climb_rate_cms = constrain_float(guided_angle_state.climb_rate_cms, -fabsf(wp_nav-><API key>()), wp_nav-><API key>());
// get avoidance adjusted climb rate
climb_rate_cms = <API key>(climb_rate_cms);
}
// check for timeout - set lean angles and climb rate to zero if no updates received for 3 seconds
uint32_t tnow = millis();
if (tnow - guided_angle_state.update_time_ms > <API key>) {
roll_in = 0.0f;
pitch_in = 0.0f;
climb_rate_cms = 0.0f;
yaw_rate_in = 0.0f;
guided_angle_state.use_thrust = false;
}
// interpret positive climb rate or thrust as triggering take-off
const bool <API key> = is_positive(guided_angle_state.use_thrust ? guided_angle_state.thrust : climb_rate_cms);
if (motors->armed() && <API key>) {
copter.set_auto_armed(true);
}
// if not armed set throttle to zero and exit immediately
if (!motors->armed() || !copter.ap.auto_armed || (copter.ap.land_complete && !<API key>)) {
<API key>();
return;
}
// TODO: use get_alt_hold_state
// landed with positive desired climb rate, takeoff
if (copter.ap.land_complete && (guided_angle_state.climb_rate_cms > 0.0f)) {
<API key>();
motors-><API key>(AP_Motors::DesiredSpoolState::THROTTLE_UNLIMITED);
if (motors->get_spool_state() == AP_Motors::SpoolState::THROTTLE_UNLIMITED) {
set_land_complete(false);
<API key>();
}
return;
}
// set motors to full range
motors-><API key>(AP_Motors::DesiredSpoolState::THROTTLE_UNLIMITED);
// call attitude controller
if (guided_angle_state.use_yaw_rate) {
attitude_control-><API key>(roll_in, pitch_in, yaw_rate_in);
} else {
attitude_control-><API key>(roll_in, pitch_in, yaw_in, true);
}
// call position controller
if (guided_angle_state.use_thrust) {
attitude_control->set_throttle_out(guided_angle_state.thrust, true, copter.g.throttle_filt);
} else {
pos_control-><API key>(climb_rate_cms, G_Dt, false);
pos_control->update_z_controller();
}
}
// helper function to update position controller's desired velocity while respecting acceleration limits
void ModeGuided::<API key>(const Vector3f& vel_des)
{
// get current desired velocity
Vector3f curr_vel_des = pos_control-><API key>();
// get change in desired velocity
Vector3f vel_delta = vel_des - curr_vel_des;
// limit xy change
float vel_delta_xy = safe_sqrt(sq(vel_delta.x)+sq(vel_delta.y));
float vel_delta_xy_max = G_Dt * pos_control->get_max_accel_xy();
float ratio_xy = 1.0f;
if (!is_zero(vel_delta_xy) && (vel_delta_xy > vel_delta_xy_max)) {
ratio_xy = vel_delta_xy_max / vel_delta_xy;
}
curr_vel_des.x += (vel_delta.x * ratio_xy);
curr_vel_des.y += (vel_delta.y * ratio_xy);
// limit z change
float vel_delta_z_max = G_Dt * pos_control->get_max_accel_z();
curr_vel_des.z += constrain_float(vel_delta.z, -vel_delta_z_max, vel_delta_z_max);
#if AC_AVOID_ENABLED
// limit the velocity for obstacle/fence avoidance
copter.avoid.adjust_velocity(curr_vel_des, pos_control->get_pos_xy_p().kP(), pos_control->get_max_accel_xy(), pos_control->get_pos_z_p().kP(), pos_control->get_max_accel_z(), G_Dt);
#endif
// update position controller with new target
pos_control-><API key>(curr_vel_des);
}
// helper function to set yaw state and targets
void ModeGuided::set_yaw_state(bool use_yaw, float yaw_cd, bool use_yaw_rate, float yaw_rate_cds, bool relative_angle)
{
if (use_yaw) {
auto_yaw.set_fixed_yaw(yaw_cd * 0.01f, 0.0f, 0, relative_angle);
} else if (use_yaw_rate) {
auto_yaw.set_rate(yaw_rate_cds);
}
}
// returns true if pilot's yaw input should be used to adjust vehicle's heading
bool ModeGuided::use_pilot_yaw(void) const
{
return (copter.g2.guided_options.get() & uint32_t(Options::IgnorePilotYaw)) == 0;
}
// Guided Limit code
// guided_limit_clear - clear/turn off guided limits
void ModeGuided::limit_clear()
{
guided_limit.timeout_ms = 0;
guided_limit.alt_min_cm = 0.0f;
guided_limit.alt_max_cm = 0.0f;
guided_limit.horiz_max_cm = 0.0f;
}
// guided_limit_set - set guided timeout and movement limits
void ModeGuided::limit_set(uint32_t timeout_ms, float alt_min_cm, float alt_max_cm, float horiz_max_cm)
{
guided_limit.timeout_ms = timeout_ms;
guided_limit.alt_min_cm = alt_min_cm;
guided_limit.alt_max_cm = alt_max_cm;
guided_limit.horiz_max_cm = horiz_max_cm;
}
// <API key> - initialise guided start time and position as reference for limit checking
// only called from AUTO mode's <API key> function
void ModeGuided::<API key>()
{
// initialise start time
guided_limit.start_time = AP_HAL::millis();
// initialise start position from current position
guided_limit.start_pos = inertial_nav.get_position();
}
// guided_limit_check - returns true if guided mode has breached a limit
// used when guided is invoked from the NAV_GUIDED_ENABLE mission command
bool ModeGuided::limit_check()
{
// check if we have passed the timeout
if ((guided_limit.timeout_ms > 0) && (millis() - guided_limit.start_time >= guided_limit.timeout_ms)) {
return true;
}
// get current location
const Vector3f& curr_pos = inertial_nav.get_position();
// check if we have gone below min alt
if (!is_zero(guided_limit.alt_min_cm) && (curr_pos.z < guided_limit.alt_min_cm)) {
return true;
}
// check if we have gone above max alt
if (!is_zero(guided_limit.alt_max_cm) && (curr_pos.z > guided_limit.alt_max_cm)) {
return true;
}
// check if we have gone beyond horizontal limit
if (guided_limit.horiz_max_cm > 0.0f) {
float horiz_move = <API key>(guided_limit.start_pos, curr_pos);
if (horiz_move > guided_limit.horiz_max_cm) {
return true;
}
}
// if we got this far we must be within limits
return false;
}
uint32_t ModeGuided::wp_distance() const
{
switch(mode()) {
case Guided_WP:
return wp_nav-><API key>();
break;
case Guided_PosVel:
return pos_control-><API key>();
break;
default:
return 0;
}
}
int32_t ModeGuided::wp_bearing() const
{
switch(mode()) {
case Guided_WP:
return wp_nav-><API key>();
break;
case Guided_PosVel:
return pos_control-><API key>();
break;
default:
return 0;
}
}
float ModeGuided::crosstrack_error() const
{
if (mode() == Guided_WP) {
return wp_nav->crosstrack_error();
} else {
return 0;
}
}
#endif |
package org.chromium.base;
import android.annotation.TargetApi;
import android.app.Activity;
import android.app.ActivityManager;
import android.app.PendingIntent;
import android.content.ContentResolver;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.res.ColorStateList;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.content.res.Resources.NotFoundException;
import android.graphics.Bitmap;
import android.graphics.Color;
import android.graphics.ColorFilter;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.VectorDrawable;
import android.net.Uri;
import android.os.Build;
import android.os.PowerManager;
import android.os.Process;
import android.os.StatFs;
import android.os.StrictMode;
import android.os.UserManager;
import android.provider.Settings;
import android.text.Html;
import android.text.Spanned;
import android.view.View;
import android.view.ViewGroup.MarginLayoutParams;
import android.view.Window;
import android.view.WindowManager;
import android.view.inputmethod.InputMethodSubtype;
import android.view.textclassifier.TextClassifier;
import android.widget.TextView;
import java.io.File;
import java.io.<API key>;
/**
* Utility class to use new APIs that were added after ICS (API level 14).
*/
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
public class <API key> {
private <API key>() {
}
/**
* Compares two long values numerically. The value returned is identical to what would be
* returned by {@link Long#compare(long, long)} which is available since API level 19.
*/
public static int compareLong(long lhs, long rhs) {
return lhs < rhs ? -1 : (lhs == rhs ? 0 : 1);
}
/**
* Compares two boolean values. The value returned is identical to what would be returned by
* {@link Boolean#compare(boolean, boolean)} which is available since API level 19.
*/
public static int compareBoolean(boolean lhs, boolean rhs) {
return lhs == rhs ? 0 : lhs ? 1 : -1;
}
/**
* {@link String#getBytes()} but specifying UTF-8 as the encoding and capturing the resulting
* <API key>.
*/
public static byte[] getBytesUtf8(String str) {
try {
return str.getBytes("UTF-8");
} catch (<API key> e) {
throw new <API key>("UTF-8 encoding not available.", e);
}
}
/**
* Returns true if view's layout direction is right-to-left.
*
* @param view the View whose layout is being considered
*/
public static boolean isLayoutRtl(View view) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
return view.getLayoutDirection() == View.<API key>;
} else {
// All layouts are LTR before JB MR1.
return false;
}
}
/**
* @see Configuration#getLayoutDirection()
*/
public static int getLayoutDirection(Configuration configuration) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
return configuration.getLayoutDirection();
} else {
// All layouts are LTR before JB MR1.
return View.<API key>;
}
}
/**
* @return True if the running version of the Android supports printing.
*/
public static boolean isPrintingSupported() {
return Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT;
}
/**
* @return True if the running version of the Android supports elevation. Elevation of a view
* determines the visual appearance of its shadow.
*/
public static boolean <API key>() {
return Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP;
}
/**
* @see android.view.View#setLayoutDirection(int)
*/
public static void setLayoutDirection(View view, int layoutDirection) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
view.setLayoutDirection(layoutDirection);
} else {
// Do nothing. RTL layouts aren't supported before JB MR1.
}
}
/**
* @see android.view.View#setTextAlignment(int)
*/
public static void setTextAlignment(View view, int textAlignment) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
view.setTextAlignment(textAlignment);
} else {
// Do nothing. RTL text isn't supported before JB MR1.
}
}
/**
* @see android.view.View#setTextDirection(int)
*/
public static void setTextDirection(View view, int textDirection) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
view.setTextDirection(textDirection);
} else {
// Do nothing. RTL text isn't supported before JB MR1.
}
}
/**
* See {@link android.view.View#setLabelFor(int)}.
*/
public static void setLabelFor(View labelView, int id) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
labelView.setLabelFor(id);
} else {
// Do nothing. #setLabelFor() isn't supported before JB MR1.
}
}
/**
* @see android.view.ViewGroup.MarginLayoutParams#setMarginEnd(int)
*/
public static void setMarginEnd(MarginLayoutParams layoutParams, int end) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
layoutParams.setMarginEnd(end);
} else {
layoutParams.rightMargin = end;
}
}
/**
* @see android.view.ViewGroup.MarginLayoutParams#getMarginEnd()
*/
public static int getMarginEnd(MarginLayoutParams layoutParams) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
return layoutParams.getMarginEnd();
} else {
return layoutParams.rightMargin;
}
}
/**
* @see android.view.ViewGroup.MarginLayoutParams#setMarginStart(int)
*/
public static void setMarginStart(MarginLayoutParams layoutParams, int start) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
layoutParams.setMarginStart(start);
} else {
layoutParams.leftMargin = start;
}
}
/**
* @see android.view.ViewGroup.MarginLayoutParams#getMarginStart()
*/
public static int getMarginStart(MarginLayoutParams layoutParams) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
return layoutParams.getMarginStart();
} else {
return layoutParams.leftMargin;
}
}
/**
* @see android.view.View#setPaddingRelative(int, int, int, int)
*/
public static void setPaddingRelative(View view, int start, int top, int end, int bottom) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
view.setPaddingRelative(start, top, end, bottom);
} else {
// Before JB MR1, all layouts are left-to-right, so start == left, etc.
view.setPadding(start, top, end, bottom);
}
}
/**
* @see android.view.View#getPaddingStart()
*/
public static int getPaddingStart(View view) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
return view.getPaddingStart();
} else {
// Before JB MR1, all layouts are left-to-right, so start == left.
return view.getPaddingLeft();
}
}
/**
* @see android.view.View#getPaddingEnd()
*/
public static int getPaddingEnd(View view) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
return view.getPaddingEnd();
} else {
// Before JB MR1, all layouts are left-to-right, so end == right.
return view.getPaddingRight();
}
}
/**
* @see android.widget.TextView#<API key>(Drawable, Drawable, Drawable,
* Drawable)
*/
public static void <API key>(TextView textView, Drawable start, Drawable top,
Drawable end, Drawable bottom) {
if (Build.VERSION.SDK_INT == Build.VERSION_CODES.JELLY_BEAN_MR1) {
// On JB MR1, due to a platform bug, <API key>() is a no-op if the
// view has ever been measured. As a workaround, use <API key>() directly.
boolean isRtl = isLayoutRtl(textView);
textView.<API key>(isRtl ? end : start, top, isRtl ? start : end, bottom);
} else if (Build.VERSION.SDK_INT > Build.VERSION_CODES.JELLY_BEAN_MR1) {
textView.<API key>(start, top, end, bottom);
} else {
textView.<API key>(start, top, end, bottom);
}
}
/**
* @see android.widget.TextView#<API key>(Drawable,
* Drawable, Drawable, Drawable)
*/
public static void <API key>(TextView textView,
Drawable start, Drawable top, Drawable end, Drawable bottom) {
if (Build.VERSION.SDK_INT == Build.VERSION_CODES.JELLY_BEAN_MR1) {
// Work around the platform bug described in <API key>() above.
boolean isRtl = isLayoutRtl(textView);
textView.<API key>(isRtl ? end : start, top,
isRtl ? start : end, bottom);
} else if (Build.VERSION.SDK_INT > Build.VERSION_CODES.JELLY_BEAN_MR1) {
textView.<API key>(start, top, end, bottom);
} else {
textView.<API key>(start, top, end, bottom);
}
}
/**
* @see android.widget.TextView#<API key>(int, int, int,
* int)
*/
public static void <API key>(TextView textView,
int start, int top, int end, int bottom) {
if (Build.VERSION.SDK_INT == Build.VERSION_CODES.JELLY_BEAN_MR1) {
// Work around the platform bug described in <API key>() above.
boolean isRtl = isLayoutRtl(textView);
textView.<API key>(isRtl ? end : start, top,
isRtl ? start : end, bottom);
} else if (Build.VERSION.SDK_INT > Build.VERSION_CODES.JELLY_BEAN_MR1) {
textView.<API key>(start, top, end, bottom);
} else {
textView.<API key>(start, top, end, bottom);
}
}
/**
* @see android.text.Html#toHtml(Spanned, int)
* @param option is ignored on below N
*/
@SuppressWarnings("deprecation")
public static String toHtml(Spanned spanned, int option) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
return Html.toHtml(spanned, option);
} else {
return Html.toHtml(spanned);
}
}
// These methods have a new name, and the old name is deprecated.
/**
* @see android.app.PendingIntent#getCreatorPackage()
*/
@SuppressWarnings("deprecation")
public static String getCreatorPackage(PendingIntent intent) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
return intent.getCreatorPackage();
} else {
return intent.getTargetPackage();
}
}
/**
* @see android.provider.Settings.Global#DEVICE_PROVISIONED
*/
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
public static boolean isDeviceProvisioned(Context context) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR1) return true;
if (context == null) return true;
if (context.getContentResolver() == null) return true;
return Settings.Global.getInt(
context.getContentResolver(), Settings.Global.DEVICE_PROVISIONED, 0) != 0;
}
/**
* @see android.app.Activity#finishAndRemoveTask()
*/
public static void finishAndRemoveTask(Activity activity) {
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.LOLLIPOP) {
activity.finishAndRemoveTask();
} else if (Build.VERSION.SDK_INT == Build.VERSION_CODES.LOLLIPOP) {
// crbug.com/395772 : Fallback for Activity.finishAndRemoveTask() failing.
new <API key>(activity).run();
} else {
activity.finish();
}
}
/**
* Set elevation if supported.
*/
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
public static boolean setElevation(View view, float elevationValue) {
if (!<API key>()) return false;
view.setElevation(elevationValue);
return true;
}
private static class <API key> implements Runnable {
private static final long RETRY_DELAY_MS = 500;
private static final long MAX_TRY_COUNT = 3;
private final Activity mActivity;
private int mTryCount;
<API key>(Activity activity) {
mActivity = activity;
}
@Override
public void run() {
mActivity.finishAndRemoveTask();
mTryCount++;
if (!mActivity.isFinishing()) {
if (mTryCount < MAX_TRY_COUNT) {
ThreadUtils.<API key>(this, RETRY_DELAY_MS);
} else {
mActivity.finish();
}
}
}
}
/**
* @return Whether the screen of the device is interactive.
*/
@SuppressWarnings("deprecation")
public static boolean isInteractive(Context context) {
PowerManager manager = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT_WATCH) {
return manager.isInteractive();
} else {
return manager.isScreenOn();
}
}
@SuppressWarnings("deprecation")
public static int <API key>() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
return Intent.<API key>;
} else {
return Intent.<API key>;
}
}
/**
* @see android.provider.Settings.Secure#<API key>
*/
public static boolean <API key>(ContentResolver contentResolver) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
return Settings.Secure.getInt(
contentResolver, Settings.Secure.<API key>, 0) != 0;
} else {
return false;
}
}
/**
* @param activity Activity that should get the task description update.
* @param title Title of the activity.
* @param icon Icon of the activity.
* @param color Color of the activity. It must be a fully opaque color.
*/
public static void setTaskDescription(Activity activity, String title, Bitmap icon, int color) {
// TaskDescription requires an opaque color.
assert Color.alpha(color) == 255;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
ActivityManager.TaskDescription description =
new ActivityManager.TaskDescription(title, icon, color);
activity.setTaskDescription(description);
}
}
/**
* @see android.view.Window#setStatusBarColor(int color).
*/
public static void setStatusBarColor(Window window, int statusBarColor) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) return;
// If both system bars are black, we can remove these from our layout,
// removing or shrinking the SurfaceFlinger overlay required for our views.
// This benefits battery usage on L and M. However, this no longer provides a battery
// benefit as of N and starts to cause flicker bugs on O, so don't bother on O and up.
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O && statusBarColor == Color.BLACK
&& window.<API key>() == Color.BLACK) {
window.clearFlags(WindowManager.LayoutParams.<API key>);
} else {
window.addFlags(WindowManager.LayoutParams.<API key>);
}
window.setStatusBarColor(statusBarColor);
}
@SuppressWarnings("deprecation")
public static Drawable getDrawable(Resources res, int id) throws NotFoundException {
StrictMode.ThreadPolicy oldPolicy = StrictMode.<API key>();
try {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
return res.getDrawable(id, null);
} else {
return res.getDrawable(id);
}
} finally {
StrictMode.setThreadPolicy(oldPolicy);
}
}
/**
* @see android.content.res.Resources#<API key>(int id, int density).
*/
@SuppressWarnings("deprecation")
public static Drawable <API key>(Resources res, int id, int density) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
return res.<API key>(id, density, null);
} else {
return res.<API key>(id, density);
}
}
/**
* @see android.app.Activity#<API key>().
*/
public static void <API key>(Activity activity) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
activity.<API key>();
} else {
activity.finish();
}
}
/**
* @see android.content.pm.PackageManager#getUserBadgedIcon(Drawable, android.os.UserHandle).
*/
public static Drawable getUserBadgedIcon(Context context, int id) {
Drawable drawable = getDrawable(context.getResources(), id);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
PackageManager packageManager = context.getPackageManager();
drawable = packageManager.getUserBadgedIcon(drawable, Process.myUserHandle());
}
return drawable;
}
/**
* @see android.content.pm.PackageManager#<API key>(Drawable drawable,
* UserHandle user, Rect badgeLocation, int badgeDensity).
*/
public static Drawable <API key>(
Context context, Drawable drawable, Rect badgeLocation, int density) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
PackageManager packageManager = context.getPackageManager();
return packageManager.<API key>(
drawable, Process.myUserHandle(), badgeLocation, density);
}
return drawable;
}
/**
* @see android.content.res.Resources#getColor(int id).
*/
@SuppressWarnings("deprecation")
public static int getColor(Resources res, int id) throws NotFoundException {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
return res.getColor(id, null);
} else {
return res.getColor(id);
}
}
/**
* @see android.graphics.drawable.Drawable#getColorFilter().
*/
@SuppressWarnings("NewApi")
public static ColorFilter getColorFilter(Drawable drawable) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
return drawable.getColorFilter();
} else {
return null;
}
}
/**
* @see android.content.res.Resources#getColorStateList(int id).
*/
@SuppressWarnings("deprecation")
public static ColorStateList getColorStateList(Resources res, int id) throws NotFoundException {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
return res.getColorStateList(id, null);
} else {
return res.getColorStateList(id);
}
}
/**
* @see android.widget.TextView#setTextAppearance(int id).
*/
@SuppressWarnings("deprecation")
public static void setTextAppearance(TextView view, int id) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
view.setTextAppearance(id);
} else {
view.setTextAppearance(view.getContext(), id);
}
}
/**
* See {@link android.os.StatFs#<API key>}.
*/
@SuppressWarnings("deprecation")
public static long getAvailableBlocks(StatFs statFs) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
return statFs.<API key>();
} else {
return statFs.getAvailableBlocks();
}
}
/**
* See {@link android.os.StatFs#getBlockCount}.
*/
@SuppressWarnings("deprecation")
public static long getBlockCount(StatFs statFs) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
return statFs.getBlockCountLong();
} else {
return statFs.getBlockCount();
}
}
/**
* See {@link android.os.StatFs#getBlockSize}.
*/
@SuppressWarnings("deprecation")
public static long getBlockSize(StatFs statFs) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
return statFs.getBlockSizeLong();
} else {
return statFs.getBlockSize();
}
}
/**
* @param context The Android context, used to retrieve the UserManager system service.
* @return Whether the device is running in demo mode.
*/
@SuppressWarnings("NewApi")
public static boolean isDemoUser(Context context) {
// UserManager#isDemoUser() is only available in Android NMR1+.
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N_MR1) return false;
UserManager userManager = (UserManager) context.getSystemService(Context.USER_SERVICE);
return userManager.isDemoUser();
}
public static int checkPermission(Context context, String permission, int pid, int uid) {
try {
return context.checkPermission(permission, pid, uid);
} catch (RuntimeException e) {
// crbug.com/639099
return PackageManager.PERMISSION_DENIED;
}
}
/**
* @see android.view.inputmethod.InputMethodSubType#getLocate()
*/
@SuppressWarnings("deprecation")
public static String getLocale(InputMethodSubtype inputMethodSubType) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
return inputMethodSubType.getLanguageTag();
} else {
return inputMethodSubType.getLocale();
}
}
/**
* Get a URI for |file| which has the image capture. This function assumes that path of |file|
* is based on the result of UiUtils.<API key>().
*
* @param file image capture file.
* @return URI for |file|.
*/
public static Uri <API key>(File file) {
return Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2
? ContentUriUtils.<API key>(file)
: Uri.fromFile(file);
}
/**
* Get the URI for a downloaded file.
*
* @param file A downloaded file.
* @return URI for |file|.
*/
public static Uri <API key>(File file) {
return Build.VERSION.SDK_INT > Build.VERSION_CODES.M
? FileUtils.getUriForFile(file)
: Uri.fromFile(file);
}
/**
* @see android.view.Window#<API key>
*/
public static void <API key>(Window window) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
@SuppressWarnings("deprecation")
int featureNumber = Window.<API key>;
@SuppressWarnings("deprecation")
int featureValue = Window.<API key>;
window.setFeatureInt(featureNumber, featureValue);
}
}
/**
* @param activity The {@link Activity} to check.
* @return Whether or not {@code activity} is currently in Android N+ multi-window mode.
*/
public static boolean isInMultiWindowMode(Activity activity) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) {
return false;
}
return activity.isInMultiWindowMode();
}
/**
* Disables the Smart Select {@link TextClassifier} for the given {@link TextView} instance.
* @param textView The {@link TextView} that should have its classifier disabled.
*/
@TargetApi(Build.VERSION_CODES.O)
public static void <API key>(TextView textView) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) return;
textView.setTextClassifier(TextClassifier.NO_OP);
}
} |
#ifndef _MSVC_NOTHROW_H
#define _MSVC_NOTHROW_H
/* With MSVC runtime libraries with the "invalid parameter handler" concept,
functions like fprintf(), dup2(), or close() crash when the caller passes
an invalid argument. But POSIX wants error codes (such as EINVAL or EBADF)
instead.
This file defines wrappers that turn such an invalid parameter notification
into an error code. */
#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
/* Get original declaration of _get_osfhandle. */
# include <io.h>
# if <API key>
/* Override _get_osfhandle. */
extern intptr_t <API key> (int fd);
# define _get_osfhandle <API key>
# endif
#endif
#endif /* _MSVC_NOTHROW_H */ |
#include <vector>
#include <cstdio>
#include <cstdlib>
#include <string>
#include <ctime>
#include <cmath>
#include<iostream>
#include <vector>
#include <array>
//Parameters
int cloudlen=3000;
int kmean=30;
int iterations=200;
struct kcluster{
std::array<float, 3> position;
std::array<float, 3> meanpoint;
int hitcount;
float stdev;
} ;
void sqDistance(std::array<float, 3> p1 , std::array<float, 3> p2, float& distance ){
distance= pow(p1[0]-p2[0],2)+pow(p1[1]-p2[1],2)+pow(p1[2]-p2[2],2);
}
void populateCloud (std::vector<std::array<float, 3> >&cloud1 ,std::vector<std::array<float, 3> >&cloud2, int cloudlen){
for(int i=0 ; i< cloudlen ; i++){
for(int j =0; j< 3 ; j++){
cloud2[i][j]=20*(rand() / (float)RAND_MAX)+1;
cloud1[i][j]=20*(rand() / (float)RAND_MAX);
}
}
}
void printPoints(std::vector< std::array<float, 3> >cloud1 ,std::vector< std::array<float, 3> >cloud2 ,int cloudlen){
for(int i=0 ; i< cloudlen ; i++){
std::cout <<i<<'\t'<< cloud2[i][0] <<'\t'
<<cloud2[i][1] <<'\t'<<cloud2[i][2] <<'\n';
}
}
void kmeansort(std::vector< std::array<float, 3> >& cloud1 ,
int kmean,
int cloudlen,
std::vector<std::vector<std::array<float, 3> > >& sorteddata){
std::vector<kcluster> clustervect;
clustervect.reserve(kmean*sizeof(kcluster));
//Asign random values to start the iteration
for(int i=0 ; i<kmean ; i++){
clustervect[i].position[0]=20*(rand() / (float)RAND_MAX);
clustervect[i].position[1]=20*(rand() / (float)RAND_MAX);
clustervect[i].position[2]=20*(rand() / (float)RAND_MAX);
}
//While the k-mean is not sufficcient we keep iterating
bool conformitycondition=true;
int repetition=0;
while(repetition<iterations){
repetition++;
//In every point check distance to closest cluster
for(int j=0 ; j< cloudlen ;j++){
float distance;
float bestdistance;
sqDistance(clustervect[0].position , cloud1[j], distance);
bestdistance=distance;
int bestcluster=0;
for(int m=0 ; m< kmean ; m++){
sqDistance(clustervect[m].position , cloud1[j],distance);
if(distance<bestdistance){
bestcluster=m;
bestdistance=distance;
}
}
if (repetition==(iterations-1)){
//If this is the last iteration, print it to the user so it can be stored
std::cout <<j<<'\t'<< cloud1[j][0] <<'\t'
<<cloud1[j][1] <<'\t'<<cloud1[j][2]
<<'\t'<<bestcluster<<'\n';
sorteddata[bestcluster].push_back(cloud1[j]);
}
//Asign the point to the closest cluster
clustervect[bestcluster].meanpoint[0]+=cloud1[j][0];
clustervect[bestcluster].meanpoint[1]+=cloud1[j][1];
clustervect[bestcluster].meanpoint[2]+=cloud1[j][2];
clustervect[bestcluster].hitcount++;
}
//The position is now the mean and the other parameters are restored
for(int m=0 ; m< kmean ;m++){
if (clustervect[m].hitcount==0){
//If no hit, then assign random value again
clustervect[m].position[0]=20*(rand() / (float)RAND_MAX);
clustervect[m].position[1]=20*(rand() / (float)RAND_MAX);
clustervect[m].position[2]=20*(rand() / (float)RAND_MAX);
}
//Doing the mean of the meanpoint which contains the sum of all the hit coordinates
clustervect[m].position[0]=clustervect[m].meanpoint[0]/(clustervect[m].hitcount);
clustervect[m].position[1]=clustervect[m].meanpoint[1]/(clustervect[m].hitcount);
clustervect[m].position[2]=clustervect[m].meanpoint[2]/(clustervect[m].hitcount);
//Restoring hit and meanpoint
clustervect[m].meanpoint[0]=0;
clustervect[m].meanpoint[1]=0;
clustervect[m].meanpoint[2]=0;
clustervect[m].hitcount=0;
}
}
}
int main(void){
//Declaring the dataset
std::vector<std::array<float, 3> >cloud1;
std::vector<std::array<float, 3> >cloud2;
cloud1.reserve(sizeof(std::array<float, 3>)*cloudlen);
cloud2.reserve(sizeof(std::array<float, 3>)*cloudlen);
std::vector<std::vector<std::array<float, 3> > > sorteddata(kmean);
//populating the datasets
populateCloud(cloud1 , cloud2 , cloudlen );
kmeansort(cloud1 , kmean, cloudlen , sorteddata );
} |
// ubuntu-device-flash - Tool to download and flash devices with an Ubuntu Image
// based system
// Written by Sergio Schvezov <sergio.schvezov@canonical.com>
package main
import (
"errors"
"fmt"
"io"
"io/ioutil"
"os"
"path/filepath"
"strings"
"time"
)
// This program is free software: you can redistribute it and/or modify it
// by the Free Software Foundation.
// This program is distributed in the hope that it will be useful, but
// MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
func init() {
parser.AddCommand("core",
"Creates ubuntu core images",
"",
&coreCmd)
}
type CoreCmd struct {
EnableSsh bool `long:"enable-ssh" description:"Enable ssh on the image through cloud-init(not needed with developer mode)"`
Size int64 `long:"size" short:"s" description:"Size of image file to create in GB (min 4)" default:"4"`
Deprecated struct {
Cloud bool `long:"cloud" description:"Generate a pure cloud image without setting up cloud-init"`
Device string `long:"device" description:"Specify the device to use"`
} `group:"Deprecated"`
Snapper
}
var coreCmd CoreCmd
const cloudInitMetaData = `instance-id: nocloud-static
`
const cloudInitUserData = `#cloud-config
password: ubuntu
chpasswd: { expire: False }
ssh_pwauth: True
ssh_genkeytypes: ['rsa', 'dsa', 'ecdsa', 'ed25519']
`
func (coreCmd *CoreCmd) Execute(args []string) error {
coreCmd.flavor = flavorCore
coreCmd.size = coreCmd.Size
if coreCmd.EnableSsh && coreCmd.Deprecated.Cloud {
return errors.New("--cloud and --enable-ssh cannot be used together")
}
if coreCmd.Deprecated.Device != "" {
fmt.Println("WARNING: this option should only be used to build azure images")
coreCmd.device = coreCmd.Deprecated.Device
}
if !coreCmd.Deprecated.Cloud {
coreCmd.customizationFunc = append(coreCmd.customizationFunc, coreCmd.setupCloudInit)
coreCmd.customizationFunc = append(coreCmd.customizationFunc, coreCmd.setupOemConfigs)
}
return coreCmd.create()
}
// this is a hackish way to get the config in place
func (coreCmd *CoreCmd) setupOemConfigs() error {
modprobeDContent := coreCmd.oem.Config.UbuntuCore.Modprobe
if modprobeDContent == nil {
printOut("no modprobe")
return nil
}
fmt.Println("Setting up oem hooks...")
writablePath := coreCmd.img.Writable()
modprobeDir := filepath.Join(writablePath, "system-data", "etc", "modprobe.d")
if err := os.MkdirAll(modprobeDir, 0755); err != nil {
return err
}
// first we need to copy all the files in modprobe.d
/*
systemModprobeDir := filepath.Join(coreCmd.img.System(), "etc", "modprobe.d")
if err := helpers.RSyncWithDelete(systemModprobeDir, modprobeDir); err != nil {
return err
}
*/
modprobeD := filepath.Join(modprobeDir, "ubuntu-core.conf")
modprobeDFile, err := os.Create(modprobeD)
if err != nil {
return err
}
defer modprobeDFile.Close()
if _, err := io.WriteString(modprobeDFile, *modprobeDContent); err != nil {
return err
}
return nil
}
// this function is a hack and should be part of first boot.
func (coreCmd *CoreCmd) setupCloudInit() error {
systemPath := coreCmd.img.System()
writablePath := coreCmd.img.Writable()
cloudBaseDir := filepath.Join("var", "lib", "cloud")
if err := os.MkdirAll(filepath.Join(systemPath, cloudBaseDir), 0755); err != nil {
return err
}
// create a basic cloud-init seed
cloudDir := filepath.Join(writablePath, "system-data", cloudBaseDir, "seed", "nocloud-net")
if err := os.MkdirAll(cloudDir, 0755); err != nil {
return err
}
metaDataFile, err := os.Create(filepath.Join(cloudDir, "meta-data"))
if err != nil {
return err
}
defer metaDataFile.Close()
if _, err := io.WriteString(metaDataFile, cloudInitMetaData); err != nil {
return err
}
if coreCmd.Development.DeveloperMode {
fmt.Println("Enabling developer mode...")
authorizedKey, err := getAuthorizedSshKey()
if err != nil {
return fmt.Errorf("failed to obtain a public key for developer mode: %s", err)
}
if _, err := io.WriteString(metaDataFile, "public-keys:\n"); err != nil {
return err
}
if _, err := io.WriteString(metaDataFile, fmt.Sprintf(" - %s\n", authorizedKey)); err != nil {
return err
}
}
userDataFile, err := os.Create(filepath.Join(cloudDir, "user-data"))
if err != nil {
return err
}
defer userDataFile.Close()
if _, err := io.WriteString(userDataFile, cloudInitUserData); err != nil {
return err
}
if coreCmd.Development.DeveloperMode || coreCmd.EnableSsh {
if _, err := io.WriteString(userDataFile, "snappy:\n ssh_enabled: True\n"); err != nil {
return err
}
}
return nil
}
func getAuthorizedSshKey() (string, error) {
sshDir := os.ExpandEnv("$HOME/.ssh")
fis, err := ioutil.ReadDir(sshDir)
if err != nil {
return "", fmt.Errorf("%s: no pub ssh key found, run ssh-keygen first", err)
}
var preferredPubKey string
var latestModTime time.Time
for i := range fis {
file := fis[i].Name()
if strings.HasSuffix(file, ".pub") && !strings.HasSuffix(file, "cert.pub") {
fileMod := fis[i].ModTime()
if fileMod.After(latestModTime) {
latestModTime = fileMod
preferredPubKey = file
}
}
}
if preferredPubKey == "" {
return "", errors.New("no pub ssh key found, run ssh-keygen first")
}
pubKey, err := ioutil.ReadFile(filepath.Join(sshDir, preferredPubKey))
return string(pubKey), err
} |
package psoup.virtualmachine;
import physis.core.virtualmachine.VirtualMachine;
import physis.core.virtualmachine.<API key>;
import physis.core.virtualmachine.GeneticCodeTape;
import physis.core.virtualmachine.InstructionSet;
import physis.core.PHYSIS;
import physis.core.event.ProliferationEvent;
import physis.core.genotype.Genome;
import physis.log.Log;
public class PrimordialSoupVM extends <API key>{
/** Size of the internal stack. (hardcoded 16, because it's the attribute of the architecture */
public static final int STACK_SIZE = 16;
/** Reference for instruction set in order to access it quickly. */
private static InstructionSet instruction_set = InstructionSet.getInstance();
//opcodes
protected final short JUMP = 0;
protected final short SPWN = 1;
protected final short PCR1 = 2;
protected final short PCR2 = 3;
protected final short PCR3 = 4;
protected final short PCR4 = 5;
protected final short R2R1 = 6;
protected final short R3R1 = 7;
protected final short R4R1 = 8;
protected final short R1R2 = 9;
protected final short R1R3 = 10;
protected final short R1R4 = 11;
protected final short ADD1 = 12;
protected final short ADD2 = 13;
protected final short ADD3 = 14;
protected final short ADD4 = 15;
protected final short SUB1 = 16;
protected final short SUB2 = 17;
protected final short SUB3 = 18;
protected final short SUB4 = 19;
protected final short R2M1 = 20;
protected final short R3M1 = 21;
protected final short R4M1 = 22;
protected final short R1M2 = 23;
protected final short R3M2 = 24;
protected final short R4M2 = 25;
protected final short M1R2 = 26;
protected final short M1R3 = 27;
protected final short M1R4 = 28;
protected final short M2R1 = 29;
protected final short M2R3 = 30;
protected final short M2R4 = 31;
protected final short JPZ1 = 32;
protected final short JPZ2 = 33;
protected final short JPZ3 = 34;
protected final short JPZ4 = 35;
protected final short NNR1 = 36;
protected final short NNR2 = 37;
protected final short NNR3 = 38;
protected final short NNR4 = 39;
protected final short INC1 = 40;
protected final short INC2 = 41;
protected final short INC3 = 42;
protected final short INC4 = 43;
protected final short DEC1 = 44;
protected final short DEC2 = 45;
protected final short DEC3 = 46;
protected final short DEC4 = 47;
protected final short JMPF = 48;
protected final short JMPB = 49;
protected final short PSHP = 50;
protected final short PSH1 = 51;
protected final short PSH2 = 52;
protected final short PSH3 = 53;
protected final short PSH4 = 54;
protected final short POP1 = 55;
protected final short POP2 = 56;
protected final short POP3 = 57;
protected final short POP4 = 58;
protected final short CLLF = 59;
protected final short CLLB = 60;
protected final short RETN = 61;
protected final short SCF1 = 62;
protected final short SCF2 = 63;
protected final short SCF3 = 64;
protected final short SCF4 = 65;
protected final short SCB1 = 66;
protected final short SCB2 = 67;
protected final short SCB3 = 68;
protected final short SCB4 = 69;
/* All opcodes below are no-ops */
protected final short LBL0 = 70;
protected final short LBL1 = 71;
protected final short LBL2 = 72;
protected final short LBL3 = 73;
protected final short LBL4 = 74;
protected final short LBL5 = 75;
protected final short LBL6 = 76;
protected final short LBL7 = 77;
protected final short LBL8 = 78;
protected final short LBL9 = 79;
protected final short NOOP = 80;
//the structure of the VM
//registers
protected int R1;
protected int R2;
protected int R3;
protected int R4;
//internal stack
protected int[] stack = new int[STACK_SIZE];
//stack_pointer
protected int SP = 0;
/** instruction pointer */
protected int IP;
public PrimordialSoupVM(){
}
public void reset(){
restart();
gestation_time = <API key>;
}
public void restart(){
R1 = 0;
R2 = 0;
R3 = 0;
R4 = 0;
SP = 0;
setIP(0);
counter = 0;
}
public void execute(){
try{
//calls the method corresponding the instructioncode
switch ( tape.read(IP) ){
case JUMP:{ //unconditional jump, IP relative jump specified the operand
adjustIP(1);
adjustIP(tape.read(IP));
}
break;
case SPWN :{ //spawning: source in R1, destination in R2, length in R3
if (tape.<API key>(R3) && (R1 != R2)){
tape.allocate(R3);
tape.blockCopy(R1,R2,R3);
gestation_time = counter + R3;
PHYSIS.environment.<API key>(new ProliferationEvent(tape.divide(), bearer));
}
else{
tape.clearExecutedFlag(IP);
adjustIP(1);
}
}
break;
case PCR1:{ //PC (IP) -> R1
R1 = IP;
adjustIP(1);
}
break;
case PCR2:{
R2 = IP;
adjustIP(1);
}
break;
case PCR3:{
R3 = IP;
adjustIP(1);
}
break;
case PCR4:{
R4 = IP;
adjustIP(1);
}
break;
case R2R1:{ //R2 -> R1
R1 = R2;
adjustIP(1);
}
break;
case R3R1:{
R1 = R3;
adjustIP(1);
}
break;
case R4R1:{
R1 = R4;
adjustIP(1);
}
break;
case R1R2:{
R2 = R1;
adjustIP(1);
}
break;
case R1R3:{
R3 = R1;
adjustIP(1);
}
break;
case R1R4:{
R4 = R1;
adjustIP(1);
}
break;
case ADD1:{ //The result is always in R1.
R1 = R1 + R1;
adjustIP(1);
}
break;
case ADD2:{
R1 = R1 + R2;
adjustIP(1);
}
break;
case ADD3:{
R1 = R1 + R3;
adjustIP(1);
}
break;
case ADD4:{
R1 = R1 + R4;
adjustIP(1);
}
break;
case SUB1:{
R1 = R1 - R1;
adjustIP(1);
}
break;
case SUB2:{
R1 = R1 - R2;
adjustIP(1);
}
break;
case SUB3:{
R1 = R1 - R3;
adjustIP(1);
}
break;
case SUB4:{
R1 = R1 - R4;
adjustIP(1);
}
break;
case R2M1:{ //R2 -> memory specified by R1
tape.write(R1,(short) R2);
adjustIP(1);
}
break;
case R3M1:{
tape.write(R1,(short) R3);
adjustIP(1);
}
break;
case R4M1:{
tape.write(R1,(short) R4);
adjustIP(1);
}
break;
case R1M2:{
tape.write(R2,(short) R1 );
adjustIP(1);
}
break;
case R3M2:{
tape.write(R2,(short) R3);
adjustIP(1);
}
break;
case R4M2:{
tape.write(R2,(short) R4);
adjustIP(1);
}
break;
case M1R2:{ //memory specified by R1 -> R2
R2 = tape.fetchInst(R1);
adjustIP(1);
}
break;
case M1R3:{
R3 = tape.fetchInst(R1);
adjustIP(1);
}
break;
case M1R4:{
R4 = tape.fetchInst(R1);
adjustIP(1);
}
break;
case M2R1:{
R1 = tape.fetchInst(R2);
adjustIP(1);
}
break;
case M2R3:{
R3 = tape.fetchInst(R2);
adjustIP(1);
}
break;
case M2R4:{
R4 = tape.fetchInst(R2);
adjustIP(1);
}
break;
case JPZ1:{
adjustIP(1);
if (R1 == 0) {
adjustIP(tape.read(IP));
}
else{
adjustIP(1);
}
}
break;
case JPZ2:{
adjustIP(1);
if (R2 == 0) {
adjustIP(tape.read(IP));
}
else{
adjustIP(1);
}
}
break;
case JPZ3:{
adjustIP(1);
if (R3 == 0) {
adjustIP(tape.read(IP));
}
else{
adjustIP(1);
}
}
break;
case JPZ4:{
adjustIP(1);
if (R4 == 0) {
adjustIP(tape.read(IP));
}
else{
adjustIP(1);
}
}
break;
case NNR1:{ //operand's value -> R1
adjustIP(1);
R1 = tape.read(IP);
adjustIP(1);
}
break;
case NNR2:{
adjustIP(1);
R2 = tape.read(IP);
adjustIP(1);
}
break;
case NNR3:{
adjustIP(1);
R3 = tape.read(IP);
adjustIP(1);
}
break;
case NNR4:{
adjustIP(1);
R4 = tape.read(IP);
adjustIP(1);
}
break;
case INC1:{
R1++;
adjustIP(1);
}
break;
case INC2:{
R2++;
adjustIP(1);
}
break;
case INC3:{
R3++;
adjustIP(1);
}
break;
case INC4:{
R4++;
adjustIP(1);
}
break;
case DEC1:{
R1
adjustIP(1);
}
break;
case DEC2:{
R2
adjustIP(1);
}
break;
case DEC3:{
R3
adjustIP(1);
}
break;
case DEC4:{
R4
adjustIP(1);
}
break;
case JMPF:{
int jmpf_pos = IP; //store the pos. of the JMPF instruction
adjustIP(1); //step to the operand
short op = tape.read(IP);
if (tape.contains(op)){
do{ //searching for the operand
adjustIP(1);
}while (tape.fetchInst(IP) != op);
}else{ //otherwise clear the flag for JMPF
tape.clearExecutedFlag(jmpf_pos);
tape.clearExecutedFlag(IP);
adjustIP(1);
}
}
break;
case JMPB:{
int jmpb_pos = IP; //store the pos. of the JMPB instrutapeion
adjustIP(1); //step to the operand
short op = tape.read(IP);
if (tape.contains(op)){
adjustIP(-1);
do{ //searching for the operand
adjustIP(-1);
}while (tape.fetchInst(IP) != op);
}else{ //otherwise clear the flag for JMPB
tape.clearExecutedFlag(jmpb_pos);
tape.clearExecutedFlag(IP);
adjustIP(1);
}
}
break;
case PSHP:{
if (!isFull()){
push(IP);
}
else{
tape.clearExecutedFlag(IP);
}
adjustIP(1);
}
break;
case PSH1:{
if (!isFull()){
push(R1);
}
else{
tape.clearExecutedFlag(IP);
}
adjustIP(1);
}
break;
case PSH2:{
if (!isFull()){
push(R2);
}
else{
tape.clearExecutedFlag(IP);
}
adjustIP(1);
}
break;
case PSH3:{
if (!isFull()){
push(R3);
}
else{
tape.clearExecutedFlag(IP);
}
adjustIP(1);
}
break;
case PSH4:{
if (!isFull()){
push(R4);
}
else{
tape.clearExecutedFlag(IP);
}
adjustIP(1);
}
break;
case POP1:{
if (!isEmpty()){
R1 = pop();
}
else{
tape.clearExecutedFlag(IP);
}
adjustIP(1);
}
break;
case POP2:{
if (!isEmpty()){
R2 = pop();
}
else{
tape.clearExecutedFlag(IP);
}
adjustIP(1);
}
break;
case POP3:{
if (!isEmpty()){
R3 = pop();
}
else{
tape.clearExecutedFlag(IP);
}
adjustIP(1);
}
break;
case POP4:{
if (!isEmpty()){
R4 = pop();
}
else{
tape.clearExecutedFlag(IP);
}
adjustIP(1);
}
break;
case CLLF:{
if (!isFull()){
int ret_addr = (IP + 2) % tape.getSize();
int jmpf_pos = IP; //store the pos. of the JMPF instrutapeion
adjustIP(1); //step to the operand
short op = tape.read(IP);
if (tape.contains(op)){
do{ //searching for the operand
adjustIP(1);
}while (tape.fetchInst(IP) != op);
push(ret_addr);
}else{ //otherwise clear the flag for JMPF
tape.clearExecutedFlag(jmpf_pos);
adjustIP(1);
}
}
else{ //otherwise clear the flag for JMPF
tape.clearExecutedFlag(IP);
adjustIP(2);
}
}
break;
case CLLB:{
if (!isFull()){
int ret_addr = (IP + 2) % tape.getSize();
int jmpb_pos = IP; //store the pos. of the JMPF instrutapeion
adjustIP(1); //step to the operand
short op = tape.read(IP);
if (tape.contains(op)){
adjustIP(-1);
do{ //searching for the operand
adjustIP(-1);
}while (tape.fetchInst(IP) != op);
push(ret_addr);
}else{ //otherwise clear the flag for JMPF
tape.clearExecutedFlag(jmpb_pos);
adjustIP(1);
}
}
else{ //otherwise clear the flag for JMPF
tape.clearExecutedFlag(IP);
adjustIP(2);
}
}
break;
case RETN:{
if (!isEmpty()){
IP = pop();
}
else{
tape.clearExecutedFlag(IP);
adjustIP(1);
}
}
break;
case SCF1:{
int scf_pos = IP;
adjustIP(1);
short op = tape.read(IP);
if (tape.contains(op)){
int pos = IP + 1 % tape.getSize();
do {
pos = (pos + 1) % tape.getSize();
} while (tape.fetchInst(pos) != op);
R1 = pos;
}
else{
tape.clearExecutedFlag(scf_pos);
tape.clearExecutedFlag(IP);
}
adjustIP(1);
}
break;
case SCF2:{
int scf_pos = IP;
adjustIP(1);
short op = tape.read(IP);
if (tape.contains(op)){
int pos = IP + 1 % tape.getSize();
do {
pos = (pos + 1) % tape.getSize();
} while (tape.fetchInst(pos) != op);
R2 = pos;
}
else{
tape.clearExecutedFlag(scf_pos);
tape.clearExecutedFlag(IP);
}
adjustIP(1);
}
break;
case SCF3:{
int scf_pos = IP;
adjustIP(1);
short op = tape.read(IP);
if (tape.contains(op)){
int pos = IP + 1 % tape.getSize();
do {
pos = (pos + 1) % tape.getSize();
} while (tape.fetchInst(pos) != op);
R3 = pos;
}
else{
tape.clearExecutedFlag(scf_pos);
tape.clearExecutedFlag(IP);
}
adjustIP(1);
}
break;
case SCF4:{
int scf_pos = IP;
adjustIP(1);
short op = tape.read(IP);
if (tape.contains(op)){
int pos = IP + 1 % tape.getSize();
do {
pos = (pos + 1) % tape.getSize();
} while (tape.fetchInst(pos) != op);
R4 = pos;
}
else{
tape.clearExecutedFlag(scf_pos);
tape.clearExecutedFlag(IP);
}
adjustIP(1);
}
break;
case SCB1:{
int scf_pos = IP;
adjustIP(1);
short op = tape.read(IP);
if (tape.contains(op)){
int pos = IP - 1;
if (pos < 0){ pos = tape.getSize() - 1;}
do {
pos
if (pos < 0){ pos = tape.getSize() - 1;}
} while (tape.fetchInst(pos) != op);
R1 = pos;
}
else{
tape.clearExecutedFlag(scf_pos);
tape.clearExecutedFlag(IP);
}
adjustIP(1);
}
break;
case SCB2:{
int scf_pos = IP;
adjustIP(1);
short op = tape.read(IP);
if (tape.contains(op)){
int pos = IP - 1;
if (pos < 0){ pos = tape.getSize() - 1;}
do {
pos
if (pos < 0){ pos = tape.getSize() - 1;}
} while (tape.fetchInst(pos) != op);
R2 = pos;
}
else{
tape.clearExecutedFlag(scf_pos);
tape.clearExecutedFlag(IP);
}
adjustIP(1);
}
break;
case SCB3:{
int scf_pos = IP;
adjustIP(1);
short op = tape.read(IP);
if (tape.contains(op)){
int pos = IP - 1;
if (pos < 0){ pos = tape.getSize() - 1;}
do {
pos
if (pos < 0){ pos = tape.getSize() - 1;}
} while (tape.fetchInst(pos) != op);
R3 = pos;
}
else{
tape.clearExecutedFlag(scf_pos);
tape.clearExecutedFlag(IP);
}
adjustIP(1);
}
break;
case SCB4:{
int scf_pos = IP;
adjustIP(1);
short op = tape.read(IP);
if (tape.contains(op)){
int pos = IP - 1;
if (pos < 0){ pos = tape.getSize() - 1;}
do {
pos
if (pos < 0){ pos = tape.getSize() - 1;}
} while (tape.fetchInst(pos) != op);
R4 = pos;
}
else{
tape.clearExecutedFlag(scf_pos);
tape.clearExecutedFlag(IP);
}
adjustIP(1);
}
break;
case LBL0:
case LBL1:
case LBL2:
case LBL3:
case LBL4:
case LBL5:
case LBL6:
case LBL7:
case LBL8:
case LBL9:{
adjustIP(1);
}
break;
case NOOP:{
tape.clearExecutedFlag(IP);
adjustIP(1);
}
break;
}
counter++;
}catch (Exception e) {
Log.error("Error in PrimordialSoupVM's main cycle: " + e.getMessage());
e.printStackTrace();
System.exit(-1);
}
}
public void execute(int n) {
for (int i = 0; i < n; i++){
execute();
}
}
/**
* The instruction pointer-register is incremented.
* The codetape is circular.
* @param value the amount of incrementation
*/
void adjustIP(int value){
while (value < 0){
value = value + tape.getSize();
}
IP = (IP + value) % tape.getSize();
}
/**
* Just sets directly the IP.
*/
void setIP(int value) {
while (value < 0){
value = value + tape.getSize();
}
IP = value % tape.getSize();
}
protected void push(int val){
stack[SP] = val;
SP++;
}
protected int pop(){
return stack[--SP];
}
protected boolean isFull(){ return SP == STACK_SIZE; }
protected boolean isEmpty() { return SP == 0;}
public Genome getGenome(){ return tape.getGenome(); }
public int getGenomeSize() { return tape.getSize(); }
public int getEffectiveLength() { return tape.<API key>(); }
public String getState(){
StringBuilder sb = new StringBuilder();
sb.append("IP: " + IP + " R1: " + R1 + " R2: " + R2 + " R3: " + R3 + " R4: " + R4);
if (!isEmpty()){
sb.append(" STACK [");
for (int i = 0; i < SP; i++){
sb.append(stack[i] + ",");
}
sb.append("\b]");
}
else{
sb.append(" stack is empty");
}
sb.append("\n\nINST: " + InstructionSet.getInstance().<API key>(tape.read(IP))) ;
return sb.toString();
}
public String <API key>(){
return "";
}
} |
// File: pep.cpp
#include <QFile>
#include <QTextStream>
#include "pep.h"
using namespace Enu;
// Fonts
const QString Pep::codeFont = getSystem() == "Windows" ? "Courier New" : (getSystem() == "Mac" ? "Courier" : "Courier 8");
const int Pep::codeFontSize = getSystem() == "Mac" ? 12 : 9;
const int Pep::ioFontSize = getSystem() == "Mac" ? 13 : 10;
const QString Pep::labelFont = getSystem() == "Mac" ? "Lucida Grande" : "Verdana";
const int Pep::labelFontSize = getSystem() == "Mac" ? 13 : 10;
// Default redefine mnemonics
const QString Pep::<API key> = "NOP0";
const QString Pep::<API key> = "NOP1";
const QString Pep::<API key> = "NOP2";
const QString Pep::<API key> = "NOP3";
const QString Pep::<API key> = "NOP";
const bool Pep::defaultMnemon0i = true;
const bool Pep::defaultMnemon0d = false;
const bool Pep::defaultMnemon0n = false;
const bool Pep::defaultMnemon0s = false;
const bool Pep::defaultMnemon0sf = false;
const bool Pep::defaultMnemon0x = false;
const bool Pep::defaultMnemon0sx = false;
const bool Pep::defaultMnemon0sxf = false;
const QString Pep::<API key> = "DECI";
const bool Pep::defaultMnemon1i = false;
const bool Pep::defaultMnemon1d = true;
const bool Pep::defaultMnemon1n = true;
const bool Pep::defaultMnemon1s = true;
const bool Pep::defaultMnemon1sf = true;
const bool Pep::defaultMnemon1x = true;
const bool Pep::defaultMnemon1sx = true;
const bool Pep::defaultMnemon1sxf = true;
const QString Pep::<API key> = "DECO";
const bool Pep::defaultMnemon2i = true;
const bool Pep::defaultMnemon2d = true;
const bool Pep::defaultMnemon2n = true;
const bool Pep::defaultMnemon2s = true;
const bool Pep::defaultMnemon2sf = true;
const bool Pep::defaultMnemon2x = true;
const bool Pep::defaultMnemon2sx = true;
const bool Pep::defaultMnemon2sxf = true;
const QString Pep::<API key> = "STRO";
const bool Pep::defaultMnemon3i = false;
const bool Pep::defaultMnemon3d = true;
const bool Pep::defaultMnemon3n = true;
const bool Pep::defaultMnemon3s = false;
const bool Pep::defaultMnemon3sf = true;
const bool Pep::defaultMnemon3x = false;
const bool Pep::defaultMnemon3sx = false;
const bool Pep::defaultMnemon3sxf = false;
int Pep::aaaAddressField(EAddrMode addressMode)
{
if (addressMode == I) return 0;
if (addressMode == D) return 1;
if (addressMode == N) return 2;
if (addressMode == S) return 3;
if (addressMode == SF) return 4;
if (addressMode == X) return 5;
if (addressMode == SX) return 6;
if (addressMode == SXF) return 7;
return -1; // Should not occur;
}
int Pep::aAddressField(EAddrMode addressMode)
{
if (addressMode == I) return 0;
if (addressMode == X) return 1;
return -1; // Should not occur;
}
QString Pep::intToAddrMode(EAddrMode addressMode) {
if (addressMode == I) return "i";
if (addressMode == D) return "d";
if (addressMode == N) return "n";
if (addressMode == S) return "s";
if (addressMode == SF) return "sf";
if (addressMode == X) return "x";
if (addressMode == SX) return "sx";
if (addressMode == SXF) return "sxf";
return ""; // Should not occur
}
QString Pep::<API key>(EAddrMode addressMode) {
if (addressMode == NONE) return "";
if (addressMode == I) return ", i";
if (addressMode == D) return ", d";
if (addressMode == N) return ", n";
if (addressMode == S) return ", s";
if (addressMode == SF) return ", sf";
if (addressMode == X) return ", x";
if (addressMode == SX) return ", sx";
if (addressMode == SXF) return ", sxf";
return ""; // Should not occur
}
// Function to read text from a resource file
QString Pep::resToString(QString fileName) {
QFile file(fileName);
file.open(QIODevice::ReadOnly | QIODevice::Text);
QTextStream in(&file);
QString inString = "";
while (!in.atEnd()) {
QString line = in.readLine();
inString.append(line + "\n");
}
return inString;
}
QString Pep::getSystem() {
#ifdef Q_OS_LINUX
return QString("Linux");
#endif
#ifdef Q_OS_OSX
return QString("Mac");
#endif
#ifdef Q_WS_QWS
return QString("Embedded Linux");
#endif
#ifdef Q_WS_WIN
return QString("Windows");
#endif
#ifdef Q_OS_WIN
return QString("Windows");
#endif
return QString("No OS");
}
// Maps between mnemonic enums and strings
QMap<Enu::EMnemonic, QString> Pep::enumToMnemonMap;
QMap<QString, Enu::EMnemonic> Pep::mnemonToEnumMap;
void Pep::initEnumMnemonMaps()
{
enumToMnemonMap.clear(); mnemonToEnumMap.clear(); // Can be called from Redefine Mnemonics
enumToMnemonMap.insert(ADDA, "ADDA"); mnemonToEnumMap.insert("ADDA", ADDA);
enumToMnemonMap.insert(ADDSP, "ADDSP"); mnemonToEnumMap.insert("ADDSP", ADDSP);
enumToMnemonMap.insert(ADDX, "ADDX"); mnemonToEnumMap.insert("ADDX", ADDX);
enumToMnemonMap.insert(ANDA, "ANDA"); mnemonToEnumMap.insert("ANDA", ANDA);
enumToMnemonMap.insert(ANDX, "ANDX"); mnemonToEnumMap.insert("ANDX", ANDX);
enumToMnemonMap.insert(ASLA, "ASLA"); mnemonToEnumMap.insert("ASLA", ASLA);
enumToMnemonMap.insert(ASLX, "ASLX"); mnemonToEnumMap.insert("ASLX", ASLX);
enumToMnemonMap.insert(ASRA, "ASRA"); mnemonToEnumMap.insert("ASRA", ASRA);
enumToMnemonMap.insert(ASRX, "ASRX"); mnemonToEnumMap.insert("ASRX", ASRX);
enumToMnemonMap.insert(BR, "BR"); mnemonToEnumMap.insert("BR", BR);
enumToMnemonMap.insert(BRC, "BRC"); mnemonToEnumMap.insert("BRC", BRC);
enumToMnemonMap.insert(BREQ, "BREQ"); mnemonToEnumMap.insert("BREQ", BREQ);
enumToMnemonMap.insert(BRGE, "BRGE"); mnemonToEnumMap.insert("BRGE", BRGE);
enumToMnemonMap.insert(BRGT, "BRGT"); mnemonToEnumMap.insert("BRGT", BRGT);
enumToMnemonMap.insert(BRLE, "BRLE"); mnemonToEnumMap.insert("BRLE", BRLE);
enumToMnemonMap.insert(BRLT, "BRLT"); mnemonToEnumMap.insert("BRLT", BRLT);
enumToMnemonMap.insert(BRNE, "BRNE"); mnemonToEnumMap.insert("BRNE", BRNE);
enumToMnemonMap.insert(BRV, "BRV"); mnemonToEnumMap.insert("BRV", BRV);
enumToMnemonMap.insert(CALL, "CALL"); mnemonToEnumMap.insert("CALL", CALL);
enumToMnemonMap.insert(CHARI, "CHARI"); mnemonToEnumMap.insert("CHARI", CHARI);
enumToMnemonMap.insert(CHARO, "CHARO"); mnemonToEnumMap.insert("CHARO", CHARO);
enumToMnemonMap.insert(CPA, "CPA"); mnemonToEnumMap.insert("CPA", CPA);
enumToMnemonMap.insert(CPX, "CPX"); mnemonToEnumMap.insert("CPX", CPX);
enumToMnemonMap.insert(DECI, <API key>); mnemonToEnumMap.insert(<API key>, DECI);
enumToMnemonMap.insert(DECO, <API key>); mnemonToEnumMap.insert(<API key>, DECO);
enumToMnemonMap.insert(LDA, "LDA"); mnemonToEnumMap.insert("LDA", LDA);
enumToMnemonMap.insert(LDBYTEA, "LDBYTEA"); mnemonToEnumMap.insert("LDBYTEA", LDBYTEA);
enumToMnemonMap.insert(LDBYTEX, "LDBYTEX"); mnemonToEnumMap.insert("LDBYTEX", LDBYTEX);
enumToMnemonMap.insert(LDX, "LDX"); mnemonToEnumMap.insert("LDX", LDX);
enumToMnemonMap.insert(MOVFLGA, "MOVFLGA"); mnemonToEnumMap.insert("MOVFLGA", MOVFLGA);
enumToMnemonMap.insert(MOVSPA, "MOVSPA"); mnemonToEnumMap.insert("MOVSPA", MOVSPA);
enumToMnemonMap.insert(NEGA, "NEGA"); mnemonToEnumMap.insert("NEGA", NEGA);
enumToMnemonMap.insert(NEGX, "NEGX"); mnemonToEnumMap.insert("NEGX", NEGX);
enumToMnemonMap.insert(NOP, <API key>); mnemonToEnumMap.insert(<API key>, NOP);
enumToMnemonMap.insert(NOP0, <API key>); mnemonToEnumMap.insert(<API key>, NOP0);
enumToMnemonMap.insert(NOP1, <API key>); mnemonToEnumMap.insert(<API key>, NOP1);
enumToMnemonMap.insert(NOP2, <API key>); mnemonToEnumMap.insert(<API key>, NOP2);
enumToMnemonMap.insert(NOP3, <API key>); mnemonToEnumMap.insert(<API key>, NOP3);
enumToMnemonMap.insert(NOTA, "NOTA"); mnemonToEnumMap.insert("NOTA", NOTA);
enumToMnemonMap.insert(NOTX, "NOTX"); mnemonToEnumMap.insert("NOTX", NOTX);
enumToMnemonMap.insert(ORA, "ORA"); mnemonToEnumMap.insert("ORA", ORA);
enumToMnemonMap.insert(ORX, "ORX"); mnemonToEnumMap.insert("ORX", ORX);
enumToMnemonMap.insert(RET0, "RET0"); mnemonToEnumMap.insert("RET0", RET0);
enumToMnemonMap.insert(RET1, "RET1"); mnemonToEnumMap.insert("RET1", RET1);
enumToMnemonMap.insert(RET2, "RET2"); mnemonToEnumMap.insert("RET2", RET2);
enumToMnemonMap.insert(RET3, "RET3"); mnemonToEnumMap.insert("RET3", RET3);
enumToMnemonMap.insert(RET4, "RET4"); mnemonToEnumMap.insert("RET4", RET4);
enumToMnemonMap.insert(RET5, "RET5"); mnemonToEnumMap.insert("RET5", RET5);
enumToMnemonMap.insert(RET6, "RET6"); mnemonToEnumMap.insert("RET6", RET6);
enumToMnemonMap.insert(RET7, "RET7"); mnemonToEnumMap.insert("RET7", RET7);
enumToMnemonMap.insert(RETTR, "RETTR"); mnemonToEnumMap.insert("RETTR", RETTR);
enumToMnemonMap.insert(ROLA, "ROLA"); mnemonToEnumMap.insert("ROLA", ROLA);
enumToMnemonMap.insert(ROLX, "ROLX"); mnemonToEnumMap.insert("ROLX", ROLX);
enumToMnemonMap.insert(RORA, "RORA"); mnemonToEnumMap.insert("RORA", RORA);
enumToMnemonMap.insert(RORX, "RORX"); mnemonToEnumMap.insert("RORX", RORX);
enumToMnemonMap.insert(STA, "STA"); mnemonToEnumMap.insert("STA", STA);
enumToMnemonMap.insert(STBYTEA, "STBYTEA"); mnemonToEnumMap.insert("STBYTEA", STBYTEA);
enumToMnemonMap.insert(STBYTEX, "STBYTEX"); mnemonToEnumMap.insert("STBYTEX", STBYTEX);
enumToMnemonMap.insert(STOP, "STOP"); mnemonToEnumMap.insert("STOP", STOP);
enumToMnemonMap.insert(STRO, <API key>); mnemonToEnumMap.insert(<API key>, STRO);
enumToMnemonMap.insert(STX, "STX"); mnemonToEnumMap.insert("STX", STX);
enumToMnemonMap.insert(SUBA, "SUBA"); mnemonToEnumMap.insert("SUBA", SUBA);
enumToMnemonMap.insert(SUBSP, "SUBSP"); mnemonToEnumMap.insert("SUBSP", SUBSP);
enumToMnemonMap.insert(SUBX, "SUBX"); mnemonToEnumMap.insert("SUBX", SUBX);
}
// Maps to characterize each instruction
QMap<Enu::EMnemonic, int> Pep::opCodeMap;
QMap<Enu::EMnemonic, bool> Pep::isUnaryMap;
QMap<Enu::EMnemonic, bool> Pep::addrModeRequiredMap;
QMap<Enu::EMnemonic, bool> Pep::isTrapMap;
void Pep::initMnemonicMaps()
{
opCodeMap.insert(ADDA, 112); isUnaryMap.insert(ADDA, false); addrModeRequiredMap.insert(ADDA, true); isTrapMap.insert(ADDA, false);
opCodeMap.insert(ADDSP, 96); isUnaryMap.insert(ADDSP, false); addrModeRequiredMap.insert(ADDSP, true); isTrapMap.insert(ADDSP, false);
opCodeMap.insert(ADDX, 120); isUnaryMap.insert(ADDX, false); addrModeRequiredMap.insert(ADDX, true); isTrapMap.insert(ADDX, false);
opCodeMap.insert(ANDA, 144); isUnaryMap.insert(ANDA, false); addrModeRequiredMap.insert(ANDA, true); isTrapMap.insert(ANDA, false);
opCodeMap.insert(ANDX, 152); isUnaryMap.insert(ANDX, false); addrModeRequiredMap.insert(ANDX, true); isTrapMap.insert(ANDX, false);
opCodeMap.insert(ASLA, 28); isUnaryMap.insert(ASLA, true); addrModeRequiredMap.insert(ASLA, true); isTrapMap.insert(ASLA, false);
opCodeMap.insert(ASLX, 29); isUnaryMap.insert(ASLX, true); addrModeRequiredMap.insert(ASLX, true); isTrapMap.insert(ASLX, false);
opCodeMap.insert(ASRA, 30); isUnaryMap.insert(ASRA, true); addrModeRequiredMap.insert(ASRA, true); isTrapMap.insert(ASRA, false);
opCodeMap.insert(ASRX, 31); isUnaryMap.insert(ASRX, true); addrModeRequiredMap.insert(ASRX, true); isTrapMap.insert(ASRX, false);
opCodeMap.insert(BR, 4); isUnaryMap.insert(BR, false); addrModeRequiredMap.insert(BR, false); isTrapMap.insert(BR, false);
opCodeMap.insert(BRC, 20); isUnaryMap.insert(BRC, false); addrModeRequiredMap.insert(BRC, false); isTrapMap.insert(BRC, false);
opCodeMap.insert(BREQ, 10); isUnaryMap.insert(BREQ, false); addrModeRequiredMap.insert(BREQ, false); isTrapMap.insert(BREQ, false);
opCodeMap.insert(BRGE, 14); isUnaryMap.insert(BRGE, false); addrModeRequiredMap.insert(BRGE, false); isTrapMap.insert(BRGE, false);
opCodeMap.insert(BRGT, 16); isUnaryMap.insert(BRGT, false); addrModeRequiredMap.insert(BRGT, false); isTrapMap.insert(BRGT, false);
opCodeMap.insert(BRLE, 6); isUnaryMap.insert(BRLE, false); addrModeRequiredMap.insert(BRLE, false); isTrapMap.insert(BRLE, false);
opCodeMap.insert(BRLT, 8); isUnaryMap.insert(BRLT, false); addrModeRequiredMap.insert(BRLT, false); isTrapMap.insert(BRLT, false);
opCodeMap.insert(BRNE, 12); isUnaryMap.insert(BRNE, false); addrModeRequiredMap.insert(BRNE, false); isTrapMap.insert(BRNE, false);
opCodeMap.insert(BRV, 18); isUnaryMap.insert(BRV, false); addrModeRequiredMap.insert(BRV, false); isTrapMap.insert(BRV, false);
opCodeMap.insert(CALL, 22); isUnaryMap.insert(CALL, false); addrModeRequiredMap.insert(CALL, false); isTrapMap.insert(CALL, false);
opCodeMap.insert(CHARI, 72); isUnaryMap.insert(CHARI, false); addrModeRequiredMap.insert(CHARI, true); isTrapMap.insert(CHARI, false);
opCodeMap.insert(CHARO, 80); isUnaryMap.insert(CHARO, false); addrModeRequiredMap.insert(CHARO, true); isTrapMap.insert(CHARO, false);
opCodeMap.insert(CPA, 176); isUnaryMap.insert(CPA, false); addrModeRequiredMap.insert(CPA, true); isTrapMap.insert(CPA, false);
opCodeMap.insert(CPX, 184); isUnaryMap.insert(CPX, false); addrModeRequiredMap.insert(CPX, true); isTrapMap.insert(CPX, false);
opCodeMap.insert(DECI, 48); isUnaryMap.insert(DECI, false); addrModeRequiredMap.insert(DECI, true); isTrapMap.insert(DECI, true);
opCodeMap.insert(DECO, 56); isUnaryMap.insert(DECO, false); addrModeRequiredMap.insert(DECO, true); isTrapMap.insert(DECO, true);
opCodeMap.insert(LDA, 192); isUnaryMap.insert(LDA, false); addrModeRequiredMap.insert(LDA, true); isTrapMap.insert(LDA, false);
opCodeMap.insert(LDBYTEA, 208); isUnaryMap.insert(LDBYTEA, false); addrModeRequiredMap.insert(LDBYTEA, true); isTrapMap.insert(LDBYTEA, false);
opCodeMap.insert(LDBYTEX, 216); isUnaryMap.insert(LDBYTEX, false); addrModeRequiredMap.insert(LDBYTEX, true); isTrapMap.insert(LDBYTEX, false);
opCodeMap.insert(LDX, 200); isUnaryMap.insert(LDX, false); addrModeRequiredMap.insert(LDX, true); isTrapMap.insert(LDX, false);
opCodeMap.insert(MOVFLGA, 3); isUnaryMap.insert(MOVFLGA, true); addrModeRequiredMap.insert(MOVFLGA, true); isTrapMap.insert(MOVFLGA, false);
opCodeMap.insert(MOVSPA, 2); isUnaryMap.insert(MOVSPA, true); addrModeRequiredMap.insert(MOVSPA, true); isTrapMap.insert(MOVSPA, false);
opCodeMap.insert(NEGA, 26); isUnaryMap.insert(NEGA, true); addrModeRequiredMap.insert(NEGA, true); isTrapMap.insert(NEGA, false);
opCodeMap.insert(NEGX, 27); isUnaryMap.insert(NEGX, true); addrModeRequiredMap.insert(NEGX, true); isTrapMap.insert(NEGX, false);
opCodeMap.insert(NOP, 40); isUnaryMap.insert(NOP, false); addrModeRequiredMap.insert(NOP, true); isTrapMap.insert(NOP, true);
opCodeMap.insert(NOP0, 36); isUnaryMap.insert(NOP0, true); addrModeRequiredMap.insert(NOP0, true); isTrapMap.insert(NOP0, true);
opCodeMap.insert(NOP1, 37); isUnaryMap.insert(NOP1, true); addrModeRequiredMap.insert(NOP1, true); isTrapMap.insert(NOP1, true);
opCodeMap.insert(NOP2, 38); isUnaryMap.insert(NOP2, true); addrModeRequiredMap.insert(NOP2, true); isTrapMap.insert(NOP2, true);
opCodeMap.insert(NOP3, 39); isUnaryMap.insert(NOP3, true); addrModeRequiredMap.insert(NOP3, true); isTrapMap.insert(NOP3, true);
opCodeMap.insert(NOTA, 24); isUnaryMap.insert(NOTA, true); addrModeRequiredMap.insert(NOTA, true); isTrapMap.insert(NOTA, false);
opCodeMap.insert(NOTX, 25); isUnaryMap.insert(NOTX, true); addrModeRequiredMap.insert(NOTX, true); isTrapMap.insert(NOTX, false);
opCodeMap.insert(ORA, 160); isUnaryMap.insert(ORA, false); addrModeRequiredMap.insert(ORA, true); isTrapMap.insert(ORA, false);
opCodeMap.insert(ORX, 168); isUnaryMap.insert(ORX, false); addrModeRequiredMap.insert(ORX, true); isTrapMap.insert(ORX, false);
opCodeMap.insert(RET0, 88); isUnaryMap.insert(RET0, true); addrModeRequiredMap.insert(RET0, true); isTrapMap.insert(RET0, false);
opCodeMap.insert(RET1, 89); isUnaryMap.insert(RET1, true); addrModeRequiredMap.insert(RET1, true); isTrapMap.insert(RET1, false);
opCodeMap.insert(RET2, 90); isUnaryMap.insert(RET2, true); addrModeRequiredMap.insert(RET2, true); isTrapMap.insert(RET2, false);
opCodeMap.insert(RET3, 91); isUnaryMap.insert(RET3, true); addrModeRequiredMap.insert(RET3, true); isTrapMap.insert(RET3, false);
opCodeMap.insert(RET4, 92); isUnaryMap.insert(RET4, true); addrModeRequiredMap.insert(RET4, true); isTrapMap.insert(RET4, false);
opCodeMap.insert(RET5, 93); isUnaryMap.insert(RET5, true); addrModeRequiredMap.insert(RET5, true); isTrapMap.insert(RET5, false);
opCodeMap.insert(RET6, 94); isUnaryMap.insert(RET6, true); addrModeRequiredMap.insert(RET6, true); isTrapMap.insert(RET6, false);
opCodeMap.insert(RET7, 95); isUnaryMap.insert(RET7, true); addrModeRequiredMap.insert(RET7, true); isTrapMap.insert(RET7, false);
opCodeMap.insert(RETTR, 1); isUnaryMap.insert(RETTR, true); addrModeRequiredMap.insert(RETTR, true); isTrapMap.insert(RETTR, false);
opCodeMap.insert(ROLA, 32); isUnaryMap.insert(ROLA, true); addrModeRequiredMap.insert(ROLA, true); isTrapMap.insert(ROLA, false);
opCodeMap.insert(ROLX, 33); isUnaryMap.insert(ROLX, true); addrModeRequiredMap.insert(ROLX, true); isTrapMap.insert(ROLX, false);
opCodeMap.insert(RORA, 34); isUnaryMap.insert(RORA, true); addrModeRequiredMap.insert(RORA, true); isTrapMap.insert(RORA, false);
opCodeMap.insert(RORX, 35); isUnaryMap.insert(RORX, true); addrModeRequiredMap.insert(RORX, true); isTrapMap.insert(RORX, false);
opCodeMap.insert(STA, 224); isUnaryMap.insert(STA, false); addrModeRequiredMap.insert(STA, true); isTrapMap.insert(STA, false);
opCodeMap.insert(STBYTEA, 240); isUnaryMap.insert(STBYTEA, false); addrModeRequiredMap.insert(STBYTEA, true); isTrapMap.insert(STBYTEA, false);
opCodeMap.insert(STBYTEX, 248); isUnaryMap.insert(STBYTEX, false); addrModeRequiredMap.insert(STBYTEX, true); isTrapMap.insert(STBYTEX, false);
opCodeMap.insert(STOP, 0); isUnaryMap.insert(STOP, true); addrModeRequiredMap.insert(STOP, true); isTrapMap.insert(STOP, false);
opCodeMap.insert(STRO, 64); isUnaryMap.insert(STRO, false); addrModeRequiredMap.insert(STRO, true); isTrapMap.insert(STRO, true);
opCodeMap.insert(STX, 232); isUnaryMap.insert(STX, false); addrModeRequiredMap.insert(STX, true); isTrapMap.insert(STX, false);
opCodeMap.insert(SUBA, 128); isUnaryMap.insert(SUBA, false); addrModeRequiredMap.insert(SUBA, true); isTrapMap.insert(SUBA, false);
opCodeMap.insert(SUBSP, 104); isUnaryMap.insert(SUBSP, false); addrModeRequiredMap.insert(SUBSP, true); isTrapMap.insert(SUBSP, false);
opCodeMap.insert(SUBX, 136); isUnaryMap.insert(SUBX, false); addrModeRequiredMap.insert(SUBX, true); isTrapMap.insert(SUBX, false);
}
QMap<Enu::EMnemonic, int > Pep::addrModesMap;
void Pep::initAddrModesMap()
{
// Nonunary instructions
addrModesMap.insert(ADDA, ALL);
addrModesMap.insert(ADDSP, ALL);
addrModesMap.insert(ADDX, ALL);
addrModesMap.insert(ANDA, ALL);
addrModesMap.insert(ANDX, ALL);
addrModesMap.insert(BR, I | X);
addrModesMap.insert(BRC, I | X);
addrModesMap.insert(BREQ, I | X);
addrModesMap.insert(BRGE, I | X);
addrModesMap.insert(BRGT, I | X);
addrModesMap.insert(BRLE, I | X);
addrModesMap.insert(BRLT, I | X);
addrModesMap.insert(BRNE, I | X);
addrModesMap.insert(BRV, I | X);
addrModesMap.insert(CALL, I | X);
addrModesMap.insert(CHARI, D | N | S | SF | X | SX | SXF);
addrModesMap.insert(CHARO, ALL);
addrModesMap.insert(CPA, ALL);
addrModesMap.insert(CPX, ALL);
addrModesMap.insert(LDA, ALL);
addrModesMap.insert(LDBYTEA, ALL);
addrModesMap.insert(LDBYTEX, ALL);
addrModesMap.insert(LDX, ALL);
addrModesMap.insert(ORA, ALL);
addrModesMap.insert(ORX, ALL);
addrModesMap.insert(STA, D | N | S | SF | X | SX | SXF);
addrModesMap.insert(STBYTEA, D | N | S | SF | X | SX | SXF);
addrModesMap.insert(STBYTEX, D | N | S | SF | X | SX | SXF);
addrModesMap.insert(STX, D | N | S | SF | X | SX | SXF);
addrModesMap.insert(SUBA, ALL);
addrModesMap.insert(SUBSP, ALL);
addrModesMap.insert(SUBX, ALL);
// Nonunary trap instructions
int addrMode;
addrMode = 0;
if (defaultMnemon0i) addrMode |= I;
if (defaultMnemon0d) addrMode |= D;
if (defaultMnemon0n) addrMode |= N;
if (defaultMnemon0s) addrMode |= S;
if (defaultMnemon0sf) addrMode |= SF;
if (defaultMnemon0x) addrMode |= X;
if (defaultMnemon0sx) addrMode |= SX;
if (defaultMnemon0sxf) addrMode |= SXF;
addrModesMap.insert(NOP, addrMode);
addrMode = 0;
if (defaultMnemon1i) addrMode |= I;
if (defaultMnemon1d) addrMode |= D;
if (defaultMnemon1n) addrMode |= N;
if (defaultMnemon1s) addrMode |= S;
if (defaultMnemon1sf) addrMode |= SF;
if (defaultMnemon1x) addrMode |= X;
if (defaultMnemon1sx) addrMode |= SX;
if (defaultMnemon1sxf) addrMode |= SXF;
addrModesMap.insert(DECI, addrMode);
addrMode = 0;
if (defaultMnemon2i) addrMode |= I;
if (defaultMnemon2d) addrMode |= D;
if (defaultMnemon2n) addrMode |= N;
if (defaultMnemon2s) addrMode |= S;
if (defaultMnemon2sf) addrMode |= SF;
if (defaultMnemon2x) addrMode |= X;
if (defaultMnemon2sx) addrMode |= SX;
if (defaultMnemon2sxf) addrMode |= SXF;
addrModesMap.insert(DECO, addrMode);
addrMode = 0;
if (defaultMnemon3i) addrMode |= I;
if (defaultMnemon3d) addrMode |= D;
if (defaultMnemon3n) addrMode |= N;
if (defaultMnemon3s) addrMode |= S;
if (defaultMnemon3sf) addrMode |= SF;
if (defaultMnemon3x) addrMode |= X;
if (defaultMnemon3sx) addrMode |= SX;
if (defaultMnemon3sxf) addrMode |= SXF;
addrModesMap.insert(STRO, addrMode);
}
// The symbol table
QMap<QString, int> Pep::symbolTable;
QMap<QString, bool> Pep::<API key>;
// The trace tag tables
QMap<QString, Enu::ESymbolFormat> Pep::symbolFormat;
QMap<QString, int> Pep::<API key>;
QMap<QString, QStringList> Pep::globalStructSymbols;
QMap<int, QStringList> Pep::symbolTraceList; // Key is memory address
QStringList Pep::blockSymbols;
QStringList Pep::equateSymbols;
// Map from instruction memory address to assembler listing line
QMap<int, int> *Pep::<API key>;
QMap<int, Qt::CheckState> *Pep::listingRowChecked;
QMap<int, int> Pep::<API key>;
QMap<int, Qt::CheckState> Pep::<API key>;
QMap<int, int> Pep::<API key>;
QMap<int, Qt::CheckState> Pep::listingRowCheckedOS;
// Decoder tables
QVector<Enu::EMnemonic> Pep::decodeMnemonic(256);
QVector<Enu::EAddrMode> Pep::decodeAddrMode(256);
void Pep::initDecoderTables()
{
decodeMnemonic[0] = STOP; decodeAddrMode[0] = NONE;
decodeMnemonic[1] = RETTR; decodeAddrMode[1] = NONE;
decodeMnemonic[2] = MOVSPA; decodeAddrMode[2] = NONE;
decodeMnemonic[3] = MOVFLGA; decodeAddrMode[3] = NONE;
decodeMnemonic[4] = BR; decodeAddrMode[4] = I;
decodeMnemonic[5] = BR; decodeAddrMode[5] = X;
decodeMnemonic[6] = BRLE; decodeAddrMode[6] = I;
decodeMnemonic[7] = BRLE; decodeAddrMode[7] = X;
decodeMnemonic[8] = BRLT; decodeAddrMode[8] = I;
decodeMnemonic[9] = BRLT; decodeAddrMode[9] = X;
decodeMnemonic[10] = BREQ; decodeAddrMode[10] = I;
decodeMnemonic[11] = BREQ; decodeAddrMode[11] = X;
decodeMnemonic[12] = BRNE; decodeAddrMode[12] = I;
decodeMnemonic[13] = BRNE; decodeAddrMode[13] = X;
decodeMnemonic[14] = BRGE; decodeAddrMode[14] = I;
decodeMnemonic[15] = BRGE; decodeAddrMode[15] = X;
decodeMnemonic[16] = BRGT; decodeAddrMode[16] = I;
decodeMnemonic[17] = BRGT; decodeAddrMode[17] = X;
decodeMnemonic[18] = BRV; decodeAddrMode[18] = I;
decodeMnemonic[19] = BRV; decodeAddrMode[19] = X;
decodeMnemonic[20] = BRC; decodeAddrMode[20] = I;
decodeMnemonic[21] = BRC; decodeAddrMode[21] = X;
decodeMnemonic[22] = CALL; decodeAddrMode[22] = I;
decodeMnemonic[23] = CALL; decodeAddrMode[23] = X;
decodeMnemonic[24] = NOTA; decodeAddrMode[24] = NONE;
decodeMnemonic[25] = NOTX; decodeAddrMode[25] = NONE;
decodeMnemonic[26] = NEGA; decodeAddrMode[26] = NONE;
decodeMnemonic[27] = NEGX; decodeAddrMode[27] = NONE;
decodeMnemonic[28] = ASLA; decodeAddrMode[28] = NONE;
decodeMnemonic[29] = ASLX; decodeAddrMode[29] = NONE;
decodeMnemonic[30] = ASRA; decodeAddrMode[30] = NONE;
decodeMnemonic[31] = ASRX; decodeAddrMode[31] = NONE;
decodeMnemonic[32] = ROLA; decodeAddrMode[32] = NONE;
decodeMnemonic[33] = ROLX; decodeAddrMode[33] = NONE;
decodeMnemonic[34] = RORA; decodeAddrMode[34] = NONE;
decodeMnemonic[35] = RORX; decodeAddrMode[35] = NONE;
// Note that the trap instructions are all unary at the machine level
decodeMnemonic[36] = NOP0; decodeAddrMode[36] = NONE;
decodeMnemonic[37] = NOP1; decodeAddrMode[37] = NONE;
decodeMnemonic[38] = NOP2; decodeAddrMode[38] = NONE;
decodeMnemonic[39] = NOP3; decodeAddrMode[39] = NONE;
decodeMnemonic[40] = NOP; decodeAddrMode[40] = NONE;
decodeMnemonic[41] = NOP; decodeAddrMode[41] = NONE;
decodeMnemonic[42] = NOP; decodeAddrMode[42] = NONE;
decodeMnemonic[43] = NOP; decodeAddrMode[43] = NONE;
decodeMnemonic[44] = NOP; decodeAddrMode[44] = NONE;
decodeMnemonic[45] = NOP; decodeAddrMode[45] = NONE;
decodeMnemonic[46] = NOP; decodeAddrMode[46] = NONE;
decodeMnemonic[47] = NOP; decodeAddrMode[47] = NONE;
decodeMnemonic[48] = DECI; decodeAddrMode[48] = NONE;
decodeMnemonic[49] = DECI; decodeAddrMode[49] = NONE;
decodeMnemonic[50] = DECI; decodeAddrMode[50] = NONE;
decodeMnemonic[51] = DECI; decodeAddrMode[51] = NONE;
decodeMnemonic[52] = DECI; decodeAddrMode[52] = NONE;
decodeMnemonic[53] = DECI; decodeAddrMode[53] = NONE;
decodeMnemonic[54] = DECI; decodeAddrMode[54] = NONE;
decodeMnemonic[55] = DECI; decodeAddrMode[55] = NONE;
decodeMnemonic[56] = DECO; decodeAddrMode[56] = NONE; // I think this is a bug...?
decodeMnemonic[57] = DECO; decodeAddrMode[57] = NONE;
decodeMnemonic[58] = DECO; decodeAddrMode[58] = NONE;
decodeMnemonic[59] = DECO; decodeAddrMode[59] = NONE;
decodeMnemonic[60] = DECO; decodeAddrMode[60] = NONE;
decodeMnemonic[61] = DECO; decodeAddrMode[61] = NONE;
decodeMnemonic[62] = DECO; decodeAddrMode[62] = NONE;
decodeMnemonic[63] = DECO; decodeAddrMode[63] = NONE;
decodeMnemonic[64] = STRO; decodeAddrMode[64] = NONE;
decodeMnemonic[65] = STRO; decodeAddrMode[65] = NONE;
decodeMnemonic[66] = STRO; decodeAddrMode[66] = NONE;
decodeMnemonic[67] = STRO; decodeAddrMode[67] = NONE;
decodeMnemonic[68] = STRO; decodeAddrMode[68] = NONE;
decodeMnemonic[69] = STRO; decodeAddrMode[69] = NONE;
decodeMnemonic[70] = STRO; decodeAddrMode[70] = NONE;
decodeMnemonic[71] = STRO; decodeAddrMode[71] = NONE;
decodeMnemonic[72] = CHARI; decodeAddrMode[72] = I;
decodeMnemonic[73] = CHARI; decodeAddrMode[73] = D;
decodeMnemonic[74] = CHARI; decodeAddrMode[74] = N;
decodeMnemonic[75] = CHARI; decodeAddrMode[75] = S;
decodeMnemonic[76] = CHARI; decodeAddrMode[76] = SF;
decodeMnemonic[77] = CHARI; decodeAddrMode[77] = X;
decodeMnemonic[78] = CHARI; decodeAddrMode[78] = SX;
decodeMnemonic[79] = CHARI; decodeAddrMode[79] = SXF;
decodeMnemonic[80] = CHARO; decodeAddrMode[80] = I;
decodeMnemonic[81] = CHARO; decodeAddrMode[81] = D;
decodeMnemonic[82] = CHARO; decodeAddrMode[82] = N;
decodeMnemonic[83] = CHARO; decodeAddrMode[83] = S;
decodeMnemonic[84] = CHARO; decodeAddrMode[84] = SF;
decodeMnemonic[85] = CHARO; decodeAddrMode[85] = X;
decodeMnemonic[86] = CHARO; decodeAddrMode[86] = SX;
decodeMnemonic[87] = CHARO; decodeAddrMode[87] = SXF;
decodeMnemonic[88] = RET0; decodeAddrMode[88] = NONE;
decodeMnemonic[89] = RET1; decodeAddrMode[89] = NONE;
decodeMnemonic[90] = RET2; decodeAddrMode[90] = NONE;
decodeMnemonic[91] = RET3; decodeAddrMode[91] = NONE;
decodeMnemonic[92] = RET4; decodeAddrMode[92] = NONE;
decodeMnemonic[93] = RET5; decodeAddrMode[93] = NONE;
decodeMnemonic[94] = RET6; decodeAddrMode[94] = NONE;
decodeMnemonic[95] = RET7; decodeAddrMode[95] = NONE;
decodeMnemonic[96] = ADDSP; decodeAddrMode[96] = I;
decodeMnemonic[97] = ADDSP; decodeAddrMode[97] = D;
decodeMnemonic[98] = ADDSP; decodeAddrMode[98] = N;
decodeMnemonic[99] = ADDSP; decodeAddrMode[99] = S;
decodeMnemonic[100] = ADDSP; decodeAddrMode[100] = SF;
decodeMnemonic[101] = ADDSP; decodeAddrMode[101] = X;
decodeMnemonic[102] = ADDSP; decodeAddrMode[102] = SX;
decodeMnemonic[103] = ADDSP; decodeAddrMode[103] = SXF;
decodeMnemonic[104] = SUBSP; decodeAddrMode[104] = I;
decodeMnemonic[105] = SUBSP; decodeAddrMode[105] = D;
decodeMnemonic[106] = SUBSP; decodeAddrMode[106] = N;
decodeMnemonic[107] = SUBSP; decodeAddrMode[107] = S;
decodeMnemonic[108] = SUBSP; decodeAddrMode[108] = SF;
decodeMnemonic[109] = SUBSP; decodeAddrMode[109] = X;
decodeMnemonic[110] = SUBSP; decodeAddrMode[110] = SX;
decodeMnemonic[111] = SUBSP; decodeAddrMode[111] = SXF;
decodeMnemonic[112] = ADDA; decodeAddrMode[112] = I;
decodeMnemonic[113] = ADDA; decodeAddrMode[113] = D;
decodeMnemonic[114] = ADDA; decodeAddrMode[114] = N;
decodeMnemonic[115] = ADDA; decodeAddrMode[115] = S;
decodeMnemonic[116] = ADDA; decodeAddrMode[116] = SF;
decodeMnemonic[117] = ADDA; decodeAddrMode[117] = X;
decodeMnemonic[118] = ADDA; decodeAddrMode[118] = SX;
decodeMnemonic[119] = ADDA; decodeAddrMode[119] = SXF;
decodeMnemonic[120] = ADDX; decodeAddrMode[120] = I;
decodeMnemonic[121] = ADDX; decodeAddrMode[121] = D;
decodeMnemonic[122] = ADDX; decodeAddrMode[122] = N;
decodeMnemonic[123] = ADDX; decodeAddrMode[123] = S;
decodeMnemonic[124] = ADDX; decodeAddrMode[124] = SF;
decodeMnemonic[125] = ADDX; decodeAddrMode[125] = X;
decodeMnemonic[126] = ADDX; decodeAddrMode[126] = SX;
decodeMnemonic[127] = ADDX; decodeAddrMode[127] = SXF;
decodeMnemonic[128] = SUBA; decodeAddrMode[128] = I;
decodeMnemonic[129] = SUBA; decodeAddrMode[129] = D;
decodeMnemonic[130] = SUBA; decodeAddrMode[130] = N;
decodeMnemonic[131] = SUBA; decodeAddrMode[131] = S;
decodeMnemonic[132] = SUBA; decodeAddrMode[132] = SF;
decodeMnemonic[133] = SUBA; decodeAddrMode[133] = X;
decodeMnemonic[134] = SUBA; decodeAddrMode[134] = SX;
decodeMnemonic[135] = SUBA; decodeAddrMode[135] = SXF;
decodeMnemonic[136] = SUBX; decodeAddrMode[136] = I;
decodeMnemonic[137] = SUBX; decodeAddrMode[137] = D;
decodeMnemonic[138] = SUBX; decodeAddrMode[138] = N;
decodeMnemonic[139] = SUBX; decodeAddrMode[139] = S;
decodeMnemonic[140] = SUBX; decodeAddrMode[140] = SF;
decodeMnemonic[141] = SUBX; decodeAddrMode[141] = X;
decodeMnemonic[142] = SUBX; decodeAddrMode[142] = SX;
decodeMnemonic[143] = SUBX; decodeAddrMode[143] = SXF;
decodeMnemonic[144] = ANDA; decodeAddrMode[144] = I;
decodeMnemonic[145] = ANDA; decodeAddrMode[145] = D;
decodeMnemonic[146] = ANDA; decodeAddrMode[146] = N;
decodeMnemonic[147] = ANDA; decodeAddrMode[147] = S;
decodeMnemonic[148] = ANDA; decodeAddrMode[148] = SF;
decodeMnemonic[149] = ANDA; decodeAddrMode[149] = X;
decodeMnemonic[150] = ANDA; decodeAddrMode[150] = SX;
decodeMnemonic[151] = ANDA; decodeAddrMode[151] = SXF;
decodeMnemonic[152] = ANDX; decodeAddrMode[152] = I;
decodeMnemonic[153] = ANDX; decodeAddrMode[153] = D;
decodeMnemonic[154] = ANDX; decodeAddrMode[154] = N;
decodeMnemonic[155] = ANDX; decodeAddrMode[155] = S;
decodeMnemonic[156] = ANDX; decodeAddrMode[156] = SF;
decodeMnemonic[157] = ANDX; decodeAddrMode[157] = X;
decodeMnemonic[158] = ANDX; decodeAddrMode[158] = SX;
decodeMnemonic[159] = ANDX; decodeAddrMode[159] = SXF;
decodeMnemonic[160] = ORA; decodeAddrMode[160] = I;
decodeMnemonic[161] = ORA; decodeAddrMode[161] = D;
decodeMnemonic[162] = ORA; decodeAddrMode[162] = N;
decodeMnemonic[163] = ORA; decodeAddrMode[163] = S;
decodeMnemonic[164] = ORA; decodeAddrMode[164] = SF;
decodeMnemonic[165] = ORA; decodeAddrMode[165] = X;
decodeMnemonic[166] = ORA; decodeAddrMode[166] = SX;
decodeMnemonic[167] = ORA; decodeAddrMode[167] = SXF;
decodeMnemonic[168] = ORX; decodeAddrMode[168] = I;
decodeMnemonic[169] = ORX; decodeAddrMode[169] = D;
decodeMnemonic[170] = ORX; decodeAddrMode[170] = N;
decodeMnemonic[171] = ORX; decodeAddrMode[171] = S;
decodeMnemonic[172] = ORX; decodeAddrMode[172] = SF;
decodeMnemonic[173] = ORX; decodeAddrMode[173] = X;
decodeMnemonic[174] = ORX; decodeAddrMode[174] = SX;
decodeMnemonic[175] = ORX; decodeAddrMode[175] = SXF;
decodeMnemonic[176] = CPA; decodeAddrMode[176] = I;
decodeMnemonic[177] = CPA; decodeAddrMode[177] = D;
decodeMnemonic[178] = CPA; decodeAddrMode[178] = N;
decodeMnemonic[179] = CPA; decodeAddrMode[179] = S;
decodeMnemonic[180] = CPA; decodeAddrMode[180] = SF;
decodeMnemonic[181] = CPA; decodeAddrMode[181] = X;
decodeMnemonic[182] = CPA; decodeAddrMode[182] = SX;
decodeMnemonic[183] = CPA; decodeAddrMode[183] = SXF;
decodeMnemonic[184] = CPX; decodeAddrMode[184] = I;
decodeMnemonic[185] = CPX; decodeAddrMode[185] = D;
decodeMnemonic[186] = CPX; decodeAddrMode[186] = N;
decodeMnemonic[187] = CPX; decodeAddrMode[187] = S;
decodeMnemonic[188] = CPX; decodeAddrMode[188] = SF;
decodeMnemonic[189] = CPX; decodeAddrMode[189] = X;
decodeMnemonic[190] = CPX; decodeAddrMode[190] = SX;
decodeMnemonic[191] = CPX; decodeAddrMode[191] = SXF;
decodeMnemonic[192] = LDA; decodeAddrMode[192] = I;
decodeMnemonic[193] = LDA; decodeAddrMode[193] = D;
decodeMnemonic[194] = LDA; decodeAddrMode[194] = N;
decodeMnemonic[195] = LDA; decodeAddrMode[195] = S;
decodeMnemonic[196] = LDA; decodeAddrMode[196] = SF;
decodeMnemonic[197] = LDA; decodeAddrMode[197] = X;
decodeMnemonic[198] = LDA; decodeAddrMode[198] = SX;
decodeMnemonic[199] = LDA; decodeAddrMode[199] = SXF;
decodeMnemonic[200] = LDX; decodeAddrMode[200] = I;
decodeMnemonic[201] = LDX; decodeAddrMode[201] = D;
decodeMnemonic[202] = LDX; decodeAddrMode[202] = N;
decodeMnemonic[203] = LDX; decodeAddrMode[203] = S;
decodeMnemonic[204] = LDX; decodeAddrMode[204] = SF;
decodeMnemonic[205] = LDX; decodeAddrMode[205] = X;
decodeMnemonic[206] = LDX; decodeAddrMode[206] = SX;
decodeMnemonic[207] = LDX; decodeAddrMode[207] = SXF;
decodeMnemonic[208] = LDBYTEA; decodeAddrMode[208] = I;
decodeMnemonic[209] = LDBYTEA; decodeAddrMode[209] = D;
decodeMnemonic[210] = LDBYTEA; decodeAddrMode[210] = N;
decodeMnemonic[211] = LDBYTEA; decodeAddrMode[211] = S;
decodeMnemonic[212] = LDBYTEA; decodeAddrMode[212] = SF;
decodeMnemonic[213] = LDBYTEA; decodeAddrMode[213] = X;
decodeMnemonic[214] = LDBYTEA; decodeAddrMode[214] = SX;
decodeMnemonic[215] = LDBYTEA; decodeAddrMode[215] = SXF;
decodeMnemonic[216] = LDBYTEX; decodeAddrMode[216] = I;
decodeMnemonic[217] = LDBYTEX; decodeAddrMode[217] = D;
decodeMnemonic[218] = LDBYTEX; decodeAddrMode[218] = N;
decodeMnemonic[219] = LDBYTEX; decodeAddrMode[219] = S;
decodeMnemonic[220] = LDBYTEX; decodeAddrMode[220] = SF;
decodeMnemonic[221] = LDBYTEX; decodeAddrMode[221] = X;
decodeMnemonic[222] = LDBYTEX; decodeAddrMode[222] = SX;
decodeMnemonic[223] = LDBYTEX; decodeAddrMode[223] = SXF;
decodeMnemonic[224] = STA; decodeAddrMode[224] = I;
decodeMnemonic[225] = STA; decodeAddrMode[225] = D;
decodeMnemonic[226] = STA; decodeAddrMode[226] = N;
decodeMnemonic[227] = STA; decodeAddrMode[227] = S;
decodeMnemonic[228] = STA; decodeAddrMode[228] = SF;
decodeMnemonic[229] = STA; decodeAddrMode[229] = X;
decodeMnemonic[230] = STA; decodeAddrMode[230] = SX;
decodeMnemonic[231] = STA; decodeAddrMode[231] = SXF;
decodeMnemonic[232] = STX; decodeAddrMode[232] = I;
decodeMnemonic[233] = STX; decodeAddrMode[233] = D;
decodeMnemonic[234] = STX; decodeAddrMode[234] = N;
decodeMnemonic[235] = STX; decodeAddrMode[235] = S;
decodeMnemonic[236] = STX; decodeAddrMode[236] = SF;
decodeMnemonic[237] = STX; decodeAddrMode[237] = X;
decodeMnemonic[238] = STX; decodeAddrMode[238] = SX;
decodeMnemonic[239] = STX; decodeAddrMode[239] = SXF;
decodeMnemonic[240] = STBYTEA; decodeAddrMode[240] = I;
decodeMnemonic[241] = STBYTEA; decodeAddrMode[241] = D;
decodeMnemonic[242] = STBYTEA; decodeAddrMode[242] = N;
decodeMnemonic[243] = STBYTEA; decodeAddrMode[243] = S;
decodeMnemonic[244] = STBYTEA; decodeAddrMode[244] = SF;
decodeMnemonic[245] = STBYTEA; decodeAddrMode[245] = X;
decodeMnemonic[246] = STBYTEA; decodeAddrMode[246] = SX;
decodeMnemonic[247] = STBYTEA; decodeAddrMode[247] = SXF;
decodeMnemonic[248] = STBYTEX; decodeAddrMode[248] = I;
decodeMnemonic[249] = STBYTEX; decodeAddrMode[249] = D;
decodeMnemonic[250] = STBYTEX; decodeAddrMode[250] = N;
decodeMnemonic[251] = STBYTEX; decodeAddrMode[251] = S;
decodeMnemonic[252] = STBYTEX; decodeAddrMode[252] = SF;
decodeMnemonic[253] = STBYTEX; decodeAddrMode[253] = X;
decodeMnemonic[254] = STBYTEX; decodeAddrMode[254] = SX;
decodeMnemonic[255] = STBYTEX; decodeAddrMode[255] = SXF;
}
// .BURN and the ROM state
int Pep::byteCount;
int Pep::burnCount;
int Pep::dotBurnArgument;
int Pep::romStartAddress;
// Memory trace state
bool Pep::traceTagWarning; |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using MathParser.ParseTree;
using MathParser.Lexing;
namespace MathParser.Parsing
{
<summary>
Interface describing a prefix syntax. All syntaxes that
identitfy themselves by their starting token (including parenthesis
groups) implement this interface.
</summary>
public interface IPrefixParselet
{
<summary>
Recursive parse function for the syntax. Call parser.Parse()
to continue parsing the next node, and call parser.Consume()
to expect a token as part of the syntax.
</summary>
<param name="parser">Parser used in recursion</param>
<param name="token">Identifying token in the parselet</param>
<returns>
A new node from all the child nodes parsed
by this parselet.
</returns>
NodeBase Parse(Parser parser, Token token);
}
} |
class Person:
def __init__(self):
self.name = 'jeff'
self.age = 10
p = Person()
print(p.__dict__) |
<?php
namespace Starbug\Core\Generator;
use Starbug\Core\TemplateInterface;
/**
* Generator runs Definition objects to create directories, copy files, and generate files from templates.
*/
class Generator {
/**
* Constructor.
*
* @param TemplateInterface $renderer Template renderer.
* @param boolean $base_directory Project root.
*/
public function __construct(TemplateInterface $renderer, $base_directory = false) {
$this->renderer = $renderer;
$this->base_directory = $base_directory;
if (false == $this->base_directory) {
$this->base_directory = getcwd();
}
}
/**
* Run a Definition object with some parameters.
*
* @param Definition $definition The definition to run.
* @param array $options The parameters to pass to the definition.
*
* @return void
*/
public function generate(Definition $definition, array $options = []) {
$definition->build($options);
// CREATE DIRECTORIES.
foreach ($definition->getDirectories() as $dir) {
if (!file_exists($this->base_directory."/".$dir)) passthru("mkdir ".$this->base_directory."/".$dir);
}
// CREATE FILES.
foreach ($definition->getTemplates() as $output => $template) {
$data = $this->renderer->capture($template, $definition->getParameters());
file_put_contents($this->base_directory."/".$output, $data);
}
// COPY FILES.
foreach ($definition->getCopies() as $origin => $dest) {
passthru("cp ".$this->base_directory."/$origin ".$this->base_directory."/".$dest);
}
}
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.