answer
stringlengths 15
1.25M
|
|---|
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class CI_DB_mssql_result extends CI_DB_result {
/**
* Number of rows in the result set
*
* @return int
*/
public function num_rows()
{
return is_int($this->num_rows)
? $this->num_rows
: $this->num_rows = mssql_num_rows($this->result_id);
}
/**
* Number of fields in the result set
*
* @return int
*/
public function num_fields()
{
return mssql_num_fields($this->result_id);
}
/**
* Fetch Field Names
*
* Generates an array of column names
*
* @return array
*/
public function list_fields()
{
$field_names = array();
mssql_field_seek($this->result_id, 0);
while ($field = mssql_fetch_field($this->result_id))
{
$field_names[] = $field->name;
}
return $field_names;
}
/**
* Field data
*
* Generates an array of objects containing field meta-data
*
* @return array
*/
public function field_data()
{
$retval = array();
for ($i = 0, $c = $this->num_fields(); $i < $c; $i++)
{
$field = mssql_fetch_field($this->result_id, $i);
$retval[$i] = new stdClass();
$retval[$i]->name = $field->name;
$retval[$i]->type = $field->type;
$retval[$i]->max_length = $field->max_length;
}
return $retval;
}
/**
* Free the result
*
* @return void
*/
public function free_result()
{
if (is_resource($this->result_id))
{
mssql_free_result($this->result_id);
$this->result_id = FALSE;
}
}
/**
* Data Seek
*
* Moves the internal pointer to the desired offset. We call
* this internally before fetching results to make sure the
* result set starts at zero.
*
* @param int $n
* @return bool
*/
public function data_seek($n = 0)
{
return mssql_data_seek($this->result_id, $n);
}
/**
* Result - associative array
*
* Returns the result set as an array
*
* @return array
*/
protected function _fetch_assoc()
{
return mssql_fetch_assoc($this->result_id);
}
/**
* Result - object
*
* Returns the result set as an object
*
* @param string $class_name
* @return object
*/
protected function _fetch_object($class_name = 'stdClass')
{
$row = mssql_fetch_object($this->result_id);
if ($class_name === 'stdClass' OR ! $row)
{
return $row;
}
$class_name = new $class_name();
foreach ($row as $key => $value)
{
$class_name->$key = $value;
}
return $class_name;
}
}
|
package org.droidplanner.core.MAVLink;
import com.MAVLink.Messages.MAVLinkMessage;
import com.MAVLink.common.msg_mission_ack;
import com.MAVLink.common.msg_mission_count;
import com.MAVLink.common.msg_mission_current;
import com.MAVLink.common.msg_mission_item;
import com.MAVLink.common.<API key>;
import com.MAVLink.common.msg_mission_request;
import org.droidplanner.core.drone.DroneInterfaces;
import org.droidplanner.core.drone.DroneInterfaces.<API key>;
import org.droidplanner.core.drone.DroneVariable;
import org.droidplanner.core.model.Drone;
import java.util.ArrayList;
import java.util.List;
/**
* Class to manage the communication of waypoints to the MAV.
* <p/>
* Should be initialized with a MAVLink Object, so the manager can send messages
* via the MAV link. The function processMessage must be called with every new
* MAV Message.
*/
public class WaypointManager extends DroneVariable {
enum WaypointStates {
IDLE, READ_REQUEST, READING_WP, WRITING_WP_COUNT, WRITING_WP, WAITING_WRITE_ACK
}
public enum WaypointEvent_Type {
WP_UPLOAD, WP_DOWNLOAD, WP_RETRY, WP_CONTINUE, WP_TIMED_OUT
}
private static final long TIMEOUT = 15000;
private static final int RETRY_LIMIT = 3;
private int retryTracker = 0;
private int readIndex;
private int writeIndex;
private int retryIndex;
private <API key> wpEventListener;
WaypointStates state = WaypointStates.IDLE;
/**
* waypoint witch is currently being written
*/
private final DroneInterfaces.Handler watchdog;
private final Runnable watchdogCallback = new Runnable() {
@Override
public void run() {
if (processTimeOut(++retryTracker))
watchdog.postDelayed(this, TIMEOUT);
}
};
public WaypointManager(Drone drone, DroneInterfaces.Handler handler) {
super(drone);
this.watchdog = handler;
}
public void <API key>(<API key> wpEventListener) {
this.wpEventListener = wpEventListener;
}
private void startWatchdog() {
stopWatchdog();
retryTracker = 0;
this.watchdog.postDelayed(watchdogCallback, TIMEOUT);
}
private void stopWatchdog() {
this.watchdog.removeCallbacks(watchdogCallback);
}
/**
* Try to receive all waypoints from the MAV.
* <p/>
* If all runs well the callback will return the list of waypoints.
*/
public void getWaypoints() {
// ensure that WPManager is not doing anything else
if (state != WaypointStates.IDLE)
return;
<API key>(WaypointEvent_Type.WP_DOWNLOAD);
readIndex = -1;
state = WaypointStates.READ_REQUEST;
MavLinkWaypoint.<API key>(myDrone);
startWatchdog();
}
/**
* Write a list of waypoints to the MAV.
* <p/>
* The callback will return the status of this operation
*
* @param data waypoints to be written
*/
public void writeWaypoints(List<msg_mission_item> data) {
// ensure that WPManager is not doing anything else
if (state != WaypointStates.IDLE)
return;
if ((mission != null)) {
<API key>(WaypointEvent_Type.WP_UPLOAD);
updateMsgIndexes(data);
mission.clear();
mission.addAll(data);
writeIndex = 0;
state = WaypointStates.WRITING_WP_COUNT;
MavLinkWaypoint.sendWaypointCount(myDrone, mission.size());
startWatchdog();
}
}
private void updateMsgIndexes(List<msg_mission_item> data) {
short index = 0;
for (msg_mission_item msg : data) {
msg.seq = index++;
}
}
/**
* Sets the current waypoint in the MAV
* <p/>
* The callback will return the status of this operation
*/
public void setCurrentWaypoint(int i) {
if ((mission != null)) {
MavLinkWaypoint.<API key>(myDrone, (short) i);
}
}
/**
* Callback for when a waypoint has been reached
*
* @param wpNumber number of the completed waypoint
*/
public void onWaypointReached(int wpNumber) {
}
/**
* Callback for a change in the current waypoint the MAV is heading for
*
* @param seq number of the updated waypoint
*/
private void <API key>(short seq) {
}
/**
* number of waypoints to be received, used when reading waypoints
*/
private short waypointCount;
/**
* list of waypoints used when writing or receiving
*/
private List<msg_mission_item> mission = new ArrayList<msg_mission_item>();
/**
* Try to process a Mavlink message if it is a mission related message
*
* @param msg Mavlink message to process
* @return Returns true if the message has been processed
*/
public boolean processMessage(MAVLinkMessage msg) {
switch (state) {
default:
case IDLE:
break;
case READ_REQUEST:
if (msg.msgid == msg_mission_count.<API key>) {
waypointCount = ((msg_mission_count) msg).count;
mission.clear();
startWatchdog();
MavLinkWaypoint.requestWayPoint(myDrone, mission.size());
state = WaypointStates.READING_WP;
return true;
}
break;
case READING_WP:
if (msg.msgid == msg_mission_item.<API key>) {
startWatchdog();
<API key>((msg_mission_item) msg);
doWaypointEvent(WaypointEvent_Type.WP_DOWNLOAD, readIndex + 1, waypointCount);
if (mission.size() < waypointCount) {
MavLinkWaypoint.requestWayPoint(myDrone, mission.size());
} else {
stopWatchdog();
state = WaypointStates.IDLE;
MavLinkWaypoint.sendAck(myDrone);
myDrone.getMission().onMissionReceived(mission);
doEndWaypointEvent(WaypointEvent_Type.WP_DOWNLOAD);
}
return true;
}
break;
case WRITING_WP_COUNT:
state = WaypointStates.WRITING_WP;
case WRITING_WP:
if (msg.msgid == msg_mission_request.<API key>) {
startWatchdog();
<API key>((msg_mission_request) msg);
doWaypointEvent(WaypointEvent_Type.WP_UPLOAD, writeIndex + 1, mission.size());
return true;
}
break;
case WAITING_WRITE_ACK:
if (msg.msgid == msg_mission_ack.<API key>) {
stopWatchdog();
myDrone.getMission().onWriteWaypoints((msg_mission_ack) msg);
state = WaypointStates.IDLE;
doEndWaypointEvent(WaypointEvent_Type.WP_UPLOAD);
return true;
}
break;
}
if (msg.msgid == <API key>.<API key>) {
onWaypointReached(((<API key>) msg).seq);
return true;
}
if (msg.msgid == msg_mission_current.<API key>) {
<API key>(((msg_mission_current) msg).seq);
return true;
}
return false;
}
public boolean processTimeOut(int mTimeOutCount) {
// If max retry is reached, set state to IDLE. No more retry.
if (mTimeOutCount >= RETRY_LIMIT) {
state = WaypointStates.IDLE;
doWaypointEvent(WaypointEvent_Type.WP_TIMED_OUT, retryIndex, RETRY_LIMIT);
return false;
}
retryIndex++;
doWaypointEvent(WaypointEvent_Type.WP_RETRY, retryIndex, RETRY_LIMIT);
switch (state) {
default:
case IDLE:
break;
case READ_REQUEST:
MavLinkWaypoint.<API key>(myDrone);
break;
case READING_WP:
if (mission.size() < waypointCount) { // request last lost WP
MavLinkWaypoint.requestWayPoint(myDrone, mission.size());
}
break;
case WRITING_WP_COUNT:
MavLinkWaypoint.sendWaypointCount(myDrone, mission.size());
break;
case WRITING_WP:
// Log.d("TIMEOUT", "re Write Msg: " + String.valueOf(writeIndex));
if (writeIndex < mission.size()) {
myDrone.getMavClient().sendMavPacket(mission.get(writeIndex).pack());
}
break;
case WAITING_WRITE_ACK:
myDrone.getMavClient().sendMavPacket(mission.get(mission.size() - 1).pack());
break;
}
return true;
}
private void <API key>(msg_mission_request msg) {
/*
* Log.d("TIMEOUT", "Write Msg: " + String.valueOf(msg.seq));
*/
writeIndex = msg.seq;
msg_mission_item item = mission.get(writeIndex);
item.target_system = myDrone.getSysid();
item.target_component = myDrone.getCompid();
myDrone.getMavClient().sendMavPacket(item.pack());
if (writeIndex + 1 >= mission.size()) {
state = WaypointStates.WAITING_WRITE_ACK;
}
}
private void <API key>(msg_mission_item msg) {
/*
* Log.d("TIMEOUT", "Read Last/Curr: " + String.valueOf(readIndex) + "/"
* + String.valueOf(msg.seq));
*/
// in case of we receive the same WP again after retry
if (msg.seq <= readIndex)
return;
readIndex = msg.seq;
mission.add(msg);
}
private void <API key>(WaypointEvent_Type wpEvent) {
retryIndex = 0;
if (wpEventListener == null)
return;
wpEventListener.<API key>(wpEvent);
}
private void doEndWaypointEvent(WaypointEvent_Type wpEvent) {
if (retryIndex > 0)// if retry successful, notify that we now continue
doWaypointEvent(WaypointEvent_Type.WP_CONTINUE, retryIndex, RETRY_LIMIT);
retryIndex = 0;
if (wpEventListener == null)
return;
wpEventListener.onEndWaypointEvent(wpEvent);
}
private void doWaypointEvent(WaypointEvent_Type wpEvent, int index, int count) {
retryIndex = 0;
if (wpEventListener == null)
return;
wpEventListener.onWaypointEvent(wpEvent, index, count);
}
}
|
from .game import Board
for i in range(10):
Board.all()
print(i)
|
ionic-webpack
==========
Ionic Webpack Starter
## Quick Start
Clone the repository
bash
$ git clone https://github.com/cmackay/ionic-webpack.git
Install the dependencies
bash
$ npm install
Watch Mode (this will run the webpack dev server)
bash
$ gulp watch
Adding Cordova Plugins
bash
$ cordova plugins add <API key> <API key> <API key>
Adding Cordova Platforms
bash
$ cordova platform add ios
Build
bash
$ gulp && cordova build
Running in the emulator
bash
$ cordova emulate ios
|
#include <iostream>
using namespace std;
int main()
{
int n;
cin >> n;
if(n<6)
cout << n/2+1 <<endl;
else
cout << (10-n)/2+1 <<endl;
return 0;
}
|
<HTML><HEAD>
<TITLE>Review for Quills (2000)</TITLE>
<LINK REL="STYLESHEET" TYPE="text/css" HREF="/ramr.css">
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000">
<H1 ALIGN="CENTER" CLASS="title"><A HREF="/Title?0180073">Quills (2000)</A></H1><H3 ALIGN=CENTER>reviewed by<BR><A HREF="/ReviewsBy?Harvey+S.+Karten">Harvey S. Karten</A></H3><HR WIDTH="40%" SIZE="4">
<PRE>QUILLS</PRE>
<P> Reviewed by Harvey Karten
Fox Searchlight Films
Director: Philip Kaufman
Writer: Doug Wright (play & screenplay)
Cast: Geoffrey Rush, Kate Winslet, Joaquin Phoenix,
Michael Caine, Billie Whitelaw, Patrick Malahide, Amelia
Warner, Jane Menelaus, Stephen Moyer</P>
<P> If you're reading this online review, you are, of course,
familiar with the power of the Internet. All sorts of movie
data, even whole books, can be uploaded to the 'net and
then downloaded in a matter of seconds by readers from
Passaic to Port Moresby. How easy things have become in
the Information Age! Our very freedom to gather printed and
even visual material from a gadget that can be held on our
laps furnishes dramatic contrast to the difficulties people had
in disseminating their views during the Nineteenth Century
and before. Although Gutenberg's invention of movable type
had been around for a couple of hundred years, governments
and religious leaders were reluctant to allow their people to
read materials they considered subversive of the political or
social order. In our own time, an age that beholds eight-
year-olds gazing casually and without shock at pornography
on the Internet, we may feel bemused that at one time some
books considered corrupt by those in power were off limits to
the populace (as a few are even today). One such work was
"Justine," published anonymously but recognized everywhere
as the work of the Marquis de Sade. While the contents
would today be considered hokey, even downright laughable,
the flagrantly erotic text of "Justine" created quite a scandal
in Paris, so much so that while many who could get their
hands on the outlawed novel gobbled up the pages hungrily,
Church officials and even Napoleon himself were apoplectic
with outrage.</P>
<P> Phil Kaufman, whose "The Right Stuff" was neither arty nor
subtle, now comes across with a decidedly uncommercial
movie; cynical where "The Right Stuff" was idealistic,
grotesque where the all-American movie was straight-laced,
depraved and revolting where the rah-rah picture was
uplifting. Based on Doug Wright's Obie (off-Broadway)-award
winning play by the same name, "Quills" cannot be mistaken
for a naturalistic movie but instead evokes its theatrical
origins in virtually every scene. Resembling in spirit Peter
Brook's 1996 film "Marat/Sade"--which was in turn based on
Peter Weiss's <API key> play about a so-
called performance staged by inmates of the French asylum
for the insane at Charenton--"Quills" offers a potent, arch,
humorous and downright fascinating glimpse into a society
both terrified and titillated by literary descriptions of raging
sexuality. While "Justine" appears to me to be more
gynecological than arousing, the illustrated novel in its time
became a cause celebre, as controversial as the current
presidential quagmire in the U.S.</P>
<P> "Quills" takes place in 1807 and centers on the Marquis de
Sade, a man whose very name has given us the word
"sadism" but whose cruelty in this screenplay is limited to a
passing comment about his activities--which included the
carving up of a 16-year-old's backside and the rubbing of salt
into the wound. Instead de Sade is made into an artistic
hero, a man who, while imprisoned at a mental institution for
his past sadism, is for the most part a gentlemanly, intelligent
fellow with a compulsion to write and comfortable quarters to
do so. If denied the privilege of putting his ideas on paper
with his feathery, quill pen--of subliminating his madness
through his art--he believes that he will go as demented as
his fellow inmates, who include one guy who thinks he's a
bird and another a bald, lecherous Frenchman who could
pass for a Sumo wrestler or for the masked executioner who
in the opening scene lowers the guillotine on a hapless
aristocrat.</P>
<P> The Marquis (Geoffrey Rush) is treated well by the Abbe
de Coulmier (Joaquin Phoenix), who believes that insane
people can act reasonably when treated with kindness and
given therapy. (In one situation, he gently asks a pyromanic,
"Isn't it better to paint fires than to set them")?
A virginal chambermaid in the institution, Madeleine (Kate
Winslet), is regularly aroused by the Marquis' erotic writings,
which she reads to the giggles and pique of other workers,
but more important she has been smuggling the banned
chapters of the Marquis' literature out of the asylum for
general <API key> the pages over to a mysterious
equestrian comrade. With Napoleon himself infuriated by the
novels and the Marquis' wife scandalized by the pornography,
Dr. Royer-Collar (Michael Caine) is sent to Charenton to
bring both the Marquis and the Abbe to heel.</P>
<P> Most of the film deals forcefully, dramatically, and
exquisitely with what happens after the Marquis is forbidden
to write. His quill pen taken away, he resorts to writing on
the tablecloth with a chicken bone dipped in wine. Absent
the chicken bone, he pricks his own finger and writes in his
own blood. When even the ability to cut himself is removed,
he implements yet another resourceful method to get his
ideas into print, one which horrifies the entire institution and
could turn quite a few stomachs of those in the theater
audience. (His final words give new meaning to smut on
bathroom walls.)</P>
<P> "Quills" informs us with striking drama what happens when
art and sexuality are repressed by the forces of pious
hypocrisy. Director Kaufman draws the lines clearly, giving
the viewer no doubt that compromise is out of the question.
The gentle Abbe is pitted against the throughly unsentimental
Royer-Collard, the latter infuriated when his own marriage to
a orphaned girl decades younger than he is brutally satirized
in a play written by the Marquis and performed by the
inmates to the glee and horror of the audience. The Abbe
himself is torn between his vows of chastity to the Church
and his arousal by both a naked Marquis and the winsome
chambermaid, Madeleine. The lovely wife of the Dr. Royer-
Collard, Simone (Amelia Warner), is torn between her
marriage vows to the aging doctor (who supplies her with all
the material luxuries any woman could want) and her
"Justine"-inspired desire for the young and handsome
architect, Prouix (Stephen Moyer). </P>
<P> While most of the action of this stage-born work is filmed
within the institution, Kaufman's photographer, Rogier Stoffer
and his production designer, Martin Childs, give the work a
painterly essence, a gruesome exhibition of the guillotine in
action in the very opening of the film climaxing with the horror
that befalls the Marquis as he uncompromisingly alienates the
powers that be.</P>
<P> The always reliable Michael Caine plays admirably against
the extraordinarily talented Geoffrey Rush, while the erotic
nature of the young women is tested against the repressive
notions of the Church and government. Strip away the
costumes and you could almost see our own times: the
ongoing dialectic about Hollywood's alleged corrupting of
youths around the world; the absurd overreaction of right-
wingers to President Clinton's peccadilloes; even (as ace
online critic Maitland McDonagh points out in her prescient
essay) the controversy over the defense given by the
American Civil Liberties Union to repulsive organizations like
the American Nazi Party and other skinhead bands.
Contemporary relevance aside, "Quills" stands out as a
tough-minded, lush portrayal of people acting in extremis,
particularly of one man unwilling, nay unable, to compromise
even at the risk of torture and death. There's a place on our
screens for small, low-budget indies like Kenneth Lonergan's
remarkable "You Can Count on Me," which NY Times critic
Stephen Holden named one of the two or three best movies
of the year so far. "Quills" demonstrates that we also need
off-the-wall high drama, powerful tales of larger-than-life
characters whose uncompromising heroism elevates them to
mythic stature.</P>
<P>Rated R. Running time: 120 minutes. (C) 2000 by
Harvey Karten, <A HREF="mailto:film_critic@compuserve.com">film_critic@compuserve.com</A></P>
<HR><P CLASS=flush><SMALL>The review above was posted to the
<A HREF="news:rec.arts.movies.reviews">rec.arts.movies.reviews</A> newsgroup (<A HREF="news:de.rec.film.kritiken">de.rec.film.kritiken</A> for German reviews).<BR>
The Internet Movie Database accepts no responsibility for the contents of the
review and has no editorial control. Unless stated otherwise, the copyright
belongs to the author.<BR>
Please direct comments/criticisms of the review to relevant newsgroups.<BR>
Broken URLs inthe reviews are the responsibility of the author.<BR>
The formatting of the review is likely to differ from the original due
to ASCII to HTML conversion.
</SMALL></P>
<P ALIGN=CENTER>Related links: <A HREF="/Reviews/">index of all rec.arts.movies.reviews reviews</A></P>
</P></BODY></HTML>
|
# coding: utf-8
# ##Test out UGRID-0.9 compliant unstructured grid model datasets with PYUGRID
# In[1]:
name_list=['<API key>',
'<API key>',
'sea_surface_height','water level',
'<API key>',
'<API key>',
'<API key>']
models = dict(ADCIRC=('http://comt.sura.org/thredds/dodsC/data/comt_1_archive/inundation_tropical/'
'UND_ADCIRC/<API key>'),
FVCOM=('http:
'Forecasts/<API key>.nc'),
SELFE=('http://comt.sura.org/thredds/dodsC/data/comt_1_archive/inundation_tropical/'
'VIMS_SELFE/<API key>'),
WW3=('http://comt.sura.org/thredds/dodsC/data/comt_2/<API key>/EMC_ADCIRC-WW3/'
'<API key>'))
# In[2]:
import iris
iris.FUTURE.netcdf_promote = True
def cube_func(cube):
return (cube.standard_name in name_list) and (not any(m.method == 'maximum' for m in cube.cell_methods))
constraint = iris.Constraint(cube_func=cube_func)
cubes = dict()
for model, url in models.items():
cube = iris.load_cube(url, constraint)
cubes.update({model: cube})
# In[3]:
cubes
# In[4]:
import pyugrid
import matplotlib.tri as tri
def get_mesh(cube, url):
ug = pyugrid.UGrid.from_ncfile(url)
cube.mesh = ug
cube.mesh_dimension = 1
return cube
def get_triang(cube):
lon = cube.mesh.nodes[:, 0]
lat = cube.mesh.nodes[:, 1]
nv = cube.mesh.faces
return tri.Triangulation(lon, lat, triangles=nv)
# In[5]:
tris = dict()
for model, cube in cubes.items():
url = models[model]
cube = get_mesh(cube, url)
cubes.update({model: cube})
tris.update({model: get_triang(cube)})
# In[6]:
get_ipython().magic('matplotlib inline')
import numpy as np
import cartopy.crs as ccrs
import matplotlib.pyplot as plt
def plot_model(model):
cube = cubes[model]
lon = cube.mesh.nodes[:, 0]
lat = cube.mesh.nodes[:, 1]
ind = -1 # just take the last time index for now
zcube = cube[ind]
triang = tris[model]
fig, ax = plt.subplots(figsize=(7, 7),
subplot_kw=dict(projection=ccrs.PlateCarree()))
ax.set_extent([lon.min(), lon.max(), lat.min(), lat.max()])
ax.coastlines()
levs = np.arange(-1, 5, 0.2)
cs = ax.tricontourf(triang, zcube.data, levels=levs)
fig.colorbar(cs)
ax.tricontour(triang, zcube.data, colors='k',levels=levs)
tvar = cube.coord('time')
tstr = tvar.units.num2date(tvar.points[ind])
gl = ax.gridlines(draw_labels=True)
gl.xlabels_top = gl.ylabels_right = False
title = ax.set_title('%s: Elevation (m): %s' % (zcube.attributes['title'], tstr))
return fig, ax
# In[7]:
fig, ax = plot_model('ADCIRC')
# In[8]:
fig, ax = plot_model('FVCOM')
# In[9]:
fig, ax = plot_model('WW3')
# In[10]:
fig, ax = plot_model('SELFE')
|
#2016315
##nodejs
http
js
//http
var http = require('http');
//httpcreateServerweb
var server = http.createServer();
server.on('error', function(err){
console.log(err);
});
server.on('listening', function() {
console.log('listening...');
})
server.on('request', function(req, res) {
console.log('');
//console.log(req);
//res.write('hello');
res.setHeader('miaov', 'leo');
res.writeHead(200, 'miaov', {
//'content-type' : 'text/plain'
'content-type' : 'text/html;charset=utf-8'
});
res.write('<h1>hello</h1>');
res.end();
})
server.listen(8080, 'localhost');
//console.log(server.address());
- request -http.IncomingMessage
+ httpVersion:http
+ headers
+ url
+ method
- response - http.ServerResponse
+ write(chunk,[encoding]):
+ end([chunk],[encoding]):
+ statusCode:
+ setHeader(name,value):
+ writeHeader(statusCode,[reasonPhrase],[headers])
* response.end()
****
****
****************
****
********
|
void menu_top(void);
void menu_Mchar2(void); // motor
void menu_Mchar3(void); // motor
void menu_Schar2(void); // sensor
|
package org.jsense.serialize;
import com.google.common.collect.ImmutableList;
import org.joda.time.Instant;
import org.joda.time.ReadableInstant;
import org.jsense.AccelerometerEvent;
import org.jsense.ModelFactory;
import org.junit.Before;
import org.junit.Test;
import java.io.<API key>;
import java.io.<API key>;
import java.io.IOException;
import java.util.Iterator;
import static org.junit.Assert.*;
public class <API key> {
private static final int SEED = 88951;
private static final ReadableInstant ABSOLUTE_TIMESTAMP = new Instant(123L);
private static final long RELATIVE_TIMESTAMP = 124L;
private static final float X = 0.1f;
private static final float Y = 0.2f;
private static final float Z = 0.3f;
private AccelerometerEvent event1, event2;
@Before
public void setUp() throws IOException {
ModelFactory.setSeed(SEED);
event1 = ModelFactory.<API key>();
event2 = ModelFactory.<API key>();
}
@Test
public void <API key>() throws IOException {
Deserializer<AccelerometerEvent> deserializer = new <API key>(new <API key>(getByteArrayFrom(ImmutableList.of(event1))));
Iterable<AccelerometerEvent> events = deserializer.deserialize();
Iterator<AccelerometerEvent> eventsIterator = events.iterator();
assertTrue(eventsIterator.hasNext());
assertEquals(event1, eventsIterator.next());
}
@Test
public void <API key>() throws IOException {
Deserializer<AccelerometerEvent> deserializer = new <API key>(new <API key>(getByteArrayFrom(ImmutableList.of(event1, event2))));
Iterable<AccelerometerEvent> events = deserializer.deserialize();
Iterator<AccelerometerEvent> eventsIterator = events.iterator();
assertTrue(eventsIterator.hasNext());
assertEquals(event1, eventsIterator.next());
assertTrue(eventsIterator.hasNext());
assertEquals(event2, eventsIterator.next());
}
@Test(expected = <API key>.class)
public void sourceCantBeNull() throws IOException {
new <API key>(null);
}
@Test
public void <API key>() throws IOException {
AccelerometerEvent <API key> = AccelerometerEvent.newBuilder()
.<API key>(ABSOLUTE_TIMESTAMP)
.<API key>(RELATIVE_TIMESTAMP)
.setX(X)
.setY(Y)
.setZ(Z)
.build();
AccelerometerEvent <API key> = AccelerometerEvent.newBuilder()
.<API key>(ABSOLUTE_TIMESTAMP)
.setX(X)
.setY(Y)
.setZ(Z)
.build();
<API key> serialized = new <API key>(getByteArrayFrom(ImmutableList.of(<API key>, <API key>)));
Deserializer<AccelerometerEvent> deserializer = new <API key>(serialized);
Iterable<AccelerometerEvent> events = deserializer.deserialize();
Iterator<AccelerometerEvent> eventsIterator = events.iterator();
assertTrue(eventsIterator.next().<API key>());
assertFalse(eventsIterator.next().<API key>());
}
private byte[] getByteArrayFrom(Iterable<AccelerometerEvent> events) throws IOException {
final <API key> out = new <API key>();
new <API key>(out).serialize(events).flush();
return out.toByteArray();
}
}
|
const jwt = require("jwt-simple");
const co = require('co');
const config = require('../config');
const dbX = require('../db');
const coForEach = require('co-foreach');
module.exports = (io) => {
const <API key> = io.of('/collectionVersions');
<API key>.use((socket, next) => {
let token = socket.handshake.query.token;
// let isReconnect = socket.handshake.query.isReconnect;
// console.log('isReconnect:', isReconnect);
let decoded = null;
try {
decoded = jwt.decode(token, config.jwtSecret);
} catch(error) {
switch (error) {
case 'Signature verification failed':
return next(new Error('authentication error: the jwt has been falsified'));
case 'Token expired':
return next(new Error('authentication error: the jwt has been expired'));
}
}
console.log('decoded:', decoded);
return next();
})
<API key>.on('connection', (socket) => {
// const roomId = socket.client.id;
console.log(`${new Date()}: ${socket.client.id} connected to socket /collectionVersions`);
socket.on('<API key>', (data) => {
const versionsClient = data['versions'];
co(function*() {
const db = yield dbX.dbPromise;
const versionsLatest = yield db.collection('versions').find({}).toArray();
const <API key> = {};
// console.log('versionsClient', versionsClient);
versionsClient.reduce((acc, curr) => {
switch (true) {
case curr['collection'] === 'gd': // prices is called gd at client
const pricesVersionLatest = versionsLatest.find(v => v['collection'] === 'prices');
if (curr['version'] !== pricesVersionLatest['version']) {
acc['gd'] = {version: pricesVersionLatest['version']};
}
break;
default:
const versionLatest = versionsLatest.find(v => {
return v['collection'] === curr['collection'];
});
if (curr['version'] !== versionLatest['version']) {
acc[curr['collection']] = {version: versionLatest['version']};
}
}
return acc;
}, <API key>);
const hasUpdates = Object.keys(<API key>).length;
if (hasUpdates) {
const collectionsToUpdate = Object.keys(<API key>);
// types, titles, staffs
yield coForEach(Object.keys(<API key>), function*(k) {
console.log('adding to <API key>:', k);
switch (k) {
case 'gd':
<API key>[k]['data'] = JSON.stringify(yield db.collection('prices').find({}, {
createdAt: 0, createdBy: 0, modifiedAt: 0, modifiedBy: 0
}).toArray());
break;
default:
// need two stringifies, otherwise, error at heroku without details
<API key>[k]['data'] = [{a: 1}];
// <API key>[k]['data'] = JSON.stringify(JSON.stringify(yield db.collection(k).find({}).toArray()));
}
});
socket.emit('collectionUpdate', <API key>);
} else {
socket.send({message: 'all collections up-to-date'});
}
}).catch(error => {
console.log(error.stack);
socket.emit('error', {
error: error.stack
})
})
})
// after connection, client sends collectionVersions, then server compares
// each time a collection is updated, update its version in the 'versions' collection
})
}
|
import { sh } from '../sh'
export const getLogLines = (previousVersion: string) =>
sh(
'git',
'log',
`...${previousVersion}`,
'--merges',
'--grep="Merge pull request"',
'--format=format:%s',
'-z',
'
).then(x => (x.length === 0 ? [] : x.split('\0')))
|
<?php
namespace Vardius\Bundle\ListBundle\Filter\Types\Type;
use Doctrine\ORM\QueryBuilder;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Vardius\Bundle\ListBundle\Event\FilterEvent;
use Vardius\Bundle\ListBundle\Filter\Types\AbstractType;
class DateType extends AbstractType
{
/**
* @inheritDoc
*/
public function configureOptions(OptionsResolver $resolver)
{
parent::configureOptions($resolver);
$resolver->setDefault('condition', 'gte');
$resolver->addAllowedTypes('condition', 'string');
$resolver->addAllowedValues('condition', ['eq', 'neq', 'lt', 'lte', 'gt', 'gte']);
}
/**
* @inheritDoc
*/
public function apply(FilterEvent $event, array $options)
{
$queryBuilder = $event->getQuery();
if (!$queryBuilder instanceof QueryBuilder) {
throw new \Exception('Vardius\Bundle\ListBundle\Filter\Types\DateType supports only doctrine filters for now. To filter Propel or ElasticSearch Queries use callbacks or create your own FilterType classes');
}
$value = $event->getValue();
if ($value) {
$field = empty($options['field']) ? $event->getField() : $options['field'];
$expression = $queryBuilder->expr();
$queryBuilder
->andWhere($expression->{$options['condition']}($event->getAlias() . '.' . $field, ':vardius_date_' . $event->getField()))
->setParameter('vardius_date_' . $event->getField(), $value);
}
return $queryBuilder;
}
}
|
var gulp = require('gulp');
var setup = require('<API key>');
var DEPS_FOLDER = setup.depsFolder;
// Build tools
var _ = require(DEPS_FOLDER + 'lodash');
var insert = require(DEPS_FOLDER + 'gulp-insert');
var del = require(DEPS_FOLDER + 'del');
var plugins = {};
plugins.sass = require(DEPS_FOLDER + 'gulp-sass');
plugins.tsc = require(DEPS_FOLDER + 'gulp-tsc');
plugins.ngHtml2js = require(DEPS_FOLDER + 'gulp-ng-html2js');
plugins.concat = require(DEPS_FOLDER + 'gulp-concat');
// Customize build configuration
var CONFIG = setup.buildConfig;
CONFIG.FOLDER.APP = _.constant("./src/app/web3-demo/");
CONFIG.PARTIALS.MAIN = function() {
return [
"./src/app/web3-demo/view/content.html"
];
};
var tmpLibs = CONFIG.SRC.JS.LIBS();
tmpLibs.push('./bower_components/angular-mocks/angular-mocks.js');
tmpLibs.push('./bower_components/jquery/dist/jquery.js');
tmpLibs.push('./bower_components/bootstrap/dist/js/bootstrap.min.js');
CONFIG.SRC.JS.LIBS = function() { return tmpLibs; };
CONFIG.DEV.NG_MODULE_DEPS = function() { return ['httpBackendMock']; };
var deployDir = "./dist";
// Initialize gulp
var gulpInstance = setup.initGulp(gulp, CONFIG);
gulpInstance.task('dist', ['tscompile:templates', 'tscompile:app', 'resources']);
gulpInstance.task('deploy', ['dist'], function() {
gulp.src([
CONFIG.DIST.FOLDER() + "app.js",
CONFIG.DIST.FOLDER() + "templates.js",
CONFIG.DIST.FOLDER() + "app.js.map",
])
.pipe(gulp.dest(deployDir));
});
gulp.task("tscompile:templates", function (cb) {
var camelCaseModuleName = CONFIG.DYNAMIC_META.MODULE_NAME().replace(/-([a-z])/g, function(g) {
return g[1].toUpperCase();
});
gulp.src(CONFIG.SRC.ANGULAR_HTMLS())
.pipe(plugins.ngHtml2js({
moduleName: camelCaseModuleName + "Templatecache",
prefix: "/"
}))
.pipe(plugins.concat(CONFIG.DIST.JS.FILES.TEMPLATES()))
.pipe(insert.wrap(<API key>, requireJSSuffix))
.pipe(gulp.dest(CONFIG.DIST.FOLDER()))
.on('error', cb);
cb();
});
gulpInstance.task('tscompile:app', ['prod:init-app'], function(cb) {
// Exclude bootstrap.ts when compiling distributables since
// Camunda's tasklist app takes care of bootrapping angular
var srcFiles = [CONFIG.FOLDER.SRC() + "**/*.ts",
//"!" + CONFIG.FOLDER.SRC() + "**/*Interceptor.ts",
//"!" + CONFIG.FOLDER.SRC() + "**/bootstrap.ts",
"!" + CONFIG.SRC.TS.<API key>()];
gulp.src(srcFiles.concat(CONFIG.SRC.TS.TS_DEFINITIONS()))
.pipe(plugins.tsc(
{
allowBool: true,
out: CONFIG.DIST.JS.FILES.APP(),
sourcemap: true,
sourceRoot: "/",
target: "ES5"
}))
.pipe(insert.wrap(requireJSAppPrefix, requireJSSuffix))
.pipe(gulp.dest(CONFIG.DIST.FOLDER()))
.on('error', cb);
cb();
});
gulpInstance.task('sass', function (cb) {
gulp.src("./sass/main.scss")
.pipe(plugins.sass({
precision: 8,
errLogToConsole: true
}))
.pipe(gulp.dest("./target/css"))
.on('error', cb);
cb();
});
gulpInstance.task('watchSass', function (cb) {
gulp.watch(['sass*.scss'], ['sass']);
});
|
dfdsa
# rss
Docker,daocloud. Readis
RSSnodejs koajs
[http:
IP
- 2015.04.26 ()
1. `phantomjs` cookie ()
2. openidID ()
- 2015.10.20 ()
- 2015.08.11
- 2015.06.28 cookie `phantomjs`
- 2015.05.22 ()
- `io.js` `Node.js 0.11` ES6
- `redis-server` `6379`
, `npm install` `node --harmony app.js`
-

|
// Initialization
let canvas = document.getElementById('game') as HTMLCanvasElement;
var gl = canvas.getContext('webgl');
if (!gl) {
throw new Error('Could not create WebGL Context!');
}
// Create NDC Space Quad (attribute vec2 position)
let ndcQuad = [ 1.0, -1.0, -1.0, -1.0, 1.0, 1.0, -1.0, 1.0 ];
let indices = [ 0, 1, 2, 1, 2, 3 ];
// Create Buffers
let dataBuffer = gl.createBuffer();
let indexBuffer = gl.createBuffer();
// Bind Data/Indices to Buffers
gl.bindBuffer(gl.ARRAY_BUFFER, dataBuffer);
gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(ndcQuad), gl.STATIC_DRAW);
gl.bindBuffer(gl.<API key>, indexBuffer);
gl.bufferData(gl.<API key>, new Uint16Array(indices), gl.STATIC_DRAW);
function createProgram(vsSource: string, fsSource: string) {
let vs = gl.createShader(gl.VERTEX_SHADER);
gl.shaderSource(vs, vsSource);
gl.compileShader(vs);
if (!gl.getShaderParameter(vs, gl.COMPILE_STATUS)) {
console.error('An error occurred compiling the shader: ' + gl.getShaderInfoLog(vs));
}
let fs = gl.createShader(gl.FRAGMENT_SHADER);
gl.shaderSource(fs, fsSource);
gl.compileShader(fs);
if (!gl.getShaderParameter(fs, gl.COMPILE_STATUS)) {
console.error('An error occurred compiling the shader: ' + gl.getShaderInfoLog(fs));
}
let program = gl.createProgram();
gl.attachShader(program, vs);
gl.attachShader(program, fs);
gl.linkProgram(program);
if (!gl.getProgramParameter(program, gl.LINK_STATUS)) {
console.error(gl.getProgramInfoLog(program));
}
return { vs, fs, program };
}
let vs = `
attribute vec2 aPosition;
varying vec2 vFragCoord;
void main()
{
vFragCoord = (0.5 * aPosition) + vec2(0.5, 0.5);
vFragCoord.y = 1.0 - vFragCoord.y;
gl_Position = vec4(aPosition, 0.0, 1.0);
}
`;
let fs = `
precision mediump float;
varying vec2 vFragCoord;
uniform sampler2D tBottomLayer;
uniform sampler2D tTopLayer;
// Color Dodge
vec4 colorDodge(vec4 col, vec4 blend)
{
return vec4(mix(col.rgb / clamp(1.0 - blend.rgb, 0.00001, 1.0), col.rgb, blend.a), col.a);
}
void main()
{
vec2 uv = vFragCoord;
vec4 outColor = vec4(0.0, 0.0, 0.0, 0.0);
vec4 bottomColor = texture2D(tBottomLayer, uv);
vec4 topColor = texture2D(tTopLayer, uv);
outColor = colorDodge(bottomColor, topColor);
gl_FragColor = outColor;
}
`;
let { program } = createProgram(vs, fs);
// Load Textures
function loadTexture(url: string) {
let tex = gl.createTexture();
gl.bindTexture(gl.TEXTURE_2D, tex);
const pixel = new Uint8Array([ 0, 0, 0, 255 ]);
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, pixel);
let img = new Image();
img.src = url;
img.onload = () => {
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, img);
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
gl.generateMipmap(gl.TEXTURE_2D);
};
return tex;
}
let bottomLayer = loadTexture('https://alain.xyz/blog/<API key>/assets/cover.jpg');
let topLayer = loadTexture('https://alain.xyz/blog/<API key>/assets/cover.png');
// Draw
function draw() {
// Bind Shaders
gl.useProgram(program);
// Bind Vertex Layout
let loc = gl.getAttribLocation(program, 'aPosition');
gl.vertexAttribPointer(loc, 2, gl.FLOAT, false, 4 * 2, 0);
gl.<API key>(loc);
gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);
// Bind Uniforms
var shaderTexNumber = 0;
let bottomLayerLoc = gl.getUniformLocation(program, 'tBottomLayer');
gl.uniform1i(bottomLayerLoc, shaderTexNumber);
gl.activeTexture(gl.TEXTURE0 + shaderTexNumber);
gl.bindTexture(gl.TEXTURE_2D, bottomLayer);
shaderTexNumber++;
let topLayerLoc = gl.getUniformLocation(program, 'tTopLayer');
gl.uniform1i(topLayerLoc, shaderTexNumber);
gl.activeTexture(gl.TEXTURE0 + shaderTexNumber);
gl.bindTexture(gl.TEXTURE_2D, topLayer);
gl.drawElements(gl.TRIANGLES, 6, gl.UNSIGNED_SHORT, 0);
}
let resizeHandler = () => {
canvas.width = innerWidth;
canvas.height = innerHeight;
gl.viewport(0, 0, innerWidth, innerHeight);
draw();
};
window.addEventListener('resize', resizeHandler);
resizeHandler();
function update()
{
draw();
<API key>(update)
}
<API key>(update);
|
INSERT INTO `payment_type` VALUES
(1,'Card','CARD',1,1,0,1,'2016-12-20 11:02:12.000000',1,'2016-12-20 11:02:12.000000',1),
(2,'Direct Debit','DIRECT-DEBIT',1,2,0,1,'2016-12-20 11:02:12.000000',1,'2016-12-20 11:02:12.000000',1),
(3,'Cash','CASH',0,3,0,1,'2016-12-20 11:02:12.000000',1,'2016-12-20 11:02:12.000000',1),
(4,'Cheque','CHEQUE',0,4,1,1,'2016-12-20 11:02:12.000000',1,'2016-12-20 11:02:12.000000',1),
(5,'Postal Order','POSTAL-ORDER',0,5,0,1,'2016-12-20 11:02:12.000000',1,'2016-12-20 11:02:12.000000',1),
(7,'Transition','TRANSITION',1,6,1,1,'2016-12-20 11:02:12.000000',1,'2016-12-20 11:02:12.000000',1),
(9,'Manual Adjustment','MANUAL-ADJUSTMENT',1,7,1,1,'2016-12-20 11:02:12.000000',1,'2016-12-20 11:02:12.000000',1);
|
angular.module('africaXpress')
.controller('ShopController', function($scope, Item){
$scope.allItems;
$scope.getAll = function () {
Item.getAll().success(function(data){
$scope.allItems = data
});
};
$scope.getAll();
});
|
var REGEX = require('REGEX'),
<API key> = 30,
create = require('DIV/create');
var parseString = function(parentTagName, htmlStr) {
var parent = create(parentTagName);
parent.innerHTML = htmlStr;
return parent;
};
var parseSingleTag = function(htmlStr) {
if (htmlStr.length > <API key>) { return null; }
var singleTagMatch = REGEX.singleTagMatch(htmlStr);
return singleTagMatch ? [create(singleTagMatch[1])] : null;
};
module.exports = function(htmlStr) {
var singleTag = parseSingleTag(htmlStr);
if (singleTag) { return singleTag; }
var parentTagName = REGEX.getParentTagName(htmlStr),
parent = parseString(parentTagName, htmlStr);
var child,
idx = parent.children.length,
arr = Array(idx);
while (idx
child = parent.children[idx];
parent.removeChild(child);
arr[idx] = child;
}
parent = null;
return arr.reverse();
};
|
<<<< HEAD
====
<header class="hide-on-large-only">
<img src="{{"assets/img/logo-mds-big.png"}}" alt="" style="width: 100%;">
</header>
>>>> <SHA1-like>
|
// <API key> - This is a specific watch for a resource use
// policy trigger.
package <API key>
// DO NOT EDIT. THIS FILE WAS AUTOMATICALLY GENERATED
|
package seedu.jobs.logic.commands;
import java.io.IOException;
import com.google.common.eventbus.Subscribe;
import seedu.jobs.commons.core.EventsCenter;
import seedu.jobs.commons.events.storage.<API key>;
/* Change save path
*/
//@@author A0130979U
public class PathCommand extends Command {
public static final String COMMAND_WORD = "path";
public static final String MESSAGE_USAGE = COMMAND_WORD + ": Change save path. "
+ "Parameters: path [filename] \n"
+ "Example: " + COMMAND_WORD
+ " taskbook.xml";
private String path;
private boolean isValid;
public static final String MESSAGE_SUCCESS = "Save path has been successfully updated \n";
public static final String <API key> = "This path is invalid";
public PathCommand(String path) {
this.path = path;
this.isValid = true;
EventsCenter.getInstance().registerHandler(this);
}
@Override
public CommandResult execute() throws IOException {
assert model != null;
model.changePath(path);
if (!isValid) {
throw new IOException(<API key>);
}
return new CommandResult(String.format(MESSAGE_SUCCESS));
}
@Subscribe
public void <API key>(<API key> event) {
isValid = false;
}
}
//@@author
|
import { module, test } from "qunit";
import argvInjector from "inject-loader?nwjs/App!nwjs/argv";
module( "nwjs/argv" );
test( "Default values", assert => {
const argv = argvInjector({
"nwjs/App": {
argv: []
}
});
assert.propEqual(
argv.argv,
{
"_": [],
"tray": false,
"hide": false,
"hidden": false,
"max": false,
"maximize": false,
"maximized": false,
"min": false,
"minimize": false,
"minimized": false,
"reset-window": false,
"versioncheck": true,
"version-check": true,
"logfile": true,
"loglevel": "",
"l": "",
"goto": "",
"launch": ""
},
"Has the correct parameters"
);
assert.deepEqual(
Object.keys( argv ).sort(),
[
"argv",
"parseCommand",
"ARG_GOTO",
"ARG_LAUNCH",
"ARG_LOGFILE",
"ARG_LOGLEVEL",
"ARG_MAX",
"ARG_MIN",
"ARG_RESET_WINDOW",
"ARG_TRAY",
"ARG_VERSIONCHECK"
].sort(),
"Exports the correct constants"
);
});
test( "Custom parameters", assert => {
const { argv } = argvInjector({
"nwjs/App": {
argv: [
// boolean without values
"--tray",
"--max",
"--min",
"--reset-window",
// boolean with "no-" prefix
"--no-versioncheck",
// boolean with value
"--logfile=false",
// string
"--loglevel",
"debug",
"--goto",
"foo",
"--launch",
"bar",
"positional"
]
}
});
assert.propEqual(
argv,
{
"_": [ "positional" ],
"tray": true,
"hide": true,
"hidden": true,
"max": true,
"maximize": true,
"maximized": true,
"min": true,
"minimize": true,
"minimized": true,
"reset-window": true,
"versioncheck": false,
"version-check": false,
"logfile": false,
"loglevel": "debug",
"l": "debug",
"goto": "foo",
"launch": "bar"
},
"Has the correct parameters"
);
});
test( "Aliases", assert => {
const { argv } = argvInjector({
"nwjs/App": {
argv: [
"--hide",
"--maximize",
"--minimize",
"--no-version-check",
"-l",
"debug"
]
}
});
assert.propEqual(
argv,
{
"_": [],
"tray": true,
"hide": true,
"hidden": true,
"max": true,
"maximize": true,
"maximized": true,
"min": true,
"minimize": true,
"minimized": true,
"reset-window": false,
"versioncheck": false,
"version-check": false,
"logfile": true,
"loglevel": "debug",
"l": "debug",
"goto": "",
"launch": ""
},
"Has the correct parameters"
);
});
test( "Parse command", assert => {
const { parseCommand } = argvInjector({
"nwjs/App": {
argv: [],
manifest: {
"chromium-args": "--foo --bar"
}
}
});
assert.propEqual(
// this is unfortunately how NW.js passes through the command line string from second
// application starts: parameters with leading dashes get moved to the beginning
parseCommand([
"/path/to/executable",
"--goto",
"--<API key>",
"--foo",
"--bar",
"--user-data-dir=baz",
"--no-sandbox",
"--no-zygote",
"--flag-switches-begin",
"--flag-switches-end",
"foo"
].join( " " ) ),
{
"_": [],
"tray": false,
"hide": false,
"hidden": false,
"max": false,
"maximize": false,
"maximized": false,
"min": false,
"minimize": false,
"minimized": false,
"reset-window": false,
"versioncheck": true,
"version-check": true,
"logfile": true,
"loglevel": "",
"l": "",
"goto": "foo",
"launch": ""
},
"Correctly parses parameters"
);
});
|
// AppController.h
// Spotify Menubar
// This software is distributed under licence. Use of this software
// implies agreement with all terms and conditions of the accompanying
// software licence.
#import <Cocoa/Cocoa.h>
#import <ShortcutRecorder/ShortcutRecorder.h>
#import <SDGlobalShortcuts/SDGlobalShortcuts.h>
@interface AppController : NSObject {
NSOperationQueue *queue;
NSTimer *spotifyChecker;
// Process Stuff
int numberOfProcesses;
NSMutableArray *processList;
int processID;
IBOutlet NSTextField *textfield;
int _selectedPID;
int _lastAttachedPID;
CGEventSourceRef theSource;
// Status menu stuff
NSStatusItem *statusItem;
NSStatusItem *playItem;
NSStatusItem *fwrdItem;
NSStatusItem *backItem;
IBOutlet NSView *statusView;
IBOutlet NSMenu *statusMenu;
// Interface Stuff
IBOutlet NSWindow *welcomeWindow;
IBOutlet SRRecorderControl *playPauseRecorder;
IBOutlet SRRecorderControl *skipForwardRecorder;
IBOutlet SRRecorderControl *skipBackRecorder;
KeyCombo ppGlobalHotkey;
KeyCombo sfGlobalHotkey;
KeyCombo sbGlobalHotkey;
IBOutlet NSButton *showDockIcon;
IBOutlet NSButton *showMenubarIcon;
IBOutlet NSButton *openAtLogin;
IBOutlet NSButton *showWelcomeWindow;
IBOutlet NSButton *openSpotifyOnLaunch;
IBOutlet NSButton *<API key>;
// Hidden Interface Stuff
IBOutlet NSButton *playPauseButton;
IBOutlet NSButton *skipForwardButton;
IBOutlet NSButton *skipBackButton;
// Preferences Stuff
IBOutlet NSWindow *prefWindow;
NSView *currentView;
IBOutlet NSView *prefContentView;
IBOutlet NSView *generalView;
IBOutlet NSView *shortcutsView;
IBOutlet NSView *helpView;
IBOutlet NSView *aboutView;
IBOutlet NSView *simbleView;
IBOutlet NSToolbar *prefToolbar;
IBOutlet NSToolbarItem *generalToolbarItem;
IBOutlet NSToolbarItem *<API key>;
IBOutlet NSToolbarItem *advancedToolbarItem;
IBOutlet NSToolbarItem *helpToolbarItem;
IBOutlet NSToolbarItem *aboutToolbarItem;
IBOutlet NSToolbarItem *simblToolbarItem;
IBOutlet NSPopUpButton *menubarIconStyle;
}
- (int)numberOfProcesses;
- (void)<API key>;
- (BOOL)findProcessWithName:(NSString *)procNameToSearch;
- (IBAction)checkForProcesses:(id)sender;
- (IBAction)<API key>:(id)sender;
- (ProcessSerialNumber)<API key>;
- (CGEventSourceRef)source;
- (NSOperationQueue *)operationQueue;
- (void)<API key>;
- (BOOL)isSpotifyActive;
- (void)<API key>;
- (void)<API key>;
- (void)<API key>;
- (void)pressHotkey: (int)hotkey withModifier: (unsigned int)modifier;
- (IBAction)openPreferences:(id)sender;
- (IBAction)<API key>:(id)sender;
- (IBAction)resetKeybinds:(id)sender;
- (IBAction)toggleOpenAtLogin:(id)sender;
- (void)<API key>;
- (IBAction)toggleMiniControls:(id)sender;
- (IBAction)<API key>:(id)sender;
- (IBAction)openAboutWindow:(id)sender;
- (IBAction)<API key>:(id)sender;
- (void)loadView:(NSView *)theView;
- (IBAction)sendPlayPause:(id)sender;
- (IBAction)sendSkipForward:(id)sender;
- (IBAction)sendSkipBack:(id)sender;
- (IBAction)sendKeystroke:(id)sender;
- (IBAction)<API key>:(id)sender;
- (IBAction)openURLLifeUpNorth:(id)sender;
- (IBAction)sendLUNemail:(id)sender;
- (IBAction)openUrlSimbl:(id)sender;
- (IBAction)openUrlLunPlugin:(id)sender;
- (void)setStatusItem;
- (void)addAppAsLoginItem;
- (void)<API key>;
- (IBAction)<API key>:(id)sender;
- (BOOL)shouldBeUIElement;
- (void)<API key>:(BOOL)hidden;
@end
|
<section data-ng-controller="Page1Controller">
<md-grid-list
md-cols-sm="1" md-cols-md="2" md-cols-gt-md="6"
md-row-height-gt-md="1:1" md-row-height="2:2"
md-gutter="12px" md-gutter-gt-sm="8px" >
<md-grid-tile class="red" md-rowspan="1" md-colspan="2">
<md-grid-tile-footer>
<h3>TODAY</h3>
</md-grid-tile-footer>
</md-grid-tile>
<md-grid-tile class="green" md-rowspan="1" md-colspan="2">
<h1 class="md-display-3">70%</h1>
<md-grid-tile-footer>
<h3>YESTERDAY</h3>
</md-grid-tile-footer>
</md-grid-tile>
<md-grid-tile class="yellow" md-rowspan="1" md-colspan="2">
<h1 class="md-display-3">40%</h1>
<md-grid-tile-footer>
<h3>LAST WEEK</h3>
</md-grid-tile-footer>
</md-grid-tile>
</md-grid-list>
</section>
|
package mobi.qubits.tradingapp.query;
import java.util.Date;
import org.springframework.data.annotation.Id;
public class QuoteEntity {
@Id
private String id;
private String symbol;
private String name;
private float open;
private float prevClose;
private float currentQuote;
private float high;
private float low;
private String date;
private String quoteTime;
private Date timestamp;
public QuoteEntity() {
super();
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getSymbol() {
return symbol;
}
public void setSymbol(String symbol) {
this.symbol = symbol;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public float getOpen() {
return open;
}
public void setOpen(float open) {
this.open = open;
}
public float getPrevClose() {
return prevClose;
}
public void setPrevClose(float prevClose) {
this.prevClose = prevClose;
}
public float getCurrentQuote() {
return currentQuote;
}
public void setCurrentQuote(float currentQuote) {
this.currentQuote = currentQuote;
}
public float getHigh() {
return high;
}
public void setHigh(float high) {
this.high = high;
}
public float getLow() {
return low;
}
public void setLow(float low) {
this.low = low;
}
public String getDate() {
return date;
}
public void setDate(String date) {
this.date = date;
}
public String getQuoteTime() {
return quoteTime;
}
public void setQuoteTime(String quoteTime) {
this.quoteTime = quoteTime;
}
public Date getTimestamp() {
return timestamp;
}
public void setTimestamp(Date timestamp) {
this.timestamp = timestamp;
}
}
|
#!/usr/bin/python
""" fanhaorename.py
"""
import os
import os.path
import logging
import fileorganizer
from fileorganizer import _helper
from fileorganizer.replacename import _replacename
__author__ = "Jack Chang <wei0831@gmail.com>"
def _tagHelper(tag):
""" TODO
"""
result = ""
for c in tag:
if c.isalpha():
result += "[{0}{1}]".format(c.lower(), c.upper())
else:
result += c
return result
def fanhaorename(work_dir,
tag,
exclude=None,
mode=0,
wetrun=False,
this_name=os.path.basename(__file__)):
""" Batch Rename Fanhao
\b
Args:
work_dir (str): Working Directory
tag (str): Fanhao tag
find (str, optional): Regex string to find in filename/foldername
replace (str, optional): Regex string to replace in filename/foldername
exclude (str, optional): Regex string to exclude in mattches
mode (int, optional): 0=FILE ONLY, 1=FOLDER ONLY, 2=BOTH
wetrun (bool, optional): Test Run or not
"""
_find_dir = r"(.*)({0})(-|_| )*(\d\d\d)(.*)".format(_tagHelper(tag))
_replace_dir = r"{0}-\4".format(tag)
_find_file = _find_dir + r"(\.(.*))"
_replace_file = _replace_dir + r"\6"
_helper.init_loger()
this_run = "WET" if wetrun else "DRY"
loger = logging.getLogger(this_name)
loger.info("[START] === %s [%s RUN] ===", this_name, this_run)
loger.info("[DO] Rename \"%s\" fanhao in \"%s\"; Mode %s", tag, work_dir,
mode)
if mode in (0, 2): # mode 0 and 2
for item in _replacename(_find_file, _replace_file, work_dir, 0,
exclude):
item.commit() if wetrun else loger.info("%s", item)
if mode in (1, 2): # mode 1 and 2
for item in _replacename(_find_dir, _replace_dir, work_dir, 1,
exclude):
item.commit() if wetrun else loger.info("%s", item)
loger.info("[END] === %s [%s RUN] ===", this_name, this_run)
if __name__ == "__main__":
fileorganizer.cli.cli_fanhaorename()
|
<?php namespace Mitch\EventDispatcher;
class Dispatcher
{
private $listeners = [];
public function dispatch($event)
{
if (is_array($event)) {
$this->fireEvents($event);
return;
}
$this->fireEvent($event);
}
public function addListener($name, Listener $listener)
{
$this->listeners[$name][] = $listener;
}
private function fireEvents(array $events)
{
foreach ($events as $event) {
$this->fireEvent($event);
}
}
private function fireEvent(Event $event)
{
$listeners = $this->getListeners($event->getName());
if ( ! $listeners) {
return;
}
foreach ($listeners as $listener) {
$listener->handle($event);
}
}
private function getListeners($name)
{
if ( ! $this->hasListeners($name)) {
return;
}
return $this->listeners[$name];
}
private function hasListeners($name)
{
return isset($this->listeners[$name]);
}
}
|
using System;
using System.Runtime.InteropServices;
namespace UnityMathReference
{
[StructLayout(LayoutKind.Sequential)]
public struct Point3
{
#region Properties
public int x, y, z;
public static readonly Point3 one = new Point3(1);
public static readonly Point3 minusOne = new Point3(-1);
public static readonly Point3 zero = new Point3();
public static readonly Point3 right = new Point3(1, 0, 0);
public static readonly Point3 left = new Point3(-1, 0, 0);
public static readonly Point3 up = new Point3(0, 1, 0);
public static readonly Point3 down = new Point3(0, -1, 0);
public static readonly Point3 forward = new Point3(0, 0, 1);
public static readonly Point3 backward = new Point3(0, 0, -1);
#endregion
#region Constructors
public Point3(int value)
{
x = value;
y = value;
z = value;
}
public Point3(int x, int y, int z)
{
this.x = x;
this.y = y;
this.z = z;
}
public Point3(Point2 point, int z)
{
x = point.x;
y = point.y;
this.z = z;
}
#endregion
#region Operators
public static Point3 operator+(Point3 p1, Point3 p2)
{
return new Point3(p1.x + p2.x, p1.y + p2.y, p1.z + p2.z);
}
public static Point3 operator+(Point3 p1, Point2 p2)
{
return new Point3(p1.x + p2.x, p1.y + p2.y, p1.z);
}
public static Point3 operator+(Point2 p1, Point3 p2)
{
return new Point3(p1.x + p2.x, p1.y + p2.y, p2.z);
}
public static Point3 operator+(Point3 p1, int p2)
{
return new Point3(p1.x + p2, p1.y + p2, p1.z + p2);
}
public static Point3 operator+(int p1, Point3 p2)
{
return new Point3(p1 + p2.x, p1 + p2.y, p1 + p2.z);
}
public static Point3 operator-(Point3 p1, Point3 p2)
{
return new Point3(p1.x - p2.x, p1.y - p2.y, p1.z - p2.z);
}
public static Point3 operator-(Point3 p1, Point2 p2)
{
return new Point3(p1.x - p2.x, p1.y - p2.y, p1.z);
}
public static Point3 operator-(Point2 p1, Point3 p2)
{
return new Point3(p1.x - p2.x, p1.y - p2.y, p2.z);
}
public static Point3 operator-(Point3 p1, int p2)
{
return new Point3(p1.x - p2, p1.y - p2, p1.z - p2);
}
public static Point3 operator-(int p1, Point3 p2)
{
return new Point3(p1 - p2.x, p1 - p2.y, p1 - p2.z);
}
public static Point3 operator-(Point3 p2)
{
return new Point3(-p2.x, -p2.y, -p2.z);
}
public static Point3 operator*(Point3 p1, Point3 p2)
{
return new Point3(p1.x * p2.x, p1.y * p2.y, p1.z * p2.z);
}
public static Point3 operator*(Point3 p1, Point2 p2)
{
return new Point3(p1.x * p2.x, p1.y * p2.y, p1.z);
}
public static Point3 operator*(Point2 p1, Point3 p2)
{
return new Point3(p1.x * p2.x, p1.y * p2.y, p2.z);
}
public static Point3 operator*(Point3 p1, int p2)
{
return new Point3(p1.x * p2, p1.y * p2, p1.z * p2);
}
public static Point3 operator*(int p1, Point3 p2)
{
return new Point3(p1 * p2.x, p1 * p2.y, p1 * p2.z);
}
public static Point3 operator/(Point3 p1, Point3 p2)
{
return new Point3(p1.x / p2.x, p1.y / p2.y, p1.z / p2.z);
}
public static Point3 operator/(Point3 p1, Point2 p2)
{
return new Point3(p1.x / p2.x, p1.y / p2.y, p1.z);
}
public static Point3 operator/(Point2 p1, Point3 p2)
{
return new Point3(p1.x / p2.x, p1.y / p2.y, p2.z);
}
public static Point3 operator/(Point3 p1, int p2)
{
return new Point3(p1.x / p2, p1.y / p2, p1.z / p2);
}
public static Point3 operator/(int p1, Point3 p2)
{
return new Point3(p1 / p2.x, p1 / p2.y, p1 / p2.z);
}
public static bool operator==(Point3 p1, Point3 p2) {return p1.x==p2.x && p1.y==p2.y && p1.z==p2.z;}
public static bool operator!=(Point3 p1, Point3 p2) {return p1.x!=p2.x || p1.y!=p2.y || p1.z!=p2.z;}
// convert
public Point2 ToPoint2()
{
return new Point2(x, y);
}
public Vec2 ToVec2()
{
return new Vec2(x, y);
}
public Vec3 ToVec3()
{
return new Vec3(x, y, z);
}
#endregion
#region Methods
public override bool Equals(object obj)
{
return obj != null && (Point3)obj == this;
}
public override string ToString()
{
return string.Format("<{0}, {1}, {2}>", x, y, z);
}
public override int GetHashCode()
{
return base.GetHashCode();
}
public bool Intersects(Rect3 rect)
{
return x >= rect.left && x <= rect.right && y >= rect.bottom && y <= rect.top && z >= rect.back && z <= rect.front;
}
public void Intersects(Rect3 rect, out bool result)
{
result = x >= rect.left && x <= rect.right && y >= rect.bottom && y <= rect.top && z >= rect.back && z <= rect.front;
}
public bool Intersects(Bound3 boundingBox)
{
return x >= boundingBox.left && x <= boundingBox.right && y >= boundingBox.bottom && y <= boundingBox.top && z >= boundingBox.back && z <= boundingBox.front;
}
public void Intersects(Bound3 boundingBox, out bool result)
{
result = x >= boundingBox.left && x <= boundingBox.right && y >= boundingBox.bottom && y <= boundingBox.top && z >= boundingBox.back && z <= boundingBox.front;
}
#endregion
}
}
|
<!DOCTYPE HTML PUBLIC "-
<!--NewPage
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.5.0_13) on Sun Jan 24 12:52:50 EST 2010 -->
<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<TITLE>
Uses of Class edu.uci.ics.jung.io.graphml.GraphMLReader2 (jung2 2.0.1 API)
</TITLE>
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../../../stylesheet.css" TITLE="Style">
<SCRIPT type="text/javascript">
function windowTitle()
{
parent.document.title="Uses of Class edu.uci.ics.jung.io.graphml.GraphMLReader2 (jung2 2.0.1 API)";
}
</SCRIPT>
<NOSCRIPT>
</NOSCRIPT>
</HEAD>
<BODY BGCOLOR="white" onload="windowTitle();">
<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="../../../../../../../edu/uci/ics/jung/io/graphml/GraphMLReader2.html" title="class in edu.uci.ics.jung.io.graphml"><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?edu/uci/ics/jung/io/graphml//<API key>.html" target="_top"><B>FRAMES</B></A>
<A HREF="GraphMLReader2.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>edu.uci.ics.jung.io.graphml.GraphMLReader2</B></H2>
</CENTER>
No usage of edu.uci.ics.jung.io.graphml.GraphMLReader2
<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="../../../../../../../edu/uci/ics/jung/io/graphml/GraphMLReader2.html" title="class in edu.uci.ics.jung.io.graphml"><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?edu/uci/ics/jung/io/graphml//<API key>.html" target="_top"><B>FRAMES</B></A>
<A HREF="GraphMLReader2.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>
Copyright © 2010 null. All Rights Reserved.
</BODY>
</HTML>
|
<?php
namespace AppBundle\Form;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\<API key>;
use Symfony\Component\OptionsResolver\<API key>;
class OrganizationType extends AbstractType
{
/**
* @param <API key> $builder
* @param array $options
*/
public function buildForm(<API key> $builder, array $options)
{
$builder
->add('organizationName')
->add('<API key>')
->add('organizationPhone')
->add('<API key>')
;
}
/**
* @param <API key> $resolver
*/
public function setDefaultOptions(<API key> $resolver)
{
$resolver->setDefaults(array(
'data_class' => 'AppBundle\Entity\Organization'
));
}
/**
* @return string
*/
public function getName()
{
return '<API key>';
}
}
|
using System;
namespace Frog.Orm
{
[AttributeUsage(AttributeTargets.Property)]
public sealed class PrimaryKeyAttribute : Attribute
{
public string Name { get; set; }
}
}
|
import * as React from './dfvReact'
import { dfvFront } from "./dfvFront";
export interface PopWindowPara {
notCover?: boolean;
isErr?: boolean;
closeTime?: number;
}
export class dfvWindow {
private dialog: HTMLDivElement | undefined;
//cover
private divCover: HTMLDivElement | undefined;
private divContent: HTMLDivElement | undefined;
static coverZ = 999;
constructor() {
dfvWindow.coverZ++;
}
/**
*
* @returns {dfvWindow}
*/
addCover() {
if (!this.divCover) {
this.divCover = document.createElement("div");
this.divCover.className = "cover_div cover_black"
this.divCover.style.zIndex = dfvWindow.coverZ + "";
document.body.appendChild(this.divCover);
}
return this;
}
/**
* PopWindowPara
* @param para
* @returns {dfvWindow}
*/
procParas(para: PopWindowPara) {
if (para && para.closeTime! > 0) {
this.autoClose(para.closeTime)
}
this.isError = para.isErr!!;
if (!para.notCover)
this.addCover();
return this;
}
/**
*
* @type {boolean}
*/
isError = false;
/**
*
* @param title
* @param content
* @returns {dfvWindow}
*/
public show(title: string | HTMLElement, content?: string | HTMLElement | null) {
if (this.dialog)
return this;
let c1 = this.isError ? "ba_tra_red" : "ba_tra_blue"
let c2 = this.isError ? "icon_err" : "icon_close"
this.dialog =
<div className={"pop_border anim_in " + c1}>
{
this.divContent =
<div className="pop_cont">
<div className="vmid pad5">
{title}
</div>
{content ? <div style="margin-top: 10px">{content}</div> : null}
</div>
}
<div className="absol_close">
<tt onclick={() => this.onButtonCancelClick()}
className={"rotate_hover " + c2} />
</div>
</div>
this.dialog!.style.zIndex = (dfvWindow.coverZ + 1) + "";
document.body.appendChild(this.dialog!);
this.reSize();
this.resizeTime = setInterval(this.reSize, 200);
return this;
}
/**
*
* @param title
* @param content
* @param onOk
* @returns {dfvWindow}
*/
public showWithOk(title: string | HTMLElement,
content: string | HTMLElement | null,
onOk: (e: HTMLElement) => void) {
this.show(title, this.okWindow(content, onOk))
return this;
}
onButtonCancelClick = () => {
this.close();
}
/**
*
* @param time
* @returns {dfvWindow}
*/
autoClose(time: number = 3000) {
setTimeout(() => {
this.close()
}, time);
return this;
}
close = () => {
try {
clearInterval(this.resizeTime);
if (!this.divContent || !this.dialog) {
return;
}
if (this.divCover) {
try {
document.body.removeChild(this.divCover);
} catch (e) {
}
}
this.divCover = null as any;
this.divContent = null as any;
let dia = this.dialog;
this.dialog = undefined;
if (window.history.pushState != null) {
dia.className += " anim_out";
setTimeout(() => {
try {
document.body.removeChild(dia);
} catch (e) {
}
}, 300)
} else {
try {
document.body.removeChild(dia);
} catch (e) {
}
}
} catch (e) {
dfvFront.onCatchError(e)
}
}
private reSize = () => {
if (!this.dialog || !this.divContent)
return;
if (this.dialog.offsetWidth < document.documentElement!.clientWidth) {
let w = document.documentElement!.clientWidth - this.dialog.offsetWidth;
this.dialog.style.marginLeft = ((w >> 1) & (~3)) + "px";
}
this.divContent.style.maxWidth = document.documentElement!.clientWidth - 40 + "px";
if (this.dialog.offsetHeight < document.documentElement!.clientHeight) {
let h = (Math.floor((document.documentElement!.clientHeight - this.dialog.offsetHeight) / 3));
h = h & (~3);
this.dialog.style.marginTop = h + "px";
}
this.divContent.style.maxHeight = document.documentElement!.clientHeight - 45 + "px";
}
private resizeTime: any;
/**
*
* @type {string}
*/
buttonOkText = "";
private okWindow(content: string | HTMLElement | null, onOk: (e: HTMLElement) => void) {
return (
<div>
<div>
{content}
</div>
<div class="h_m">
<button class="button_blue pad6-12 mar5t font_0 bold" onclick={e => onOk(e.currentTarget)}>
{this.buttonOkText}
</button>
</div>
</div>
)
}
}
|
namespace Teleimot.Web.Api.Mapping
{
using AutoMapper;
public interface IHaveCustomMappings
{
void CreateMappings(IConfiguration configuration);
}
}
|
module.exports.default = undefined;
|
var tpl = [
'<div id="{uuid}" class="datepicker ui-d-n">',
' <div class="datepicker__mask"></div>',
' <div class="datepicker__main">',
' <div class="datepicker__header">',
' <div class="<API key>"></div>',
' <div class="<API key>">',
' <div class="<API key>">',
' <a href="javascript:;" class="<API key> <API key>" id="_j_year_prev"><</a>',
' <a href="javascript:;" class="<API key>" id="_j_year_text">{year}</a>',
' <a href="javascript:;" class="<API key> <API key>" id="_j_year_next">></a>',
' </div>',
' <div class="<API key>">',
' <a href="javascript:;" class="<API key> <API key>" id="_j_month_prev"><</a>',
' <a href="javascript:;" class="<API key>" id="_j_month_text">{month}</a>',
' <a href="javascript:;" class="<API key> <API key>" id="_j_month_next" >></a>',
' </div>',
' </div>',
' </div>',
' <div class="datepicker__panel">',
' <ul class="<API key>">',
' <li class="<API key>"></li>',
' <li class="<API key>"></li>',
' <li class="<API key>"></li>',
' <li class="<API key>"></li>',
' <li class="<API key>"></li>',
' <li class="<API key>"></li>',
' <li class="<API key>"></li>',
' </ul>',
' <div class="<API key>">',
' <ul class="<API key> <API key>">',
' {all_days}',
' </ul>',
' </div>',
' </div>',
' ',
' <div class="datepicker__footer">',
' <div class="datepicker__btn" id="_j_confirm_btn"></div>',
' <div class="datepicker__btn" id="_j_cancel_btn"></div>',
' </div>',
' </div>',
'</div>'
].join("");
module.exports = tpl;
|
<?php
namespace Nf;
class Db
{
const FETCH_ASSOC = 2;
const FETCH_NUM = 3;
const FETCH_OBJ = 5;
const FETCH_COLUMN = 7;
private static $_connections = array();
public static $<API key> = null;
public static function factory($config)
{
if (! is_array($config)) {
// convert to an array
$conf = array();
$conf['adapter'] = $config->adapter;
$conf['params'] = (array) $config->params;
$conf['profiler'] = (array) $config->profiler;
} else {
$conf = $config;
}
$adapterName = get_class() . '\\Adapter\\' . $conf['adapter'];
$dbAdapter = new $adapterName($conf['params']);
$dbAdapter->setProfilerConfig($conf['profiler']);
return $dbAdapter;
}
public static function getConnection($configName, $alternateHostname = null, $alternateDatabase = null, $storeInInstance = true)
{
$config = \Nf\Registry::get('config');
if (!isset($config->db->$configName)) {
throw new \Exception('The adapter "' . $configName . '" is not defined in the config file');
}
if (self::$<API key> !== null) {
$storeInInstance = self::$<API key>;
}
$defaultHostname = $config->db->$configName->params->hostname;
$defaultDatabase = $config->db->$configName->params->database;
$hostname = ($alternateHostname !== null) ? $alternateHostname : $defaultHostname;
$database = ($alternateDatabase !== null) ? $alternateDatabase : $defaultDatabase;
if (isset($config->db->$configName->params->port)) {
$port = $config->db->$configName->params->port;
} else {
$port = null;
}
// if the connection has already been created and if we store the connection in memory for future use
if (isset(self::$_connections[$configName . '-' . $hostname . '-' . $database]) && $storeInInstance) {
return self::$_connections[$configName . '-' . $hostname . '-' . $database];
} else {
// optional profiler config
$profilerConfig = isset($config->db->$configName->profiler) ? (array)$config->db->$configName->profiler : null;
if ($profilerConfig != null) {
$profilerConfig['name'] = $configName;
}
// or else we create a new connection
$dbConfig = array(
'adapter' => $config->db->$configName->adapter,
'params' => array(
'hostname' => $hostname,
'port' => $port,
'username' => $config->db->$configName->params->username,
'password' => $config->db->$configName->params->password,
'database' => $database,
'charset' => $config->db->$configName->params->charset
),
'profiler' => $profilerConfig
);
// connection with the factory method
$dbConnection = self::factory($dbConfig);
if ($storeInInstance) {
self::$_connections[$configName . '-' . $hostname . '-' . $database] = $dbConnection;
}
return $dbConnection;
}
}
}
|
var Task = require('../models/task') ;
//add task
exports.addTask = function(req,res){
var title = req.body.title,
content = req.body.content,
date = req.body.date,
duration = req.body.duration,
done = req.body.done,
frequency = req.body.frequency ;
Task.addTask(title,content,date,duration,frequency,done,function(task){
res.json({'status':1,'task':task}) ;
},function(object,error){
res.json({'status':0,'message':error}) ;
}) ;
} ;
//update task
exports.updateTask = function(req,res){
var id = req.params.task_id,
title = req.body.title,
content = req.body.content,
date = req.body.date,
duration = req.body.duration,
frequency = req.body.frequency,
done = req.body.done;
Task.updateTask(id,title,content,date,duration,frequency,done,function(task){
res.json({'status':1,'task':task}) ;
},function(object,error){
res.json({'status':0,'message':error}) ;
}) ;
} ;
//get all tasks
exports.getAllTasks = function(req,res){
Task.findAll(function(tasks){
console.log(tasks.length) ;
res.json({'status':1,'tasks':tasks}) ;
},function(error){
res.json({'status':0,'message':error}) ;
}) ;
} ;
//get task by id
exports.getTaskById = function(req,res){
var id = req.params.task_id ;
Task.findById(id,function(task){
res.json({'status':1,'task':task}) ;
},function(error){
res.json({'status':0,'message':error}) ;
}) ;
} ;
//delete task by id
exports.deleteTask = function(req,res){
var id = req.params.task_id ;
Task.delete(id,function(task){
res.json({'status':1,'task':task}) ;
},function(error){
res.json({'status':0,'message':error}) ;
}) ;
} ;
|
<?php namespace App\Models\Soundcloud;
use App\Models\SocialModel;
class User extends SocialModel {
protected $table = '<API key>';
}
|
(function () {
'use strict';
angular
.module('password', [
'ngMaterial',
/*@@DIST-TEMPLATE-CACHE*/
'ngRoute',
'password.analytics',
'password.title',
'password.nav',
'password.welcome',
'password.forgot',
'password.recovery',
'password.change',
'password.profile',
'password.mfa',
'password.reset',
'password.help',
'password.logo'
]);
})();
|
<!DOCTYPE html>
<html>
<head>
<meta content="text/html;charset=utf-8" http-equiv="Content-Type">
<meta content="utf-8" http-equiv="encoding">
<meta http-equiv="refresh" content="5; url={{.SiteName}}/">
<title>Creating Site - Renfish</title>
{{template "Header" .}}
</head>
<body>
{{template "Topbar" .}}
<div class="body-content">
Creating Site...
</div>
<br>
<br>
{{template "Bottombar"}}
</body>
</html>
|
<?php
namespace LaravelBox\Commands\Files;
use GuzzleHttp\Client;
use GuzzleHttp\Exception\ClientException;
use GuzzleHttp\Exception\ServerException;
use GuzzleHttp\Exception\RequestException;
use GuzzleHttp\Exception\TransferException;
use LaravelBox\Factories\ApiResponseFactory;
class DownloadFileCommand extends AbstractFileCommand
{
private $downloadPath;
public function __construct(string $token, string $local, string $remote)
{
$this->downloadPath = $local;
$this->token = $token;
$this->fileId = parent::getFileId($remote);
$this->folderId = parent::getFolderId(dirname($remote));
}
public function execute()
{
$fileId = $this->fileId;
$token = $this->token;
$url = "https://api.box.com/2.0/files/${fileId}/content";
$options = [
'sink' => fopen($this->downloadPath, 'w'),
'headers' => [
'Authorization' => "Bearer ${token}",
],
];
try {
$client = new Client();
$resp = $client->request('GET', $url, $options);
return ApiResponseFactory::build($resp);
} catch (ClientException $e) {
return ApiResponseFactory::build($e);
} catch (ServerException $e) {
return ApiResponseFactory::build($e);
} catch (TransferException $e) {
return ApiResponseFactory($e);
} catch (RequestException $e) {
return ApiResponseFactory($e);
}
}
}
|
/*
* Testcase: Check whether prime import/export works on the same device
*
* ... but with different fds, i.e. the wayland usecase.
*/
#define _GNU_SOURCE
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <fcntl.h>
#include <inttypes.h>
#include <errno.h>
#include <sys/stat.h>
#include <sys/ioctl.h>
#include <pthread.h>
#include "drm.h"
#include "ioctl_wrappers.h"
#include "drmtest.h"
#include "igt_debugfs.h"
#define BO_SIZE (16*1024)
static char counter;
volatile int pls_die = 0;
static void
check_bo(int fd1, uint32_t handle1, int fd2, uint32_t handle2)
{
char *ptr1, *ptr2;
int i;
ptr1 = gem_mmap(fd1, handle1, BO_SIZE, PROT_READ | PROT_WRITE);
ptr2 = gem_mmap(fd2, handle2, BO_SIZE, PROT_READ | PROT_WRITE);
igt_assert(ptr1);
/* check whether it's still our old object first. */
for (i = 0; i < BO_SIZE; i++) {
igt_assert(ptr1[i] == counter);
igt_assert(ptr2[i] == counter);
}
counter++;
memset(ptr1, counter, BO_SIZE);
igt_assert(memcmp(ptr1, ptr2, BO_SIZE) == 0);
munmap(ptr1, BO_SIZE);
munmap(ptr2, BO_SIZE);
}
static void test_with_fd_dup(void)
{
int fd1, fd2;
uint32_t handle, handle_import;
int dma_buf_fd1, dma_buf_fd2;
counter = 0;
fd1 = drm_open_any();
fd2 = drm_open_any();
handle = gem_create(fd1, BO_SIZE);
dma_buf_fd1 = prime_handle_to_fd(fd1, handle);
gem_close(fd1, handle);
dma_buf_fd2 = dup(dma_buf_fd1);
close(dma_buf_fd1);
handle_import = prime_fd_to_handle(fd2, dma_buf_fd2);
check_bo(fd2, handle_import, fd2, handle_import);
close(dma_buf_fd2);
check_bo(fd2, handle_import, fd2, handle_import);
close(fd1);
close(fd2);
}
static void test_with_two_bos(void)
{
int fd1, fd2;
uint32_t handle1, handle2, handle_import;
int dma_buf_fd;
counter = 0;
fd1 = drm_open_any();
fd2 = drm_open_any();
handle1 = gem_create(fd1, BO_SIZE);
handle2 = gem_create(fd1, BO_SIZE);
dma_buf_fd = prime_handle_to_fd(fd1, handle1);
handle_import = prime_fd_to_handle(fd2, dma_buf_fd);
close(dma_buf_fd);
gem_close(fd1, handle1);
dma_buf_fd = prime_handle_to_fd(fd1, handle2);
handle_import = prime_fd_to_handle(fd2, dma_buf_fd);
check_bo(fd1, handle2, fd2, handle_import);
gem_close(fd1, handle2);
close(dma_buf_fd);
check_bo(fd2, handle_import, fd2, handle_import);
close(fd1);
close(fd2);
}
static void <API key>(void)
{
int fd1, fd2;
uint32_t handle_import, handle_open, handle_orig, flink_name;
int dma_buf_fd1, dma_buf_fd2;
fd1 = drm_open_any();
fd2 = drm_open_any();
handle_orig = gem_create(fd1, BO_SIZE);
dma_buf_fd1 = prime_handle_to_fd(fd1, handle_orig);
flink_name = gem_flink(fd1, handle_orig);
handle_open = gem_open(fd2, flink_name);
dma_buf_fd2 = prime_handle_to_fd(fd2, handle_open);
handle_import = prime_fd_to_handle(fd2, dma_buf_fd2);
/* dma-buf selfimporting an flink bo should give the same handle */
igt_assert(handle_import == handle_open);
close(fd1);
close(fd2);
close(dma_buf_fd1);
close(dma_buf_fd2);
}
static void test_with_one_bo(void)
{
int fd1, fd2;
uint32_t handle, handle_import1, handle_import2, handle_selfimport;
int dma_buf_fd;
fd1 = drm_open_any();
fd2 = drm_open_any();
handle = gem_create(fd1, BO_SIZE);
dma_buf_fd = prime_handle_to_fd(fd1, handle);
handle_import1 = prime_fd_to_handle(fd2, dma_buf_fd);
check_bo(fd1, handle, fd2, handle_import1);
/* reimport should give us the same handle so that userspace can check
* whether it has that bo already somewhere. */
handle_import2 = prime_fd_to_handle(fd2, dma_buf_fd);
igt_assert(handle_import1 == handle_import2);
/* Same for re-importing on the exporting fd. */
handle_selfimport = prime_fd_to_handle(fd1, dma_buf_fd);
igt_assert(handle == handle_selfimport);
/* close dma_buf, check whether nothing disappears. */
close(dma_buf_fd);
check_bo(fd1, handle, fd2, handle_import1);
gem_close(fd1, handle);
check_bo(fd2, handle_import1, fd2, handle_import1);
/* re-import into old exporter */
dma_buf_fd = prime_handle_to_fd(fd2, handle_import1);
/* but drop all references to the obj in between */
gem_close(fd2, handle_import1);
handle = prime_fd_to_handle(fd1, dma_buf_fd);
handle_import1 = prime_fd_to_handle(fd2, dma_buf_fd);
check_bo(fd1, handle, fd2, handle_import1);
/* Completely rip out exporting fd. */
close(fd1);
check_bo(fd2, handle_import1, fd2, handle_import1);
}
static int get_object_count(void)
{
FILE *file;
int ret, scanned;
int device = drm_get_card();
char *path;
igt_drop_caches_set(DROP_RETIRE);
ret = asprintf(&path, "/sys/kernel/debug/dri/%d/i915_gem_objects", device);
igt_assert(ret != -1);
file = fopen(path, "r");
scanned = fscanf(file, "%i objects", &ret);
igt_assert(scanned == 1);
return ret;
}
static void *<API key>(void *p)
{
struct drm_gem_close close_bo;
int *fds = p;
int fd = fds[0];
int dma_buf_fd = fds[1];
uint32_t handle;
while (!pls_die) {
handle = prime_fd_to_handle(fd, dma_buf_fd);
close_bo.handle = handle;
ioctl(fd, DRM_IOCTL_GEM_CLOSE, &close_bo);
}
return (void *)0;
}
static void <API key>(void)
{
pthread_t *threads;
int r, i, num_threads;
int fds[2];
int obj_count;
void *status;
uint32_t handle;
int fake;
/* Allocate exit handler fds in here so that we dont screw
* up the counts */
fake = drm_open_any();
obj_count = get_object_count();
num_threads = sysconf(<API key>);
threads = calloc(num_threads, sizeof(pthread_t));
fds[0] = drm_open_any();
igt_assert(fds[0] >= 0);
handle = gem_create(fds[0], BO_SIZE);
fds[1] = prime_handle_to_fd(fds[0], handle);
for (i = 0; i < num_threads; i++) {
r = pthread_create(&threads[i], NULL,
<API key>,
(void *)(uintptr_t)fds);
igt_assert(r == 0);
}
sleep(5);
pls_die = 1;
for (i = 0; i < num_threads; i++) {
pthread_join(threads[i], &status);
igt_assert(status == 0);
}
close(fds[0]);
close(fds[1]);
obj_count = get_object_count() - obj_count;
igt_info("leaked %i objects\n", obj_count);
close(fake);
igt_assert(obj_count == 0);
}
static void *<API key>(void *p)
{
struct drm_prime_handle prime_h2f;
struct drm_gem_close close_bo;
int fd = (uintptr_t)p;
uint32_t handle;
while (!pls_die) {
/* We want to race gem close against prime export on handle one.*/
handle = gem_create(fd, 4096);
if (handle != 1)
gem_close(fd, handle);
/* raw ioctl since we expect this to fail */
/* WTF: for gem_flink_race I've unconditionally used handle == 1
* here, but with prime it seems to help a _lot_ to use
* something more random. */
prime_h2f.handle = 1;
prime_h2f.flags = DRM_CLOEXEC;
prime_h2f.fd = -1;
ioctl(fd, <API key>, &prime_h2f);
close_bo.handle = 1;
ioctl(fd, DRM_IOCTL_GEM_CLOSE, &close_bo);
close(prime_h2f.fd);
}
return (void *)0;
}
static void <API key>(void)
{
pthread_t *threads;
int r, i, num_threads;
int fd;
int obj_count;
void *status;
obj_count = get_object_count();
num_threads = sysconf(<API key>);
threads = calloc(num_threads, sizeof(pthread_t));
fd = drm_open_any();
igt_assert(fd >= 0);
for (i = 0; i < num_threads; i++) {
r = pthread_create(&threads[i], NULL,
<API key>,
(void *)(uintptr_t)fd);
igt_assert(r == 0);
}
sleep(5);
pls_die = 1;
for (i = 0; i < num_threads; i++) {
pthread_join(threads[i], &status);
igt_assert(status == 0);
}
close(fd);
obj_count = get_object_count() - obj_count;
igt_info("leaked %i objects\n", obj_count);
igt_assert(obj_count == 0);
}
static void test_llseek_size(void)
{
int fd, i;
uint32_t handle;
int dma_buf_fd;
counter = 0;
fd = drm_open_any();
for (i = 0; i < 10; i++) {
int bufsz = 4096 << i;
handle = gem_create(fd, bufsz);
dma_buf_fd = prime_handle_to_fd(fd, handle);
gem_close(fd, handle);
igt_assert(prime_get_size(dma_buf_fd) == bufsz);
close(dma_buf_fd);
}
close(fd);
}
static void test_llseek_bad(void)
{
int fd;
uint32_t handle;
int dma_buf_fd;
counter = 0;
fd = drm_open_any();
handle = gem_create(fd, BO_SIZE);
dma_buf_fd = prime_handle_to_fd(fd, handle);
gem_close(fd, handle);
igt_require(lseek(dma_buf_fd, 0, SEEK_END) >= 0);
igt_assert(lseek(dma_buf_fd, -1, SEEK_END) == -1 && errno == EINVAL);
igt_assert(lseek(dma_buf_fd, 1, SEEK_SET) == -1 && errno == EINVAL);
igt_assert(lseek(dma_buf_fd, BO_SIZE, SEEK_SET) == -1 && errno == EINVAL);
igt_assert(lseek(dma_buf_fd, BO_SIZE + 1, SEEK_SET) == -1 && errno == EINVAL);
igt_assert(lseek(dma_buf_fd, BO_SIZE - 1, SEEK_SET) == -1 && errno == EINVAL);
close(dma_buf_fd);
close(fd);
}
igt_main
{
struct {
const char *name;
void (*fn)(void);
} tests[] = {
{ "with_one_bo", test_with_one_bo },
{ "<API key>", <API key> },
{ "with_two_bos", test_with_two_bos },
{ "with_fd_dup", test_with_fd_dup },
{ "<API key>", <API key> },
{ "<API key>", <API key> },
{ "llseek-size", test_llseek_size },
{ "llseek-bad", test_llseek_bad },
};
int i;
for (i = 0; i < ARRAY_SIZE(tests); i++) {
igt_subtest(tests[i].name)
tests[i].fn();
}
}
|
<section>
<div class="<API key>">
<h1>Selecciona el animal que quieres actualizar:
<select ng-model="updAnimal.animalSelected" ng-change="updAnimal.editAnimal(updAnimal.animalSelected)">
<option ng-repeat="item in updAnimal.allAnimals" ng-value="{{item.id}}">{{item.name}}</option>
</select>
</h1>
</div>
<div class="frm-UpdAnimal" ng-show="updAnimal.animalSelected">
<h3>Modificar el animal: {{updAnimal.animalToUpdate.name}}</h3>
<div class="div-img-detail">
Nombre animal:
<input type="text" value="{{updAnimal.animalToUpdate.name}}" ng-model="updAnimal.nameUpdAnimal" label="Animal" ng-class="{ 'has-error' : !updAnimal.nameUpdAnimal && updAnimal.formSend}">
<br><br>
Tipo Animal:
<select ng-model="updAnimal.typeUpdAnimal" ng-class="{ 'has-error' : !updAnimal.typeUpdAnimal && updAnimal.formSend }">
<option value="mamiferos">Mamiferos</option>
<option value="otros">Otros</option>
</select>
<br><br>
Imagen:
<input type="text" value="{{updAnimal.animalToUpdate.img}}" ng-model="updAnimal.imgUpdAnimal" label="Animal" ng-class="{ 'has-error' : !updAnimal.imgUpdAnimal && updAnimal.formSend}">
<br><br>
<div>
<div class="txt-error" ng-show="!showMsg && updAnimal.formSend">ERROR <br> Debe introducir todos los datos.</div>
</div>
<div class="button-bar">
<button ng-click="updAnimal.updAnimal()">Confirmar</button>
<button ng-click="updAnimal.goToMain()">Cancelar</button>
</div>
</div>
</div>
</section>
|
pyrdiff
====
Python rdiff/rsync implementation (for experimental/learning purposes only)
|
<?php
declare(strict_types = 1);
namespace KoolKode\BPMN\Runtime\Behavior;
use KoolKode\BPMN\Engine\<API key>;
use KoolKode\BPMN\Engine\VirtualExecution;
use KoolKode\BPMN\Runtime\Command\<API key>;
use KoolKode\Process\Node;
class <API key> extends <API key>
{
protected $message;
public function __construct(string $activityId, string $attachedTo, string $message)
{
parent::__construct($activityId, $attachedTo);
$this->message = $message;
}
/**
* {@inheritdoc}
*/
public function processSignal(VirtualExecution $execution, ?string $signal, array $variables = [], array $delegation = []): void
{
if ($signal !== $this->message) {
throw new \RuntimeException(\sprintf('Boundary event awaits message "%s", unable to process signal "%s"', $this->message, $signal));
}
$this-><API key>($execution, $variables);
parent::processSignal($execution, $signal, $variables);
}
/**
* {@inheritdoc}
*/
public function <API key>(VirtualExecution $execution, string $activityId, ?Node $node = null): void
{
$execution->getEngine()->executeCommand(new <API key>($this->message, $execution, $activityId, $node, true));
}
}
|
const greetings = {
morning: ['God morgon!', 'Kaffe?', 'Ha en bra dag!', 'Hoppas du får en bra dag!', 'Sovit gott?'],
afternoon: ['Ganska fin du!', 'Trevlig eftermiddag!', 'Eftermiddags kaffe?', 'Glömde väl inte att fika?'],
evening: ['Trevlig kväll!', 'Ser bra ut!', 'Myskväll?!'],
};
module.exports = {
getMessage: function(callback) {
const d = new Date();
var hour = d.getHours();
if (hour >= 5 && hour < 12) {
return greetings.morning[Math.floor(Math.random() * greetings.morning.length)];
} else if (hour >= 12 && hour < 18) {
return greetings.afternoon[Math.floor(Math.random() * greetings.afternoon.length)];
} else if (hour >= 18 || (hour >= 0 && hour < 5)) {
return greetings.evening[Math.floor(Math.random() * greetings.evening.length)];
} else {
return 'Something wrong, hour is: ' + hour;
}
},
};
|
/**
* \file test_hs_cell.c
* \brief Test hidden service cell functionality.
*/
#define <API key>
#define HS_SERVICE_PRIVATE
#include "test.h"
#include "test_helpers.h"
#include "log_test_helpers.h"
#include "crypto_ed25519.h"
#include "hs_cell.h"
#include "hs_intropoint.h"
#include "hs_service.h"
/* Trunnel. */
#include "hs/<API key>.h"
/** We simulate the creation of an outgoing ESTABLISH_INTRO cell, and then we
* parse it from the receiver side. */
static void
<API key>(void *arg)
{
(void) arg;
ssize_t ret;
char circ_nonce[DIGEST_LEN] = {0};
uint8_t buf[RELAY_PAYLOAD_SIZE];
<API key> *cell_in = NULL;
crypto_rand(circ_nonce, sizeof(circ_nonce));
/* Create outgoing ESTABLISH_INTRO cell and extract its payload so that we
attempt to parse it. */
{
/* We only need the auth key pair here. */
<API key> *ip = <API key>(NULL, 0);
/* Auth key pair is generated in the constructor so we are all set for
* using this IP object. */
ret = <API key>(circ_nonce, ip, buf);
<API key>(ip);
tt_u64_op(ret, OP_GT, 0);
}
/* Check the contents of the cell */
{
/* First byte is the auth key type: make sure its correct */
tt_int_op(buf[0], OP_EQ, HS_INTRO_<API key>);
/* Next two bytes is auth key len */
tt_int_op(ntohs(get_uint16(buf+1)), OP_EQ, ED25519_PUBKEY_LEN);
/* Skip to the number of extensions: no extensions */
tt_int_op(buf[35], OP_EQ, 0);
/* Skip to the sig len. Make sure it's the size of an ed25519 sig */
tt_int_op(ntohs(get_uint16(buf+35+1+32)), OP_EQ, ED25519_SIG_LEN);
}
/* Parse it as the receiver */
{
ret = <API key>(&cell_in, buf, sizeof(buf));
tt_u64_op(ret, OP_GT, 0);
ret = <API key>(cell_in,
(const uint8_t *) circ_nonce,
sizeof(circ_nonce));
tt_u64_op(ret, OP_EQ, 0);
}
done:
<API key>(cell_in);
}
/* Mocked <API key>() function that always fails :) */
static int
<API key>(ed25519_signature_t *signature_out,
const uint8_t *msg, size_t msg_len,
const char *prefix_str,
const ed25519_keypair_t *keypair) {
(void) signature_out;
(void) msg;
(void) msg_len;
(void) prefix_str;
(void) keypair;
return -1;
}
/** We simulate a failure to create an ESTABLISH_INTRO cell */
static void
<API key>(void *arg)
{
(void) arg;
ssize_t cell_len = 0;
<API key> *cell = NULL;
char circ_nonce[DIGEST_LEN] = {0};
<API key> *ip = NULL;
MOCK(<API key>, <API key>);
crypto_rand(circ_nonce, sizeof(circ_nonce));
<API key>(LOG_WARN);
/* Easiest way to make that function fail is to mock the
<API key>() function and make it fail. */
cell = <API key>();
tt_assert(cell);
ip = <API key>(NULL, 0);
cell_len = <API key>(circ_nonce, ip, NULL);
<API key>(ip);
<API key>("Unable to make signature for "
"ESTABLISH_INTRO cell.");
<API key>();
tt_i64_op(cell_len, OP_EQ, -1);
done:
<API key>(cell);
UNMOCK(<API key>);
}
struct testcase_t hs_cell_tests[] = {
{ "<API key>", <API key>, TT_FORK,
NULL, NULL },
{ "<API key>", <API key>, TT_FORK,
NULL, NULL },
END_OF_TESTCASES
};
|
# class DesignComponent
class Mucomo::Model::DesignComponent
# @todo participant, meta, description
# this include adds the attributes id, name, title to this class.
include Mucomo::Model::HasIdentifiers
attr_accessor :media_type # media_type's range is a restricted vocabulary, see XML schema file
attr_accessor :required # boolean
attr_reader :design
def initialize
@required = true
@media_type = "undefined"
end
def required?
@required
end
def design=(new_design)
@design = new_design
@design.<API key>(self) unless @design.<API key>?(self)
end
# @todo access to associated allocations
include Mucomo::Model::BelongsToCorpus
end
|
.component {
padding-top: 20px;
}
.currenttotal {
text-align: center;
}
|
module I18n
module Backend
class Simple
protected
def pluralize(locale, entry, count)
return entry unless entry.is_a?(Hash) and count
key = :zero if count == 0 && entry.has_key?(:zero)
locale_pluralize = lookup(locale, :pluralize)
if locale_pluralize && locale_pluralize.respond_to?(:call)
key ||= locale_pluralize.call(count)
else
key ||= default_pluralizer(count)
end
raise <API key>.new(entry, count) unless entry.has_key?(key)
entry[key]
end
def default_pluralizer(count)
count == 1 ? :one : :other
end
end
end
end
|
package io.variability.jhipster.security;
import io.variability.jhipster.config.Constants;
import org.springframework.data.domain.AuditorAware;
import org.springframework.stereotype.Component;
/**
* Implementation of AuditorAware based on Spring Security.
*/
@Component
public class <API key> implements AuditorAware<String> {
@Override
public String getCurrentAuditor() {
String userName = SecurityUtils.getCurrentUserLogin();
return (userName != null ? userName : Constants.SYSTEM_ACCOUNT);
}
}
|
import auth from '../auth';
import clone from 'clone';
import storage from './storage';
async function addBlockOrItem(dbConn, token, codeObj, props, type) {
let user = await auth.getUser(token);
console.log(`Adding new ${type} for user ${user.login}`);
let add;
let newType = {
code: codeObj,
name: props.name,
icon: 'code',
owner: user.login
};
if(type == 'item') {
add = storage.addItemType;
newType.crosshairIcon = props.crosshairIcon;
newType.adjacentActive = props.adjacentActive;
} else {
add = storage.addBlockType;
newType.material = props.material;
}
await add(dbConn, newType);
return newType;
}
async function <API key>(dbConn, token, id, codeObj, type) {
let user = await auth.getUser(token);
console.log(`Updating ${type} ${id} for user ${user.login}`);
let get, add, update;
if(type == 'item') {
get = storage.getItemType;
add = storage.addItemType;
update = storage.updateItemType;
} else {
get = storage.getBlockType;
add = storage.addBlockType;
update = storage.updateBlockType;
}
let original = await get(dbConn, id);
if(original.owner != user.login) {
throw new Error(`${type} ${id} belongs to ${original.owner} - ${user.login} doesn't have access.`);
}
let updated = clone(original);
updated.code = codeObj;
delete updated.newerVersion;
await add(dbConn, updated);
original.newerVersion = updated.id;
await update(dbConn, original);
return updated;
}
export default {
async getToolbar(dbConn, token) {
let user = await auth.getUser(token);
return await storage.getToolbar(dbConn, user.login);
},
async setToolbarItem(dbConn, token, position, type, id) {
let user = await auth.getUser(token);
await storage.updateToolbarItem(dbConn, user.login, position, {type, id});
},
async removeToolbarItem(dbConn, token, position) {
let user = await auth.getUser(token);
await storage.updateToolbarItem(dbConn, user.login, position, null);
},
async getAll(dbConn) {
let itemTypes = await storage.getAllItemTypes(dbConn);
let blockTypes = await storage.getAllBlockTypes(dbConn);
return {
itemTypes,
blockTypes
};
},
async getItemTypes(dbConn, token, ids) {
return await storage.getItemTypes(dbConn, ids);
},
async getBlockTypes(dbConn, token, ids) {
return await storage.getBlockTypes(dbConn, ids);
},
async updateBlockCode(dbConn, token, id, codeObj) {
return await <API key>(dbConn, token, id, codeObj, 'block');
},
async updateItemCode(dbConn, token, id, codeObj) {
return await <API key>(dbConn, token, id, codeObj, 'item');
},
async addBlockType(dbConn, token, codeObj, props) {
return await addBlockOrItem(dbConn, token, codeObj, props, 'block');
},
async addItemType(dbConn, token, codeObj, props) {
return await addBlockOrItem(dbConn, token, codeObj, props, 'item');
}
};
|
<?php
use Stecman\Passnote\Object\<API key>;
use Stecman\Passnote\Object\<API key>;
class ObjectController extends ControllerBase
{
public static function getObjectUrl(StoredObject $object)
{
return 'object/' . $object->getUuid();
}
public function indexAction($uuid)
{
$object = $this->getObjectById($uuid);
if ($object) {
$content = $this->decryptContent($object);
$this->view->setVar('object', $object);
$this->view->setVar('decrypted_content', $content);
} else {
$this->handleAs404('Object not found');
}
}
public function findAction()
{
$query = $this->request->getPost('query', 'trim');
echo $query;
}
public function versionsAction($uuid)
{
$object = $this->getObjectById($uuid);
if ($object) {
$versions = [];
$differ = new \SebastianBergmann\Diff\Differ('');
$prevContent = '';
foreach ($object->versions as $version) {
$nextContent = $this->decryptContent($version);
$diff = $differ->diff($prevContent, $nextContent);
$prevContent = $nextContent;
$version->_diff = $this->formatDiff($diff);
$versions[] = $version;
}
$object->_diff = $this->formatDiff($differ->diff(
$prevContent,
$this->decryptContent($object)
));
$versions[] = $object;
krsort($versions);
$this->view->setLayout('object');
$this->view->setVar('object', $object);
$this->view->setVar('versions', $versions);
} else {
$this->handleAs404('Object not found');
}
}
public function showVersionAction($objectUuid, $versionUuid)
{
$version = $this->getObjectVersion($objectUuid, $versionUuid);
if ($version) {
$content = $this->decryptContent($version);
$this->view->setVar('object', $version->master);
$this->view->setVar('version', $version);
$this->view->setVar('next_version', $version->getSibling(ObjectVersion::NEWER_VERSION));
$this->view->setVar('prev_version', $version->getSibling(ObjectVersion::OLDER_VERSION));
$this->view->setVar('decrypted_content', $content);
} else {
$this->handleAs404('Object or version not found');
}
}
public function editAction($uuid)
{
$object = $this->getObjectById($uuid);
$form = new ObjectForm(null, Security::getCurrentUser());
if ($object) {
$content = $this->decryptContent($object);
$form->setBody($content);
$form->setEntity($object);
$this->view->setVar('object', $object);
}
$this->view->setVar('form', $form);
if ($this->request->isPost() && $form->isValid($_POST)) {
if (!$this->security->checkToken()) {
$this->flash->error('Invalid security token. Please try submitting the form again.');
return;
}
$savedObject = $form->handleSubmit();
$this->response->redirect( self::getObjectUrl($savedObject) );
}
}
public function deleteAction($objectUuid, $versionUuid = null)
{
if ($versionUuid) {
$object = $this->getObjectVersion($objectUuid, $versionUuid);
} else {
$object = $this->getObjectById($objectUuid);
}
$this->view->setVar('object', $object);
$this->view->setVar('isVersion', $object instanceof ObjectVersion);
if (!$object) {
return $this->handleAs404('Object not found');
}
if ($this->request->isPost()) {
if (!$this->security->checkToken()) {
$this->flash->error('Invalid security token. Please try submitting the form again.');
return;
}
$object->delete();
$this->flashSession->success("Deleted object $objectUuid");
$this->response->redirect('');
}
}
protected function decryptContent(<API key> $object)
{
$user = Security::getCurrentUser();
if ($object->getKeyId() === $user->accountKey_id) {
$keyService = new \Stecman\Passnote\AccountKeyService();
return $keyService->decryptObject($object);
} else {
// Prompt for decryption passphrase
}
}
/**
* @param string $uuid
* @return \StoredObject
*/
protected function getObjectById($uuid)
{
return StoredObject::findFirst([
'uuid = :uuid: AND user_id = :user_id:',
'bind' => [
'uuid' => $uuid,
'user_id' => Security::getCurrentUserId()
]
]);
}
protected function formatDiff($diff)
{
$diff = preg_replace('/(^-.*$)/m', '<span class="diff-del">$1</span>', $diff);
$diff = preg_replace('/(^\+.*$)/m', '<span class="diff-add">$1</span>', $diff);
return $diff;
}
/**
* Fetch an object version from the database
*
* @param string $objectUuid
* @param string $versionUuid
* @return ObjectVersion|null
*/
protected function getObjectVersion($objectUuid, $versionUuid) {
return $this->modelsManager->executeQuery(
'SELECT ObjectVersion.* FROM ObjectVersion'
.' LEFT JOIN StoredObject Object ON ObjectVersion.object_id = Object.id'
.' WHERE ObjectVersion.uuid = :version_uuid: AND Object.uuid = :object_uuid: AND Object.user_id = :user_id:',
[
'version_uuid' => $versionUuid,
'object_uuid' => $objectUuid,
'user_id' => Security::getCurrentUserId()
]
)->getFirst();
}
}
|
import { globalShortcut } from 'electron'
import playbackControls from '../actions/playbackControls'
function initGlobalShortcuts () {
globalShortcut.register('MediaNextTrack', playbackControls.clickNextSong)
globalShortcut.register('MediaPreviousTrack', playbackControls.clickPreviousSong)
globalShortcut.register('MediaStop', playbackControls.clickPlayPause)
globalShortcut.register('MediaPlayPause', playbackControls.clickPlayPause)
}
export default initGlobalShortcuts
|
// Code generated by Microsoft (R) AutoRest Code Generator.
package com.azure.resourcemanager.automation.models;
import com.azure.core.annotation.Fluent;
import com.azure.core.util.logging.ClientLogger;
import com.azure.resourcemanager.automation.fluent.models.ConnectionInner;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;
/** The response model for the list connection operation. */
@Fluent
public final class <API key> {
@JsonIgnore private final ClientLogger logger = new ClientLogger(<API key>.class);
/*
* Gets or sets a list of connection.
*/
@JsonProperty(value = "value")
private List<ConnectionInner> value;
/*
* Gets or sets the next link.
*/
@JsonProperty(value = "nextLink")
private String nextLink;
/**
* Get the value property: Gets or sets a list of connection.
*
* @return the value value.
*/
public List<ConnectionInner> value() {
return this.value;
}
/**
* Set the value property: Gets or sets a list of connection.
*
* @param value the value value to set.
* @return the <API key> object itself.
*/
public <API key> withValue(List<ConnectionInner> value) {
this.value = value;
return this;
}
/**
* Get the nextLink property: Gets or sets the next link.
*
* @return the nextLink value.
*/
public String nextLink() {
return this.nextLink;
}
/**
* Set the nextLink property: Gets or sets the next link.
*
* @param nextLink the nextLink value to set.
* @return the <API key> object itself.
*/
public <API key> withNextLink(String nextLink) {
this.nextLink = nextLink;
return this;
}
/**
* Validates the instance.
*
* @throws <API key> thrown if the instance is not valid.
*/
public void validate() {
if (value() != null) {
value().forEach(e -> e.validate());
}
}
}
|
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
# copies or substantial portions of the Software.
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
module Copyleaks
class <API key> < StandardError
attr_reader :reason
def initialize
@reason = 'Authentication Expired. Need to login again'
end
end
end
|
<?php
function icom_edit_permalink($link) {
if (<API key>()) {
return ICOM_ABSPATH . icom_current_lang() . "/" . str_replace(ICOM_ABSPATH, "", $link);
} else {
return ICOM_ABSPATH . str_replace(ICOM_ABSPATH, "", $link) . "&lang=" . icom_current_lang();
}
}
function icom_current_lang() {
global $<API key>, $<API key>;
$lang = get_query_var('lang');
if (empty($lang) && !empty($_GET['lang'])) {
$lang = $_GET['lang'];
}
if (empty($lang)) return $<API key>;
$lang_exists = preg_grep("/" . $lang . "/i", $<API key>);
if (!empty($lang_exists)) {
return $lang;
} else {
return $<API key>;
}
}
/**
* Pokud je jazyk ulozen v URL vrati TRUE, jinak FALSE
* #not used
* @return boolean
*/
function icom_lang_in_url() {
$l1 = get_query_var('lang');
$l2 = $_GET['lang'];
if ((isset($l1) && !empty($l1)) || (isset($l2) && !empty($l2))) {
return TRUE;
} else {
return FALSE;
}
}
/**
* Vybere z DB stranky ktere nejsou v aktualne zvolenem jazyce
* nebo maji priznak PREVIEW
*
* @global wpdb $wpdb
* @return int[] ID vyloucenych stranek
*/
function <API key>() {
global $wpdb;
$current_lang = icom_current_lang();
$pages_for_exclude = $wpdb->get_results(" SELECT id_post FROM " . $wpdb->prefix . "icom_translations WHERE lang != '" . $current_lang . "' OR preview = '1'");
foreach ($pages_for_exclude as $page) {
$exclude_pages[] = $page->id_post;
}
return $exclude_pages;
}
function icom_exclude_pages($query) {
$exclude_pages = <API key>();
$query->set('post__not_in', $exclude_pages);
return $query;
}
/**
* Zjisti jestli jsou nastavene cool URL (mod_rewrite)
*
* @return boolean
*/
function <API key>() {
$structure = get_option('permalink_structure');
if (empty($structure)) {
return false;
} else {
return true;
}
}
function <API key>($lang, $page) {
$permalink = <API key>();
if ($permalink == false)
return array('permalink' => false, 'value' => '?&' . $page . '&lang=' . $lang);
else
return array('permalink' => true, 'value' => $lang . "/" . $page);
}
/**
* Question: Co dela tahle funkce a k cemu se pouziva??
*
* Zjisti jestli je dana stranka (z tabulky posts) typu 'page'
* @return boolean
*/
/*
function icom_get_type($type) {
switch ($type) {
case "post":
break;
default:
if (get_query_var('page_id') || get_query_var('pagename'))
return true;
else if (!get_query_var('p') && !get_query_var('name'))
return true;
else
return false;
break;
}
}
*/
/**
* Zjisti typ(post, page, ...) stranky [post_type] podle ID
*
* @global wpdb $wpdb
* @param int $id
* @return string
*/
function icom_get_post_type($id) {
global $wpdb;
return $wpdb->get_var("SELECT post_type FROM " . $wpdb->prefix . "posts WHERE ID = " . $id . "");
}
function <API key>($id){
global $wpdb;
return $wpdb->get_var("SELECT post_status FROM " . $wpdb->prefix . "posts WHERE ID = " . $id . "");
}
/**
* Zjisti jazyk stranky podle jejiho ID
*
* @global wpdb $wpdb
* @param int $id
* @return string
*/
function icom_get_post_lang($id) {
global $wpdb;
return $wpdb->get_var("SELECT lang FROM " . $wpdb->prefix . "icom_translations WHERE id_post = " . $id . "");
}
/**
* Sestavi permalink pro stranky typu post. Pokud je zjisteny jiny typ (napr. pages),
* tak fce vrati get_permalink()
*
* @global wpdb $wpdb
* @global string $<API key>
* @param int $id
* @return string $permalink
*/
function <API key>($id) {
global $wpdb, $<API key>;
$lang = icom_get_post_lang($id);
if (!isset($lang) || empty($lang)) {
$lang = $<API key>;
}
if (icom_get_post_type($id) !== "post") {
$permalink = get_permalink($id);
if ((stripos($permalink, $lang)) !== FALSE) {
return $permalink;
} else if ((stripos($permalink, ICOM_HOST)) !== FALSE) {
return substr_replace($permalink, $lang . "/", strlen(ICOM_HOST), 0);
} else {
return NULL;
}
}
$slug = $wpdb->get_var("SELECT post_name FROM " . $wpdb->prefix . "posts WHERE ID = " . $id . "");
$permalink = rtrim(str_replace("/wp-admin/", "", ICOM_ABSPATH), "/");
$permalink = rtrim($permalink, "/") . "/" . $lang . "/" . $slug . "/";
return $permalink;
}
/**
* Ziska ID aktualni stranky stranky
* @return type
*/
function icom_get_post_id() {
global $wpdb, $icom_lang_default;
if (get_query_var('p')) {
return get_query_var('p');
} else if (get_query_var('page_id')) {
return get_query_var('page_id');
} else if (get_query_var('icompage') || get_query_var('pagename') || get_query_var('name')) {
$query_string = get_query_var('icompage');
if (empty($query_string)) $query_string = get_query_var('pagename');
if (empty($query_string)) $query_string = get_query_var('name');
$slug_parts = explode("/", $query_string);
$slug_count = count($slug_parts);
$post_name = $slug_parts[$slug_count - 1]; // ziska ID stranky ze slugu (post_name)
//zkusi ziskat ID stranky z tabulky [icom_transtations]
//podle aktualniho jazyka a podle [post_name] z tabulky [posts]
if (stripos($post_name, "preview-page") !== false)
$where = "t.preview = '1'";
else
$where = "t.lang = %s AND t.preview = '0'";
$qry = "SELECT id_post FROM " . $wpdb->prefix . "icom_translations t, " . $wpdb->prefix . "posts p WHERE p.id = t.id_post AND post_name = '" . $post_name . "' AND (" . $where . ") ORDER BY t.id DESC";
$id = $wpdb->get_var($wpdb->prepare($qry, icom_current_lang()));
//pokud neexistuje stranka v tab. [icom_transtations] tzn. neni dostupna v hledanem jazyce
//zkusi ziskat ID nejake stranky se stejnym slugem z tabulky [posts]
if (is_null($id)) {
$id = $wpdb->get_var($wpdb->prepare($qry, $icom_lang_default));
}
if (is_null($id))
return -1;
else
return $id;
} else {
return null;
}
}
/**
* Pokud ID stranky a jazyk nejsou shodne (podle tabulky icom_translations),
* tak se pokusi ziskat ID stranky v danem jazyce a presmerovat na ni.
* Kdyz neni zadne ID nalezene nepresmeruje.
*
* @global wpdb $wpdb
* @param WP_Query $query
* @return WP_Query
*/
function <API key>($query) {
global $wpdb, $icom_lang_default;
if (!$query->is_main_query()) {
return $query;
}
$is_permalink = <API key>(); // TRUE pokud se pouzivaji COOL URL
$current_lang = icom_current_lang(); // Jazyk aktualne uvedeny v URL
$last_lang = get_option("icom_language_last"); // Jazyk, ktery byl v URL naposledy (nevim kvuli cemu jsme ho museli zavest)
$is_homepage = false;
$is_page = false;
$is_preview = false;
$id = icom_get_post_id(); // ID aktualni stranky
$id_homepage = get_option('page_on_front'); // ID homepage
$preview = $wpdb->get_var("SELECT lang FROM " . $wpdb->prefix . "icom_translations WHERE id_post = '" . $id . "' AND preview = '1'");
if ($preview && empty(get_query_var('lang'))) {
$query->set('lang', $preview);
wp_redirect(<API key>($id) . "?icom-previewHash=" . $_GET['icom-previewHash'] . "&icom-targetLang" . $_GET['icom-targetLang']);
exit();
}
$link_homepage = get_permalink($id);
if ($is_permalink == true && $id == $id_homepage && ICOM_ABSPATH != $link_homepage) {
wp_redirect($link_homepage);
exit();
}
// 404ka
if ($id == -1) {
if ($id_homepage > 0) {
$query->is_404 = TRUE;
$query->is_post_page = FALSE;
} else {
$query->is_404 = FALSE;
$query->is_post_page = TRUE;
$id = null;
}
} else if (!isset($id)) {
$is_homepage = true;
//zjistim ID postu na zaklade jazyka a ID homepage stranky
$id = $wpdb->get_var("SELECT id_post FROM " . $wpdb->prefix . "icom_translations WHERE lang = '" . $current_lang . "' AND id_post_orig = '" . $id_homepage . "' AND preview = '0'");
if (isset($id)) {
$query->is_home = FALSE;
$query->is_page = TRUE;
$query->set("p", $id);
$query->set("page_id", $id);
//pokud homepage ve zvolenem jazyce neexistuje, je potreba vratit 404 Not Found
} else {
$query->is_home = FALSE;
$query->is_404 = FALSE;
$query->is_post_page = TRUE;
}
} else {
$is_page = (icom_get_post_type($id) == "post" ? false : true);
$query->is_home = FALSE;
$query->is_404 = FALSE;
$query->is_admin = FALSE;
if ($is_page == false) {
$query->is_page = FALSE;
$query->is_single = TRUE;
$query->set("p", $id);
$query->set("page_id", 0);
} else {
$query->is_page = TRUE;
$query->is_single = FALSE;
$query->set("p", 0);
$query->set("page_id", $id);
}
$query->is_archive = FALSE;
$query->is_preview = get_query_var('preview');
$query->is_date = FALSE;
$query->is_year = FALSE;
$query->is_month = FALSE;
$query->is_time = FALSE;
$query->is_author = FALSE;
$query->is_category = FALSE;
$query->is_tag = FALSE;
$query->is_tax = FALSE;
$query->is_search = FALSE;
$query->is_feed = FALSE;
$query->is_comment_feed = FALSE;
$query->is_trackback = FALSE;
$query->is_comments_popup = FALSE;
$query->is_attachment = FALSE;
$query->is_singular = TRUE;
$query->is_robots = FALSE;
$query->is_paged = FALSE;
}
$url_array = explode("?", ICOM_ACTUAL);
$link = <API key>($id);
$post_status = <API key>($id); // draft, publish, future, ...
if ($id != null && $link != null && $is_permalink == true && (isset($_GET['p']) || isset($_GET['page_id']) || isset($_GET['lang']) || $url_array[0] != $link) && $post_status != "draft") {
$url = "?" . $url_array[1];
$url = preg_replace("/[?|&]p(=[^&]*)?/", "", $url);
$url = preg_replace("/[?|&]lang(=[^&]*)?/", "", $url);
$url = preg_replace("/[?|&]page_id(=[^&]*)?/", "", $url);
//$url = trim($url, "&");
//$url = preg_replace("/[&]+/", "&", $url);
$url = trim($link . "?" . $url, "?");
wp_redirect($url);
exit();
}
// ziskani zaznamu stranky z ICOM_TRANSLATION
$post = $wpdb->get_row("SELECT * FROM " . $wpdb->prefix . "icom_translations WHERE id_post = '" . icom_save_db($id) . "'");
// Pokud se jazyk stranky, kterou chceme nacist (zobrazit) neshodujes jazykem uvedenym v URL
if ($id != null && $is_permalink == true && strcasecmp($post->lang, $current_lang) != 0) {
// ziskani noveho ID pro presmerovani
if ($post->id_post_parent == 0) {
$new_post_id = $wpdb->get_var("SELECT id_post FROM " . $wpdb->prefix . "icom_translations WHERE (id_post_orig = '" . icom_save_db($id) . "' OR id_post_parent = '" . icom_save_db($id) . "') AND lang = '" . $current_lang . "' AND preview = '0'");
} else {
$new_post_id = $wpdb->get_var("SELECT id_post FROM " . $wpdb->prefix . "icom_translations WHERE (id_post_orig = '" . $post->id_post_parent . "' OR id_post_parent = '" . $post->id_post_parent . "') AND lang = '" . $current_lang . "' AND preview = '0'");
}
// presmerovani na novou stranku, se spravnym jazykem
if (isset($new_post_id)) {
<API key>($current_lang);
wp_redirect(<API key>($new_post_id));
exit();
}
} else if ($id != null && strcasecmp($last_lang, $current_lang) != 0) {
<API key>($current_lang);
$is_page == true ? $query->set('page_id', $id) : $query->set('p', $id);
/*
if ($is_page == true) {
$query->set('page_id', $id);
} else if ($query->is_main_query()) {
$query->set('p', $id);
}
*/
} else if ($id != null) {
echo "aaa";
<API key>($current_lang);
$is_page == true ? $query->set('page_id', $id) : $query->set('p', $id);
}
// pokud jsou vypnuty permalinky
if ($is_permalink == false) {
$id2 = $wpdb->get_var("SELECT id_post FROM " . $wpdb->prefix . "icom_translations WHERE id_post_parent = '" . $id . "' AND lang = '" . $current_lang . "' AND preview = '0'");
if (!isset($id2)) {
$parent = $wpdb->get_var("SELECT id_post_parent FROM " . $wpdb->prefix . "icom_translations WHERE id_post = '" . $id . "' AND lang = '" . $current_lang . "' AND preview = '0'");
if (!isset($parent)) $id = null;
} else {
$id = $id2;
}
if (isset($id)) {
$is_page == true ? $query->set('page_id', $id) : $query->set('p', $id);
} else {
$query->is_404 = TRUE;
}
}
if ($id == null) $query->is_404 = TRUE;
return $query;
}
/**
* Aktualizuje polozku 'icom_last_lang' v databazi
* @param String $lang
*/
function <API key>($lang) {
update_option("icom_language_last", $lang);
}
function <API key>() {
add_rewrite_tag('%lang%', '^([a-zA-Z]{2,3}(-[a-zA-Z]{2,4})?(-[a-zA-Z]{2})?)');
add_rewrite_tag('%icompage%', '([-a-zA-Z_]+)$');
}
function <API key>() {
add_rewrite_rule('^([a-zA-Z]{2,3}(-[a-zA-Z]{2,4})?(-[a-zA-Z]{2})?)/(.+)', 'index.php?lang=$matches[1]&icompage=$matches[4]', 'top');
}
|
E.widget.fontawesome = class extends E.factory.node {
constructor( icon ) {
super( 'i' );
this.attr( 'class', `fa fa-${icon.toString().toLowerCase()}` );
}
static css() {
return 'https:/' + '/maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css';
}
size( size ) {
if( !E.empty( size ) ) {
var sizes = [ 'lg', '2x', '3x', '4x', '5x' ];
size = size.toString().toLowerCase();
if( sizes.includes( size ) ) {
this.attr( 'class', `fa-${size}` );
}
}
return this;
}
fixedwidth() {
this.attr( 'class', 'fa-fw' );
return this;
}
border() {
this.attr( 'class', 'fa-border' );
return this;
}
rotate( angle ) {
angle = parseInt( angle );
if( angle >= 0 && angle <= 360 ) {
this.attr( 'class', `fa-rotate-${angle}` );
}
return this;
}
flip( dir ) {
if( !E.empty( dir ) ) {
switch( dir.toString().toLowerCase() ) {
case 'h':
case 'horz':
dir = 'horizontal';
break;
case 'v':
case 'vert':
dir = 'vertical';
break;
}
if( dir in [ 'horizontal', 'vertical' ] ) {
this.attr( 'class', `fa-flip-${dir}` );
}
}
return this;
}
};
|
import unittest
from app.commands.file_command import FileCommand
class TestFileCommand(unittest.TestCase):
def setUp(self):
self.window = WindowSpy()
self.settings = PluginSettingsStub()
self.sublime = SublimeSpy()
self.os_path = OsPathSpy()
# SUT
self.command = FileCommand(self.settings, self.os_path, self.sublime)
def <API key>(self):
self.settings.tests_folder = 'tests/unit'
self.command.open_source_file('C:/path/to/root/tests/unit/path/to/fileTest.php', self.window)
self.assertEqual('C:/path/to/root/path/to/file.php', self.window.file_to_open)
def <API key>(self):
self.settings.tests_folder = 'tests/unit'
self.command.open_source_file('C:\\path\\to\\root\\tests\\unit\\path\\to\\fileTest.php', self.window)
self.assertEqual('C:/path/to/root/path/to/file.php', self.window.file_to_open)
def <API key>(self):
self.settings.tests_folder = 'tests'
self.command.open_source_file('\\\\server\\dev\\root\\tests\\unit\\Service\\<API key>.php',
self.window)
self.assertEqual('\\\\server\\dev\\root\\Service\\<API key>.php', self.window.file_to_open)
def <API key>(self):
self.settings.tests_folder = 'tests/unit'
self.command.open_source_file('\\\\server\\dev\\root\\tests\\unit\\Service\\<API key>.php',
self.window)
self.assertEqual('\\\\server\\dev\\root\\Service\\<API key>.php', self.window.file_to_open)
def <API key>(self):
self.settings.root = 'C:/path/to/root'
self.settings.tests_folder = 'tests_folder'
self.command.open_source_file('C:/path/to/root/tests_folder/unit/path/to/fileTest.php', self.window)
self.assertEqual('C:/path/to/root/path/to/file.php', self.window.file_to_open)
def <API key>(self):
self.settings.root = 'C:/path/to/root'
self.settings.tests_folder = 'tests'
self.command.open_source_file('C:/path/to/root/tests/unit/path/to/tests/fileTest.php', self.window)
self.assertEqual('C:/path/to/root/path/to/tests/file.php', self.window.file_to_open)
def test_open_source_file_when_tests_folder_is_not_unit_test_folder_remove_only_unit_folder_after_test_path(self):
self.settings.root = 'C:/path/to/root'
self.settings.tests_folder = 'tests_folder'
self.command.open_source_file('C:/path/to/root/tests_folder/unit/path/to/unit/fileTest.php', self.window)
self.assertEqual('C:/path/to/root/path/to/unit/file.php', self.window.file_to_open)
def <API key>(self):
self.settings.tests_folder = 'tests/unit'
self.os_path.is_file_returns = True
actual = self.command.source_file_exists('C:\\path\\to\\root\\tests\\unit\\path\\to\\fileTest.php')
self.assertTrue(actual)
self.assertEqual('C:/path/to/root/path/to/file.php', self.os_path.<API key>)
def <API key>(self):
self.settings.tests_folder = 'tests/unit'
self.os_path.is_file_returns = True
actual = self.command.source_file_exists('root\path\src\Gallery\ImageType.php')
self.assertFalse(actual)
def <API key>(self):
self.settings.tests_folder = 'tests/unit'
self.os_path.is_file_returns = False
self.assertFalse(self.command.source_file_exists('C:/path/to/root/path/to/fileTest.php'))
self.assertEqual('C:/path/to/root/path/to/file.php', self.os_path.<API key>)
def <API key>(self):
""" This case is possible when currently opened tab in sublime is untitled (i.e. not yet created) file """
self.assertFalse(self.command.source_file_exists(None))
def <API key>(self):
""" This case is possible when currently opened tab in sublime is untitled (i.e. not yet created) file """
self.settings.root = 'C:/path/to/root'
self.settings.tests_folder = 'tests/unit'
self.assertFalse(self.command.test_file_exists(None, self.window))
def test_open_file(self):
self.settings.root = 'C:/path/to/root'
self.settings.tests_folder = 'tests/unit'
self.command.open_test_file('C:/path/to/root/path/to/file.php', self.window)
self.assertEqual('C:/path/to/root/tests/unit/path/to/fileTest.php', self.window.file_to_open)
def <API key>(self):
self.window.project_root = 'C:/path/to/root'
self.settings.root = ''
self.settings.tests_folder = 'tests/unit'
self.command.test_file_exists('C:/path/to/root/path/to/file.php', self.window)
self.assertEqual('C:/path/to/root/tests/unit/path/to/fileTest.php', self.os_path.<API key>)
def <API key>(self):
self.window.project_root = 'C:/path/to/root/'
self.settings.root = ''
self.settings.tests_folder = 'tests/unit'
self.command.test_file_exists('C:/path/to/root/path/to/file.php', self.window)
self.assertEqual('C:/path/to/root/tests/unit/path/to/fileTest.php', self.os_path.<API key>)
def <API key>(self):
self.settings.root = 'C:/path/to/root/'
self.settings.tests_folder = 'tests/unit'
self.os_path.is_file_returns = True
self.assertTrue(self.command.test_file_exists('C:/path/to/root/path/to/file.php', self.window))
def <API key>(self):
self.settings.root = 'C:/path/to/root/'
self.settings.tests_folder = 'tests/unit'
self.os_path.is_file_returns = True
self.assertTrue(self.command.test_file_exists('C:/path/to/root/tests/unit/path/to/fileTest.php', self.window))
self.assertEqual('C:/path/to/root/tests/unit/path/to/fileTest.php', self.os_path.<API key>,
'Expected test file filepath as parameter to isfile')
def <API key>(self):
self.settings.root = 'C:/path/to/root/'
self.settings.tests_folder = 'tests/unit'
self.os_path.is_file_returns = False
self.assertFalse(self.command.test_file_exists('C:/path/to/root/path/to/file.php', self.window))
def <API key>(self):
self.window.project_root = 'C:\\path\\to\\root'
self.settings.root = ''
self.settings.tests_folder = 'tests\\unit'
self.command.test_file_exists('C:\\path\\to\\root\\path\\to\\file.php', self.window)
self.assertEqual('C:/path/to/root/tests/unit/path/to/fileTest.php', self.os_path.<API key>)
class PluginSettingsStub:
pass
class WindowSpy:
def __init__(self):
self.file_to_open = None
self.project_root = None
def folders(self):
return [self.project_root]
def open_file(self, file_to_open):
self.file_to_open = file_to_open
class OsPathSpy:
def __init__(self):
self.is_file_returns = None
self.<API key> = None
def isfile(self, filepath):
self.<API key> = filepath
return self.is_file_returns
class SublimeSpy:
pass
|
# keyclic_sdk_api.model.<API key>
## Load the model package
dart
import 'package:keyclic_sdk_api/api.dart';
## Properties
Name | Type | Description | Notes
**mapping** | [**<API key>**](<API key>.md) | | [optional] [default to null]
[[Back to Model list]](../README.md#<API key>) [[Back to API list]](../README.md#<API key>) [[Back to README]](../README.md)
|
<?php
use app\models\ModelEvents;
class ModelEventsTest extends <API key>
{
}
|
#include <cstdio>
#include <iostream>
#include <stack>
using namespace std;
struct inf
{
int p, v;
};
int nums, totes, mint, stval;
int nlist[1000005], tol[1000005], tor[1000005], seen[1000005];
inf lastnp[1000005];
int main()
{
scanf("%d", &nums);
for(int i=1; i<=nums; i++)
scanf("%d", &nlist[i]);
for(int i=1; i<=nums; i++)
{
while(stval && lastnp[stval].v%nlist[i]==0)
stval
if(stval)
tol[i]=lastnp[stval].p+1;
else
tol[i]=1;
stval++;
lastnp[stval]={i, nlist[i]};
}
stval=0;
for(int i=nums; i; i
{
while(stval && lastnp[stval].v%nlist[i]==0)
stval
if(stval)
tor[i]=lastnp[stval].p-1;
else
tor[i]=nums;
stval++;
lastnp[stval]={i, nlist[i]};
}
for(int i=1; i<=nums; i++)
{
if(tor[i]-tol[i]+1>tor[totes]-tol[totes]+1)
totes=i;
}
for(int i=1; i<=nums; i++)
{
if(tor[i]-tol[i]+1==tor[totes]-tol[totes]+1 && !seen[tol[i]])
seen[tol[i]]=1, mint++;
}
printf("%d %d\n", mint, tor[totes]-tol[totes]);
for(int i=1; i<=nums; i++)
{
if(seen[i])
printf("%d ", i);
}
printf("\n");
return 0;
}
|
package co.edu.uniandes.ecos.tarea4.util;
/**
* Clase utilitaria de constantes
* @author Daniel
*/
public class Constantes {
public static final String LOC_METHOD_DATA = "LOC/Method Data";
public static final String PGS_CHAPTER = "Pgs/Chapter";
public static final String CLASS_NAME = "Class Name";
public static final String PAGES = "Pages";
}
|
<?php
if (!class_exists('Paymentwall_Config'))
include(getcwd() . '/components/gateways/lib/paymentwall-php/lib/paymentwall.php');
class Brick extends NonmerchantGateway
{
/**
* @var string The version of this Gateway
*/
private static $version = "1.0.0";
/**
* @var string The authors of this Gateway
*/
private static $authors = array(array('name' => "Paymentwall, Inc.", 'url' => "https:
/**
* @var array An array of meta data for this Gateway
*/
private $meta;
/**
* Construct a new merchant Gateway
*/
public function __construct()
{
// Load components required by this module
Loader::loadComponents($this, array("Input"));
// Load the language required by this module
Language::loadLang("brick", null, dirname(__FILE__) . DS . "language" . DS);
}
/**
* Initial Paymentwall settings
*/
public function <API key>()
{
Paymentwall_Config::getInstance()->set(array(
'public_key' => $this->meta['test_mode'] ? $this->meta['public_test_key'] : $this->meta['public_key'],
'private_key' => $this->meta['test_mode'] ? $this->meta['private_test_key'] : $this->meta['private_key']
));
}
/**
* Attempt to install this Gateway
*/
public function install()
{
// Ensure that the system has support for the JSON extension
if (!function_exists("json_decode")) {
$errors = array(
'json' => array(
'required' => Language::_("Brick.!error.json_required", true)
)
);
$this->Input->setErrors($errors);
}
}
/**
* Returns the name of this Gateway
*
* @return string The common name of this Gateway
*/
public function getName()
{
return Language::_("Brick.name", true);
}
/**
* Returns the version of this Gateway
*
* @return string The current version of this Gateway
*/
public function getVersion()
{
return self::$version;
}
/**
* Returns the name and URL for the authors of this Gateway
*
* @return array The name and URL of the authors of this Gateway
*/
public function getAuthors()
{
return self::$authors;
}
/**
* Return all currencies supported by this Gateway
*
* @return array A numerically indexed array containing all currency codes (ISO 4217 format) this Gateway supports
*/
public function getCurrencies()
{
$currencies = array();
$record = new Record();
$result = $record->select("code")->from("currencies")->fetchAll();
foreach ($result as $currency) {
$currencies[] = $currency->code;
}
unset($record);
return $currencies;
}
/**
* Sets the currency code to be used for all subsequent payments
*
* @param string $currency The ISO 4217 currency code to be used for subsequent payments
*/
public function setCurrency($currency)
{
$this->currency = $currency;
}
public function getSignupUrl()
{
return "https://api.paymentwall.com/pwaccount/signup?source=blesta&mode=merchant";
}
/**
* Create and return the view content required to modify the settings of this gateway
*
* @param array $meta An array of meta (settings) data belonging to this gateway
* @return string HTML content containing the fields to update the meta data for this gateway
*/
public function getSettings(array $meta = null)
{
$this->view = $this->makeView("settings", "default", str_replace(ROOTWEBDIR, "", dirname(__FILE__) . DS));
// Load the helpers required for this view
Loader::loadHelpers($this, array("Form", "Html"));
$this->view->set("meta", $meta);
return $this->view->fetch();
}
/**
* Validates the given meta (settings) data to be updated for this Gateway
*
* @param array $meta An array of meta (settings) data to be updated for this Gateway
* @return array The meta data to be updated in the database for this Gateway, or reset into the form on failure
*/
public function editSettings(array $meta)
{
// Verify meta data is valid
$rules = array(
'public_key' => array(
'empty' => array(
'rule' => "isEmpty",
'negate' => true,
'message' => Language::_("Brick.!error.public_key.valid", true),
'post_format' => 'trim'
)
),
'private_key' => array(
'empty' => array(
'rule' => "isEmpty",
'negate' => true,
'message' => Language::_("Brick.!error.private_key.valid", true),
'post_format' => 'trim'
)
),
'test_mode' => array(
'valid' => array(
'if_set' => true,
'rule' => array("in_array", array("true", "false")),
'message' => Language::_("Brick.!error.test_mode.valid", true)
)
)
);
// Set checkbox if not set
if (!isset($meta['test_mode']))
$meta['test_mode'] = "false";
$this->Input->setRules($rules);
// Validate the given meta data to ensure it meets the requirements
$this->Input->validates($meta);
// Return the meta data, no changes required regardless of success or failure for this Gateway
return $meta;
}
/**
* Returns an array of all fields to encrypt when storing in the database
*
* @return array An array of the field names to encrypt when storing in the database
*/
public function encryptableFields()
{
return array(
"public_key",
"private_key",
"public_test_key",
"private_test_key",
);
}
/**
* Sets the meta data for this particular Gateway
*
* @param array $meta An array of meta data to set for this Gateway
*/
public function setMeta(array $meta = null)
{
$this->meta = $meta;
}
/**
* @param $contact
* @return array
*/
private function <API key>($contact)
{
return array(
'customer[city]' => $contact->city,
'customer[state]' => $contact->state,
'customer[address]' => $contact->address1,
'customer[country]' => $contact->country,
'customer[zip]' => $contact->zip,
'customer[username]' => $contact->email,
'customer[firstname]' => $contact->first_name,
'customer[lastname]' => $contact->last_name,
);
}
/**
* Validates the incoming POST/GET response from the gateway to ensure it is
* legitimate and can be trusted.
*
* @param array $get The GET data for this request
* @param array $post The POST data for this request
* @return array An array of transaction data, sets any errors using Input if the data fails to validate
* - client_id The ID of the client that attempted the payment
* - amount The amount of the payment
* - currency The currency of the payment
* - invoices An array of invoices and the amount the payment should be applied to (if any) including:
* - id The ID of the invoice to apply to
* - amount The amount to apply to the invoice
* - status The status of the transaction (approved, declined, void, pending, reconciled, refunded, returned)
* - reference_id The reference ID for gateway-only use with this transaction (optional)
* - transaction_id The ID returned by the gateway to identify this transaction
* - <API key> The ID returned by the gateway to identify this transaction's original transaction (in the case of refunds)
*/
public function validate(array $get, array $post)
{
if(!isset($get['data'])) return false;
$data = $this->decodeData($get['data']);
unset($get['data']);
list($company_id, $payment_method) = $get;
if ($payment_method != 'brick') return false;
$brick = $post['brick'];
$this-><API key>();
$status = 'error';
$cardInfo = array(
'email' => $data['email'],
'amount' => $data['amount'],
'currency' => $data['currency'],
'description' => $data['description'],
'token' => $brick['token'],
'fingerprint' => $brick['fingerprint'],
);
$charge = new Paymentwall_Charge();
$charge->create($cardInfo);
$response = json_decode($charge->getPublicData(), true);
if ($charge->isSuccessful()) {
if ($charge->isCaptured()) {
// deliver a product
$status = 'approved';
} elseif ($charge->isUnderReview()) {
// decide on risk charge
$status = 'pending';
}
} else {
$_SESSION['brick_errors'] = $response['error']['message'];
}
return array(
'client_id' => $data['client_id'],
'amount' => $data['amount'],
'currency' => $data['currency'],
'status' => $status,
'reference_id' => null,
'transaction_id' => $charge->getId() ? $charge->getId() : false,
'<API key>' => null,
'invoices' => $data['invoices'] // optional
);
}
/**
* Returns data regarding a success transaction. This method is invoked when
* a client returns from the non-merchant gateway's web site back to Blesta.
*
* @param array $get The GET data for this request
* @param array $post The POST data for this request
* @return array An array of transaction data, may set errors using Input if the data appears invalid
* - client_id The ID of the client that attempted the payment
* - amount The amount of the payment
* - currency The currency of the payment
* - invoices An array of invoices and the amount the payment should be applied to (if any) including:
* - id The ID of the invoice to apply to
* - amount The amount to apply to the invoice
* - status The status of the transaction (approved, declined, void, pending, reconciled, refunded, returned)
* - transaction_id The ID returned by the gateway to identify this transaction
* - <API key> The ID returned by the gateway to identify this transaction's original transaction
*/
public function success(array $get, array $post)
{
if(isset($_SESSION['brick_errors']) && $_SESSION['brick_errors']){
$this->Input->setErrors(array(
array(
'general' => $_SESSION['brick_errors']
)
));
unset($_SESSION['brick_errors']);
}
return array(
'client_id' => $this->ifSet($post['client_id']),
'amount' => $this->ifSet($post['total']),
'currency' => $this->ifSet($post['currency_code']),
'invoices' => null,
'status' => "approved",
'transaction_id' => $this->ifSet($post['order_number']),
'<API key>' => null
);
}
/**
* Returns all HTML markup required to render an authorization and capture payment form
*
* @param array $contact_info An array of contact info including:
* - id The contact ID
* - client_id The ID of the client this contact belongs to
* - user_id The user ID this contact belongs to (if any)
* - contact_type The type of contact
* - contact_type_id The ID of the contact type
* - first_name The first name on the contact
* - last_name The last name on the contact
* - title The title of the contact
* - company The company name of the contact
* - address1 The address 1 line of the contact
* - address2 The address 2 line of the contact
* - city The city of the contact
* - state An array of state info including:
* - code The 2 or 3-character state code
* - name The local name of the country
* - country An array of country info including:
* - alpha2 The 2-character country code
* - alpha3 The 3-character country code
* - name The english name of the country
* - alt_name The local name of the country
* - zip The zip/postal code of the contact
* @param float $amount The amount to charge this contact
* @param array $invoice_amounts An array of invoices, each containing:
* - id The ID of the invoice being processed
* - amount The amount being processed for this invoice (which is included in $amount)
* @param array $options An array of options including:
* - description The Description of the charge
* - return_url The URL to redirect users to after a successful payment
* - recur An array of recurring info including:
* - amount The amount to recur
* - term The term to recur
* - period The recurring period (day, week, month, year, onetime) used in conjunction with term in order to determine the next recurring payment
* @return string HTML markup required to render an authorization and capture payment form
*/
public function buildProcess(array $contact_info, $amount, array $invoice_amounts = null, array $options = null)
{
$this-><API key>();
$post_to = Configure::get("Blesta.gw_callback_url") . Configure::get("Blesta.company_id") . "/brick/";
$fields = array();
$contact = false;
// Set contact email address and phone number
if ($this->ifSet($contact_info['id'], false)) {
Loader::loadModels($this, array("Contacts"));
$contact = $this->Contacts->get($contact_info['id']);
} else {
return "Contact information invalid!";
}
$data = array(
'public_key' => Paymentwall_Config::getInstance()->getPublicKey(),
'amount' => $amount,
'merchant' => $this->ifSet($this->meta['merchant_name'], 'Blesta'),
'product_name' => $options['description'],
'currency' => $this->currency
);
$post_to .= "?data=" . $this->encodeData(array(
'client_id' => $contact->client_id,
'amount' => $amount,
'currency' => $this->currency,
'invoices' => $invoice_amounts,
'email' => $contact->email,
'description' => $options['description'],
));
$this->view = $this->makeView("process", "default", str_replace(ROOTWEBDIR, "", dirname(__FILE__) . DS));
$this->view->set("data", $data);
$this->view->set("post_to", $post_to);
$this->view->set("fields", $fields);
return $this->view->fetch();
}
/**
* @param array $data
* @return string
*/
private function encodeData($data = array())
{
return base64_encode(serialize($data));
}
/**
* @param $strData
* @return mixed
*/
private function decodeData($strData)
{
return unserialize(base64_decode($strData));
}
}
|
package org.butioy.framework.security;
import org.apache.commons.lang3.StringEscapeUtils;
import org.apache.commons.lang3.StringUtils;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.<API key>;
/**
* Created with IntelliJ IDEA.
* Author butioy
* Date 2015-09-18 22:33
*/
public class <API key> extends <API key> {
HttpServletRequest orgRequest = null;
public <API key>(HttpServletRequest request) {
super(request);
orgRequest = request;
}
/**
* getParameterxss
* super.getParameterValues(name)
* getParameterNames,getParameterValuesgetParameterMap
*/
@Override
public String getParameter(String name) {
String value = super.getParameter(xssEncode(name));
if(StringUtils.isNotBlank(value)) {
value = xssEncode(value);
}
return value;
}
/**
* getHeaderxss
* super.getHeaders(name)
* getHeaderNames
*/
@Override
public String getHeader(String name) {
String value = super.getHeader(xssEncode(name));
if( StringUtils.isNotBlank(value) ) {
value = xssEncode(value);
}
return value;
}
/**
* xssStringEscapeUtils
* @param value
* @return
*/
private static String xssEncode(String value) {
if (value == null || value.isEmpty()) {
return value;
}
value = StringEscapeUtils.escapeHtml4(value);
value = StringEscapeUtils.escapeEcmaScript(value);
return value;
}
/**
* request
* @return
*/
public HttpServletRequest getOrgRequest() {
return orgRequest;
}
/**
* request
* @return
*/
public static HttpServletRequest getOrgRequest(HttpServletRequest request) {
if (request instanceof <API key>) {
return ((<API key>) request).getOrgRequest();
}
return request;
}
}
|
#include <Esp.h>
#include "FS.h"
#ifdef ESP32
#include <SPIFFS.h>
#endif
#include "iotsaFilesUpload.h"
#ifdef IOTSA_WITH_WEB
void IotsaFilesUploadMod::setup() {
}
static File _uploadFile;
static bool _uploadOK;
void
IotsaFilesUploadMod::uploadHandler() {
if (needsAuthentication("uploadfiles")) return;
HTTPUpload& upload = server->upload();
_uploadOK = false;
if(upload.status == UPLOAD_FILE_START){
String _uploadfilename = "/data/" + upload.filename;
IFDEBUG IotsaSerial.print("Uploading ");
IFDEBUG IotsaSerial.println(_uploadfilename);
if(SPIFFS.exists(_uploadfilename)) SPIFFS.remove(_uploadfilename);
_uploadFile = SPIFFS.open(_uploadfilename, "w");
//DBG_OUTPUT_PORT.print("Upload: START, filename: "); DBG_OUTPUT_PORT.println(upload.filename);
} else if(upload.status == UPLOAD_FILE_WRITE){
if(_uploadFile) _uploadFile.write(upload.buf, upload.currentSize);
//DBG_OUTPUT_PORT.print("Upload: WRITE, Bytes: "); DBG_OUTPUT_PORT.println(upload.currentSize);
} else if(upload.status == UPLOAD_FILE_END){
if(_uploadFile) {
_uploadFile.close();
_uploadOK = true;
}
//DBG_OUTPUT_PORT.print("Upload: END, Size: "); DBG_OUTPUT_PORT.println(upload.totalSize);
}
}
void
IotsaFilesUploadMod::uploadOkHandler() {
String message;
if (_uploadOK) {
IFDEBUG IotsaSerial.println("upload ok");
server->send(200, "text/plain", "OK");
} else {
IFDEBUG IotsaSerial.println("upload failed");
server->send(403, "text/plain", "FAIL");
}
}
void IotsaFilesUploadMod::uploadFormHandler() {
if (needsAuthentication("uploadfiles")) return;
String message = "<form method='POST' action='/upload' enctype='multipart/form-data'>Select file to upload:<input type='file' name='blob'><br>Filename:<input name='filename'><br><input type='submit' value='Update'></form>";
server->send(200, "text/html", message);
}
void IotsaFilesUploadMod::serverSetup() {
server->on("/upload", HTTP_POST, std::bind(&IotsaFilesUploadMod::uploadOkHandler, this), std::bind(&IotsaFilesUploadMod::uploadHandler, this));
server->on("/upload", HTTP_GET, std::bind(&IotsaFilesUploadMod::uploadFormHandler, this));
}
String IotsaFilesUploadMod::info() {
return "<p>See <a href=\"/upload\">/upload</a> for uploading new files.</p>";
}
void IotsaFilesUploadMod::loop() {
}
#endif // IOTSA_WITH_WEB
|
<?php
declare(strict_types=1);
return [
'meta' => [
'title' => 'Static method call statement of a class imported with a use statement in a namespace',
// Default values. If not specified will be the one used
'prefix' => 'Humbug',
'whitelist' => [],
'exclude-namespaces' => [],
'<API key>' => true,
'<API key>' => false,
'<API key>' => true,
'exclude-constants' => [],
'exclude-classes' => [],
'exclude-functions' => [],
'registered-classes' => [],
'<API key>' => [],
],
'Static method call statement of a class belonging to the global namespace imported via a use statement' => <<<'PHP'
<?php
namespace {
class Foo {}
}
namespace A {
use Foo;
Foo::main();
}
-
<?php
namespace Humbug;
class Foo
{
}
namespace Humbug\A;
use Humbug\Foo;
Foo::main();
PHP
,
'FQ static method call statement of a class belonging to the global namespace imported via a use statement' => <<<'PHP'
<?php
namespace {
class Foo {}
}
namespace A {
use Foo;
\Foo::main();
}
-
<?php
namespace Humbug;
class Foo
{
}
namespace Humbug\A;
use Humbug\Foo;
\Humbug\Foo::main();
PHP
,
'Static method call statement of a class belonging to the global namespace which has been whitelisted' => <<<'PHP'
<?php
namespace A;
use Closure;
Closure::bind();
-
<?php
namespace Humbug\A;
use Closure;
Closure::bind();
PHP
,
'FQ static method call statement of a class belonging to the global namespace which has been whitelisted' => <<<'PHP'
<?php
namespace A;
use Closure;
\Closure::bind();
-
<?php
namespace Humbug\A;
use Closure;
\Closure::bind();
PHP
,
];
|
<?php
class Auth_Model extends CoreApp\DataModel {
public function __construct() {
parent::__construct();
$this->PDO = $this->database->PDOConnection(CoreApp\AppConfig::getData("database=>autchenticationDB"));
$this->database->PDOClose();
}
public function getLocation($la, $lo) {
//Send request and receive json data by latitude and longitude
$url = 'http://maps.googleapis.com/maps/api/geocode/json?latlng='.trim($la).','.trim($lo).'&sensor=false';
$json = @file_get_contents($url);
$data = json_decode($json);
$status = $data->status;
if($status=="OK"){
//Get address from json data
$location = $data->results[0]->formatted_address;
}
else{
$location = "We're not able to get your position.";
}
//Print address
echo $location;
}
public function newAttemptUser($data) {
//Creating the new Attempt User
$a = new CoreApp\AttemptUser();
//Setting it's properties
$a->aemail = $data["ema"];
$a->apassword = $data["passw"];
$a->devicekey = $data["dk"];
$a->lalo = $data["lalo"];
//XSS, INJECTION ECT...
$a->prepareCredentials();
//return to the attemptuser
return $a;
}
}
|
package lua
type lValueArraySorter struct {
L *LState
Fn *LFunction
Values []LValue
}
func (lv lValueArraySorter) Len() int {
return len(lv.Values)
}
func (lv lValueArraySorter) Swap(i, j int) {
lv.Values[i], lv.Values[j] = lv.Values[j], lv.Values[i]
}
func (lv lValueArraySorter) Less(i, j int) bool {
if lv.Fn != nil {
lv.L.Push(lv.Fn)
lv.L.Push(lv.Values[i])
lv.L.Push(lv.Values[j])
lv.L.Call(2, 1)
return LVAsBool(lv.L.reg.Pop())
}
return lessThan(lv.L, lv.Values[i], lv.Values[j])
}
func newLTable(acap int, hcap int) *LTable {
if acap < 0 {
acap = 0
}
if hcap < 0 {
hcap = 0
}
tb := <able{
array: make([]LValue, 0, acap),
dict: make(map[LValue]LValue, hcap),
keys: nil,
k2i: nil,
Metatable: LNil,
}
return tb
}
func (tb *LTable) Len() int {
var prev LValue = LNil
for i := len(tb.array) - 1; i >= 0; i
v := tb.array[i]
if prev == LNil && v != LNil {
return i + 1
}
prev = v
}
return 0
}
func (tb *LTable) Append(value LValue) {
tb.array = append(tb.array, value)
}
func (tb *LTable) Insert(i int, value LValue) {
if i > len(tb.array) {
tb.RawSetInt(i, value)
return
}
if i <= 0 {
tb.RawSet(LNumber(i), value)
return
}
i -= 1
tb.array = append(tb.array, LNil)
copy(tb.array[i+1:], tb.array[i:])
tb.array[i] = value
}
func (tb *LTable) MaxN() int {
for i := len(tb.array) - 1; i >= 0; i
if tb.array[i] != LNil {
return i
}
}
return 0
}
func (tb *LTable) Remove(pos int) {
i := pos - 1
larray := len(tb.array)
switch {
case i >= larray:
return
case i == larray-1 || i < 0:
tb.array = tb.array[:larray-1]
default:
copy(tb.array[i:], tb.array[i+1:])
tb.array[larray-1] = nil
tb.array = tb.array[:larray-1]
}
}
func (tb *LTable) RawSet(key LValue, value LValue) {
switch v := key.(type) {
case LNumber:
if isArrayKey(v) {
index := int(v) - 1
alen := len(tb.array)
switch {
case index == alen:
tb.array = append(tb.array, value)
case index > alen:
for i := 0; i < (index - alen); i++ {
tb.array = append(tb.array, LNil)
}
tb.array = append(tb.array, value)
case index < alen:
tb.array[index] = value
}
return
}
}
tb.dict[key] = value
}
func (tb *LTable) RawSetInt(key int, value LValue) {
if key < 1 || key >= MaxArrayIndex {
tb.dict[LNumber(key)] = value
return
}
index := key - 1
alen := len(tb.array)
switch {
case index == alen:
tb.array = append(tb.array, value)
case index > alen:
for i := 0; i < (index - alen); i++ {
tb.array = append(tb.array, LNil)
}
tb.array = append(tb.array, value)
case index < alen:
tb.array[index] = value
}
}
func (tb *LTable) RawSetH(key LValue, value LValue) {
tb.dict[key] = value
}
func (tb *LTable) RawGet(key LValue) LValue {
switch v := key.(type) {
case LNumber:
if isArrayKey(v) {
index := int(v) - 1
if index >= len(tb.array) {
return LNil
}
return tb.array[index]
}
}
if v, ok := tb.dict[key]; ok {
return v
}
return LNil
}
func (tb *LTable) RawGetInt(key int) LValue {
index := int(key) - 1
if index >= len(tb.array) {
return LNil
}
return tb.array[index]
}
func (tb *LTable) RawGetH(key LValue) LValue {
if v, ok := tb.dict[key]; ok {
return v
}
return LNil
}
func (tb *LTable) ForEach(cb func(LValue, LValue)) {
for i, v := range tb.array {
if v != LNil {
cb(LNumber(i+1), v)
}
}
for k, v := range tb.dict {
if v != LNil {
cb(k, v)
}
}
}
func (tb *LTable) Next(key LValue) (LValue, LValue) {
// TODO: inefficient way
if key == LNil {
tb.keys = nil
tb.k2i = nil
key = LNumber(0)
}
if tb.keys == nil {
tb.keys = make([]LValue, len(tb.dict))
tb.k2i = make(map[LValue]int)
i := 0
for k, _ := range tb.dict {
tb.keys[i] = k
tb.k2i[k] = i
i++
}
}
if kv, ok := key.(LNumber); ok && isInteger(kv) && int(kv) >= 0 {
index := int(kv)
for ; index < len(tb.array); index++ {
if v := tb.array[index]; v != LNil {
return LNumber(index + 1), v
}
}
if index == len(tb.array) {
if len(tb.dict) == 0 {
tb.keys = nil
tb.k2i = nil
return LNil, LNil
}
key = tb.keys[0]
if v := tb.dict[key]; v != LNil {
return key, v
}
}
}
for i := tb.k2i[key] + 1; i < len(tb.dict); i++ {
key = tb.keys[i]
if v := tb.dict[key]; v != LNil {
return key, v
}
}
tb.keys = nil
tb.k2i = nil
return LNil, LNil
}
|
require("kaoscript/register");
var Type = require("@kaoscript/runtime").Type;
module.exports = function() {
var Shape = require("../export/export.class.default.ks")().Shape;
function foobar() {
if(arguments.length === 1 && Type.isString(arguments[0])) {
let __ks_i = -1;
let x = arguments[++__ks_i];
if(x === void 0 || x === null) {
throw new TypeError("'x' is not nullable");
}
else if(!Type.isString(x)) {
throw new TypeError("'x' is not of type 'String'");
}
return x;
}
else if(arguments.length === 1) {
let __ks_i = -1;
let x = arguments[++__ks_i];
if(x === void 0 || x === null) {
throw new TypeError("'x' is not nullable");
}
else if(!Type.isClassInstance(x, Shape)) {
throw new TypeError("'x' is not of type 'Shape'");
}
return x;
}
else {
throw new SyntaxError("Wrong number of arguments");
}
};
return {
foobar: foobar
};
};
|
/**
* Node class
* @param {object} value
* @constructor
*/
class Node {
constructor(value) {
this._data = value;
}
value() {
return this._data;
}
}
export default Node;
|
There is no magic for Rails' `enum` in fixtures. If you want to use the string value (which is the entire point of using the enum), you need to ERB it up. Something like
{% highlight yaml %}
michael:
name: Michael Bluth
occupation: <%= Person.occupations[:actor] %> # because 'actor' won't do it
{% endhighlight %}
|
<!DOCTYPE html>
<html lang="en">
<head>
@include('includes.head')
</head>
<body>
<div id="wrapper">
<header>
@include('includes.navbar')
</header>
<div class="container">
<div class="row">
<!-- main content -->
<div id="content" class="col-md-9">
@yield('content')
</div>
<!-- sidebar content -->
<div id="sidebarRight" class="col-md-3 sidebar">
@include('includes/messages')
@yield('sidebarRight')
</div>
</div>
</div>
</div>
<footer id="footer">
@include('includes.footer')
</footer>
</body>
</html>
|
package com.felhr.<API key>.bulkonlytests;
import android.hardware.usb.UsbConstants;
import android.hardware.usb.UsbDevice;
import android.hardware.usb.UsbDeviceConnection;
import android.hardware.usb.UsbInterface;
import com.felhr.<API key>.bulkonly.UsbFacade;
import com.felhr.<API key>.bulkonly.UsbFacadeInterface;
import android.hardware.usb.UsbEndpoint;
import android.test.<API key>;
import android.util.Log;
import org.junit.Test;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.junit.Before;
public class UsbFacadeTest extends <API key>
{
private UsbFacade usbFacade;
// Mocked Usb objects
@Mock
private UsbDeviceConnection mConnection;
private UsbDevice mDevice;
private UsbInterface ifaceMocked;
private UsbEndpoint mockedInEndpoint;
private UsbEndpoint mockedOutEndpoint;
@Before
public void setUp()
{
System.setProperty("dexmaker.dexcache",
getInstrumentation().getTargetContext().getCacheDir().getPath());
initUsb(0);
}
@Test
public void testOpenDevice()
{
assertEquals(true, usbFacade.openDevice());
}
@Test
public void testSendCommand()
{
usbFacade.openDevice();
waitXtime(1000);
changeBulkMethod(31);
usbFacade.sendCommand(new byte[31]);
waitXtime(1000);
}
@Test
public void testSendData()
{
usbFacade.openDevice();
changeBulkMethod(10);
usbFacade.sendData(new byte[]{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09});
}
@Test
public void testRequestCsw()
{
usbFacade.openDevice();
waitXtime(1000); // A handler must be declared inside a thread. This prevents a nullPointer
usbFacade.requestCsw();
}
@Test
public void testRequestData()
{
usbFacade.openDevice();
waitXtime(1000);
usbFacade.requestData(50);
}
private void initUsb(int bulkResponse)
{
mConnection = Mockito.mock(UsbDeviceConnection.class);
mDevice = Mockito.mock(UsbDevice.class);
// UsbInterface Mass storage device, Must be injected using a setter.
ifaceMocked = Mockito.mock(UsbInterface.class);
Mockito.when(ifaceMocked.getInterfaceClass()).thenReturn(UsbConstants.<API key>);
Mockito.when(ifaceMocked.<API key>()).thenReturn(0x06);
Mockito.when(ifaceMocked.<API key>()).thenReturn(0x50);
Mockito.when(ifaceMocked.getEndpointCount()).thenReturn(0);
// UsbEndpoints IN,OUT. Must be injected using a setter
mockedInEndpoint = Mockito.mock(UsbEndpoint.class);
mockedOutEndpoint = Mockito.mock(UsbEndpoint.class);
// UsbDeviceConnection mocked methods
Mockito.when(mConnection.claimInterface(ifaceMocked, true)).thenReturn(true);
Mockito.when(mConnection.bulkTransfer(Mockito.any(UsbEndpoint.class), Mockito.any(byte[].class) ,Mockito.anyInt(), Mockito.anyInt())).thenReturn(bulkResponse);
// UsbDevice mocked methods
Mockito.when(mDevice.getInterfaceCount()).thenReturn(1);
// Initialize and inject dependencies
usbFacade = new UsbFacade(mDevice, mConnection);
usbFacade.setCallback(mCallback);
usbFacade.injectInterface(ifaceMocked);
usbFacade.injectInEndpoint(mockedInEndpoint);
usbFacade.injectOutEndpoint(mockedOutEndpoint);
}
private void changeBulkMethod(int response)
{
Mockito.when(mConnection.bulkTransfer(Mockito.any(UsbEndpoint.class), Mockito.any(byte[].class) , Mockito.anyInt(), Mockito.anyInt())).thenReturn(response);
}
private synchronized void waitXtime(long millis)
{
try
{
wait(millis);
}catch(<API key> e)
{
e.printStackTrace();
}
}
private UsbFacadeInterface mCallback = new UsbFacadeInterface()
{
@Override
public void cbwResponse(int response)
{
Log.d("UsbFacadeTest", "cbwResponse: " + String.valueOf(response));
}
@Override
public void cswData(byte[] data)
{
Log.d("UsbFacadeTest", "cswData: " + String.valueOf(data.length));
}
@Override
public void dataFromHost(int response)
{
Log.d("UsbFacadeTest", "Data from Host response: " + String.valueOf(response));
}
@Override
public void dataToHost(byte[] data)
{
Log.d("UsbFacadeTest", "Length buffer: " + String.valueOf(data.length));
}
};
}
|
<?php declare(strict_types=1);
namespace Monolog\Handler;
use MongoDB\Driver\Manager;
use Monolog\Test\TestCase;
use Monolog\Formatter\NormalizerFormatter;
class MongoDBHandlerTest extends TestCase
{
public function <API key>()
{
$this->expectException(\<API key>::class);
new MongoDBHandler(new \stdClass, 'db', 'collection');
}
public function <API key>()
{
if (!(class_exists('MongoDB\Client'))) {
$this->markTestSkipped('mongodb/mongodb not installed');
}
$mongodb = $this->getMockBuilder('MongoDB\Client')
-><API key>()
->getMock();
$collection = $this->getMockBuilder('MongoDB\Collection')
-><API key>()
->getMock();
$mongodb->expects($this->once())
->method('selectCollection')
->with('db', 'collection')
->will($this->returnValue($collection));
$record = $this->getRecord();
$expected = $record;
$expected['datetime'] = $record['datetime']->format(NormalizerFormatter::SIMPLE_DATE);
$collection->expects($this->once())
->method('insertOne')
->with($expected);
$handler = new MongoDBHandler($mongodb, 'db', 'collection');
$handler->handle($record);
}
public function <API key>()
{
if (!(class_exists('MongoDB\Driver\Manager'))) {
$this->markTestSkipped('ext-mongodb not installed');
}
$mongodb = new Manager('mongodb://localhost:27017');
$handler = new MongoDBHandler($mongodb, 'test', 'monolog');
$record = $this->getRecord();
try {
$handler->handle($record);
} catch (\RuntimeException $e) {
$this->markTestSkipped('Could not connect to MongoDB server on mongodb://localhost:27017');
}
}
}
|
import URL from 'url';
import * as packageCache from '../../util/cache/package';
import { GitlabHttp } from '../../util/http/gitlab';
import type { GetReleasesConfig, ReleaseResult } from '../types';
import type { GitlabTag } from './types';
const gitlabApi = new GitlabHttp();
export const id = 'gitlab-tags';
export const <API key> = true;
export const defaultRegistryUrls = ['https://gitlab.com'];
export const registryStrategy = 'first';
const cacheNamespace = 'datasource-gitlab';
function getCacheKey(depHost: string, repo: string): string {
const type = 'tags';
return `${depHost}:${repo}:${type}`;
}
export async function getReleases({
registryUrl: depHost,
lookupName: repo,
}: GetReleasesConfig): Promise<ReleaseResult | null> {
const cachedResult = await packageCache.get<ReleaseResult>(
cacheNamespace,
getCacheKey(depHost, repo)
);
// istanbul ignore if
if (cachedResult) {
return cachedResult;
}
const urlEncodedRepo = encodeURIComponent(repo);
// tag
const url = URL.resolve(
depHost,
`/api/v4/projects/${urlEncodedRepo}/repository/tags?per_page=100`
);
const gitlabTags = (
await gitlabApi.getJson<GitlabTag[]>(url, {
paginate: true,
})
).body;
const dependency: ReleaseResult = {
sourceUrl: URL.resolve(depHost, repo),
releases: null,
};
dependency.releases = gitlabTags.map(({ name, commit }) => ({
version: name,
gitRef: name,
releaseTimestamp: commit?.created_at,
}));
const cacheMinutes = 10;
await packageCache.set(
cacheNamespace,
getCacheKey(depHost, repo),
dependency,
cacheMinutes
);
return dependency;
}
|
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
// all copies or substantial portions of the Software.
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#if WINDOWS_PHONE && !<API key>
#define USE_CSHARP_SQLITE
#endif
using System;
using System.Collections;
using System.Diagnostics;
#if !USE_SQLITEPCL_RAW
using System.Runtime.InteropServices;
#endif
using System.Collections.Generic;
using System.Reflection;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading;
#if USE_CSHARP_SQLITE
using Sqlite3 = Community.CsharpSqlite.Sqlite3;
using <API key> = Community.CsharpSqlite.Sqlite3.sqlite3;
using Sqlite3Statement = Community.CsharpSqlite.Sqlite3.Vdbe;
#elif <API key>
using Sqlite3 = Sqlite.Sqlite3;
using <API key> = Sqlite.Database;
using Sqlite3Statement = Sqlite.Statement;
#elif USE_SQLITEPCL_RAW
using <API key> = SQLitePCL.sqlite3;
using Sqlite3BackupHandle = SQLitePCL.sqlite3_backup;
using Sqlite3Statement = SQLitePCL.sqlite3_stmt;
using Sqlite3 = SQLitePCL.raw;
#else
using <API key> = System.IntPtr;
using Sqlite3BackupHandle = System.IntPtr;
using Sqlite3Statement = System.IntPtr;
#endif
#pragma warning disable 1591 // XML Doc Comments
namespace SQLite
{
public class SQLiteException : Exception
{
public SQLite3.Result Result { get; private set; }
protected SQLiteException (SQLite3.Result r, string message) : base (message)
{
Result = r;
}
public static SQLiteException New (SQLite3.Result r, string message)
{
return new SQLiteException (r, message);
}
}
public class <API key> : SQLiteException
{
public IEnumerable<TableMapping.Column> Columns { get; protected set; }
protected <API key> (SQLite3.Result r, string message)
: this (r, message, null, null)
{
}
protected <API key> (SQLite3.Result r, string message, TableMapping mapping, object obj)
: base (r, message)
{
if (mapping != null && obj != null) {
this.Columns = from c in mapping.Columns
where c.IsNullable == false && c.GetValue (obj) == null
select c;
}
}
public static new <API key> New (SQLite3.Result r, string message)
{
return new <API key> (r, message);
}
public static <API key> New (SQLite3.Result r, string message, TableMapping mapping, object obj)
{
return new <API key> (r, message, mapping, obj);
}
public static <API key> New (SQLiteException exception, TableMapping mapping, object obj)
{
return new <API key> (exception.Result, exception.Message, mapping, obj);
}
}
[Flags]
public enum SQLiteOpenFlags
{
ReadOnly = 1, ReadWrite = 2, Create = 4,
NoMutex = 0x8000, FullMutex = 0x10000,
SharedCache = 0x20000, PrivateCache = 0x40000,
ProtectionComplete = 0x00100000,
<API key> = 0x00200000,
<API key> = 0x00300000,
ProtectionNone = 0x00400000
}
[Flags]
public enum CreateFlags
{
<summary>
Use the default creation options
</summary>
None = 0x000,
<summary>
Create a primary key index for a property called 'Id' (case-insensitive).
This avoids the need for the [PrimaryKey] attribute.
</summary>
ImplicitPK = 0x001,
<summary>
Create indices for properties ending in 'Id' (case-insensitive).
</summary>
ImplicitIndex = 0x002,
<summary>
Create a primary key for a property called 'Id' and
create an indices for properties ending in 'Id' (case-insensitive).
</summary>
AllImplicit = 0x003,
<summary>
Force the primary key property to be auto incrementing.
This avoids the need for the [AutoIncrement] attribute.
The primary key property on the class should have type int or long.
</summary>
AutoIncPK = 0x004,
<summary>
Create virtual table using FTS3
</summary>
FullTextSearch3 = 0x100,
<summary>
Create virtual table using FTS4
</summary>
FullTextSearch4 = 0x200
}
<summary>
An open connection to a SQLite database.
</summary>
[Preserve (AllMembers = true)]
public partial class SQLiteConnection : IDisposable
{
private bool _open;
private TimeSpan _busyTimeout;
readonly static Dictionary<string, TableMapping> _mappings = new Dictionary<string, TableMapping> ();
private System.Diagnostics.Stopwatch _sw;
private long <API key> = 0;
private int _transactionDepth = 0;
private Random _rand = new Random ();
public <API key> Handle { get; private set; }
static readonly <API key> NullHandle = default (<API key>);
static readonly Sqlite3BackupHandle NullBackupHandle = default (Sqlite3BackupHandle);
<summary>
Gets the database path used by this connection.
</summary>
public string DatabasePath { get; private set; }
<summary>
Gets the SQLite library version number. 3007014 would be v3.7.14
</summary>
public int LibVersionNumber { get; private set; }
<summary>
Whether Trace lines should be written that show the execution time of queries.
</summary>
public bool TimeExecution { get; set; }
<summary>
Whether to write queries to <see cref="Tracer"/> during execution.
</summary>
public bool Trace { get; set; }
<summary>
The delegate responsible for writing trace lines.
</summary>
<value>The tracer.</value>
public Action<string> Tracer { get; set; }
<summary>
Whether to store DateTime properties as ticks (true) or strings (false).
</summary>
public bool <API key> { get; private set; }
<summary>
Whether to store TimeSpan properties as ticks (true) or strings (false).
</summary>
public bool <API key> { get; private set; }
<summary>
The format to use when storing DateTime properties as strings. Ignored if <API key> is true.
</summary>
<value>The date time string format.</value>
public string <API key> { get; private set; }
<summary>
The DateTimeStyles value to use when parsing a DateTime property string.
</summary>
<value>The date time style.</value>
internal System.Globalization.DateTimeStyles DateTimeStyle { get; private set; }
#if USE_SQLITEPCL_RAW && !<API key>
static SQLiteConnection ()
{
SQLitePCL.Batteries_V2.Init ();
}
#endif
<summary>
Constructs a new SQLiteConnection and opens a SQLite database specified by databasePath.
</summary>
<param name="databasePath">
Specifies the path to the database file.
</param>
<param name="<API key>">
Specifies whether to store DateTime properties as ticks (true) or strings (false). You
absolutely do want to store them as Ticks in all new projects. The value of false is
only here for backwards compatibility. There is a *significant* speed advantage, with no
down sides, when setting <API key> = true.
If you use DateTimeOffset properties, it will be always stored as ticks regardingless
the <API key> parameter.
</param>
public SQLiteConnection (string databasePath, bool <API key> = true)
: this (new <API key> (databasePath, SQLiteOpenFlags.ReadWrite | SQLiteOpenFlags.Create, <API key>))
{
}
<summary>
Constructs a new SQLiteConnection and opens a SQLite database specified by databasePath.
</summary>
<param name="databasePath">
Specifies the path to the database file.
</param>
<param name="openFlags">
Flags controlling how the connection should be opened.
</param>
<param name="<API key>">
Specifies whether to store DateTime properties as ticks (true) or strings (false). You
absolutely do want to store them as Ticks in all new projects. The value of false is
only here for backwards compatibility. There is a *significant* speed advantage, with no
down sides, when setting <API key> = true.
If you use DateTimeOffset properties, it will be always stored as ticks regardingless
the <API key> parameter.
</param>
public SQLiteConnection (string databasePath, SQLiteOpenFlags openFlags, bool <API key> = true)
: this (new <API key> (databasePath, openFlags, <API key>))
{
}
<summary>
Constructs a new SQLiteConnection and opens a SQLite database specified by databasePath.
</summary>
<param name="connectionString">
Details on how to find and open the database.
</param>
public SQLiteConnection (<API key> connectionString)
{
if (connectionString == null)
throw new <API key> (nameof (connectionString));
if (connectionString.DatabasePath == null)
throw new <API key> ("DatabasePath must be specified");
DatabasePath = connectionString.DatabasePath;
LibVersionNumber = SQLite3.LibVersionNumber ();
#if NETFX_CORE
SQLite3.SetDirectory(/*temp directory type*/2, Windows.Storage.ApplicationData.Current.TemporaryFolder.Path);
#endif
<API key> handle;
#if SILVERLIGHT || USE_CSHARP_SQLITE || USE_SQLITEPCL_RAW
var r = SQLite3.Open (connectionString.DatabasePath, out handle, (int)connectionString.OpenFlags, connectionString.VfsName);
#else
// open using the byte[]
// in the case where the path may include Unicode
// force open to using UTF-8 using sqlite3_open_v2
var databasePathAsBytes = <API key> (connectionString.DatabasePath);
var r = SQLite3.Open (databasePathAsBytes, out handle, (int)connectionString.OpenFlags, connectionString.VfsName);
#endif
Handle = handle;
if (r != SQLite3.Result.OK) {
throw SQLiteException.New (r, String.Format ("Could not open database file: {0} ({1})", DatabasePath, r));
}
_open = true;
<API key> = connectionString.<API key>;
<API key> = connectionString.<API key>;
<API key> = connectionString.<API key>;
DateTimeStyle = connectionString.DateTimeStyle;
BusyTimeout = TimeSpan.FromSeconds (1.0);
Tracer = line => Debug.WriteLine (line);
connectionString.PreKeyAction?.Invoke (this);
if (connectionString.Key is string stringKey) {
SetKey (stringKey);
}
else if (connectionString.Key is byte[] bytesKey) {
SetKey (bytesKey);
}
else if (connectionString.Key != null) {
throw new <API key> ("Encryption keys must be strings or byte arrays");
}
connectionString.PostKeyAction?.Invoke (this);
}
<summary>
Enables the write ahead logging. WAL is significantly faster in most scenarios
by providing better concurrency and better disk IO performance than the normal
journal mode. You only need to call this function once in the lifetime of the database.
</summary>
public void <API key> ()
{
ExecuteScalar<string> ("PRAGMA journal_mode=WAL");
}
<summary>
Convert an input string to a quoted SQL string that can be safely used in queries.
</summary>
<returns>The quoted string.</returns>
<param name="unsafeString">The unsafe string to quote.</param>
static string Quote (string unsafeString)
{
if (unsafeString == null)
return "NULL";
var safe = unsafeString.Replace ("'", "''");
return "'" + safe + "'";
}
<summary>
Sets the key used to encrypt/decrypt the database with "pragma key = ...".
This must be the first thing you call before doing anything else with this connection
if your database is encrypted.
This only has an effect if you are using the SQLCipher nuget package.
</summary>
<param name="key">Ecryption key plain text that is converted to the real encryption key using PBKDF2 key derivation</param>
void SetKey (string key)
{
if (key == null)
throw new <API key> (nameof (key));
var q = Quote (key);
ExecuteScalar<string> ("pragma key = " + q);
}
<summary>
Sets the key used to encrypt/decrypt the database.
This must be the first thing you call before doing anything else with this connection
if your database is encrypted.
This only has an effect if you are using the SQLCipher nuget package.
</summary>
<param name="key">256-bit (32 byte) ecryption key data</param>
void SetKey (byte[] key)
{
if (key == null)
throw new <API key> (nameof (key));
if (key.Length != 32 && key.Length != 48)
throw new ArgumentException ("Key must be 32 bytes (256-bit) or 48 bytes (384-bit)", nameof (key));
var s = String.Join ("", key.Select (x => x.ToString ("X2")));
ExecuteScalar<string> ("pragma key = \"x'" + s + "'\"");
}
<summary>
Enable or disable extension loading.
</summary>
public void EnableLoadExtension (bool enabled)
{
SQLite3.Result r = SQLite3.EnableLoadExtension (Handle, enabled ? 1 : 0);
if (r != SQLite3.Result.OK) {
string msg = SQLite3.GetErrmsg (Handle);
throw SQLiteException.New (r, msg);
}
}
#if !USE_SQLITEPCL_RAW
static byte[] <API key> (string s)
{
var utf8Length = System.Text.Encoding.UTF8.GetByteCount (s);
var bytes = new byte [utf8Length + 1];
utf8Length = System.Text.Encoding.UTF8.GetBytes(s, 0, s.Length, bytes, 0);
return bytes;
}
#endif
<summary>
Sets a busy handler to sleep the specified amount of time when a table is locked.
The handler will sleep multiple times until a total time of <see cref="BusyTimeout"/> has accumulated.
</summary>
public TimeSpan BusyTimeout {
get { return _busyTimeout; }
set {
_busyTimeout = value;
if (Handle != NullHandle) {
SQLite3.BusyTimeout (Handle, (int)_busyTimeout.TotalMilliseconds);
}
}
}
<summary>
Returns the mappings from types to tables that the connection
currently understands.
</summary>
public IEnumerable<TableMapping> TableMappings {
get {
lock (_mappings) {
return new List<TableMapping> (_mappings.Values);
}
}
}
<summary>
Retrieves the mapping that is automatically generated for the given type.
</summary>
<param name="type">
The type whose mapping to the database is returned.
</param>
<param name="createFlags">
Optional flags allowing implicit PK and indexes based on naming conventions
</param>
<returns>
The mapping represents the schema of the columns of the database and contains
methods to set and get properties of objects.
</returns>
public TableMapping GetMapping (Type type, CreateFlags createFlags = CreateFlags.None)
{
TableMapping map;
var key = type.FullName;
lock (_mappings) {
if (_mappings.TryGetValue (key, out map)) {
if (createFlags != CreateFlags.None && createFlags != map.CreateFlags) {
map = new TableMapping (type, createFlags);
_mappings[key] = map;
}
}
else {
map = new TableMapping (type, createFlags);
_mappings.Add (key, map);
}
}
return map;
}
<summary>
Retrieves the mapping that is automatically generated for the given type.
</summary>
<param name="createFlags">
Optional flags allowing implicit PK and indexes based on naming conventions
</param>
<returns>
The mapping represents the schema of the columns of the database and contains
methods to set and get properties of objects.
</returns>
public TableMapping GetMapping<T> (CreateFlags createFlags = CreateFlags.None)
{
return GetMapping (typeof (T), createFlags);
}
private struct IndexedColumn
{
public int Order;
public string ColumnName;
}
private struct IndexInfo
{
public string IndexName;
public string TableName;
public bool Unique;
public List<IndexedColumn> Columns;
}
<summary>
Executes a "drop table" on the database. This is non-recoverable.
</summary>
public int DropTable<T> ()
{
return DropTable (GetMapping (typeof (T)));
}
<summary>
Executes a "drop table" on the database. This is non-recoverable.
</summary>
<param name="map">
The TableMapping used to identify the table.
</param>
public int DropTable (TableMapping map)
{
var query = string.Format ("drop table if exists \"{0}\"", map.TableName);
return Execute (query);
}
<summary>
Executes a "create table if not exists" on the database. It also
creates any specified indexes on the columns of the table. It uses
a schema automatically generated from the specified type. You can
later access this schema by calling GetMapping.
</summary>
<returns>
Whether the table was created or migrated.
</returns>
public CreateTableResult CreateTable<T> (CreateFlags createFlags = CreateFlags.None)
{
return CreateTable (typeof (T), createFlags);
}
<summary>
Executes a "create table if not exists" on the database. It also
creates any specified indexes on the columns of the table. It uses
a schema automatically generated from the specified type. You can
later access this schema by calling GetMapping.
</summary>
<param name="ty">Type to reflect to a database table.</param>
<param name="createFlags">Optional flags allowing implicit PK and indexes based on naming conventions.</param>
<returns>
Whether the table was created or migrated.
</returns>
public CreateTableResult CreateTable (Type ty, CreateFlags createFlags = CreateFlags.None)
{
var map = GetMapping (ty, createFlags);
// Present a nice error if no columns specified
if (map.Columns.Length == 0) {
throw new Exception (string.Format ("Cannot create a table without columns (does '{0}' have public properties?)", ty.FullName));
}
// Check if the table exists
var result = CreateTableResult.Created;
var existingCols = GetTableInfo (map.TableName);
// Create or migrate it
if (existingCols.Count == 0) {
// Facilitate virtual tables a.k.a. full-text search.
bool fts3 = (createFlags & CreateFlags.FullTextSearch3) != 0;
bool fts4 = (createFlags & CreateFlags.FullTextSearch4) != 0;
bool fts = fts3 || fts4;
var @virtual = fts ? "virtual " : string.Empty;
var @using = fts3 ? "using fts3 " : fts4 ? "using fts4 " : string.Empty;
// Build query.
var query = "create " + @virtual + "table if not exists \"" + map.TableName + "\" " + @using + "(\n";
var decls = map.Columns.Select (p => Orm.SqlDecl (p, <API key>, <API key>));
var decl = string.Join (",\n", decls.ToArray ());
query += decl;
query += ")";
if (map.WithoutRowId) {
query += " without rowid";
}
Execute (query);
}
else {
result = CreateTableResult.Migrated;
MigrateTable (map, existingCols);
}
var indexes = new Dictionary<string, IndexInfo> ();
foreach (var c in map.Columns) {
foreach (var i in c.Indices) {
var iname = i.Name ?? map.TableName + "_" + c.Name;
IndexInfo iinfo;
if (!indexes.TryGetValue (iname, out iinfo)) {
iinfo = new IndexInfo {
IndexName = iname,
TableName = map.TableName,
Unique = i.Unique,
Columns = new List<IndexedColumn> ()
};
indexes.Add (iname, iinfo);
}
if (i.Unique != iinfo.Unique)
throw new Exception ("All the columns in an index must have the same value for their Unique property");
iinfo.Columns.Add (new IndexedColumn {
Order = i.Order,
ColumnName = c.Name
});
}
}
foreach (var indexName in indexes.Keys) {
var index = indexes[indexName];
var columns = index.Columns.OrderBy (i => i.Order).Select (i => i.ColumnName).ToArray ();
CreateIndex (indexName, index.TableName, columns, index.Unique);
}
return result;
}
<summary>
Executes a "create table if not exists" on the database for each type. It also
creates any specified indexes on the columns of the table. It uses
a schema automatically generated from the specified type. You can
later access this schema by calling GetMapping.
</summary>
<returns>
Whether the table was created or migrated for each type.
</returns>
public CreateTablesResult CreateTables<T, T2> (CreateFlags createFlags = CreateFlags.None)
where T : new()
where T2 : new()
{
return CreateTables (createFlags, typeof (T), typeof (T2));
}
<summary>
Executes a "create table if not exists" on the database for each type. It also
creates any specified indexes on the columns of the table. It uses
a schema automatically generated from the specified type. You can
later access this schema by calling GetMapping.
</summary>
<returns>
Whether the table was created or migrated for each type.
</returns>
public CreateTablesResult CreateTables<T, T2, T3> (CreateFlags createFlags = CreateFlags.None)
where T : new()
where T2 : new()
where T3 : new()
{
return CreateTables (createFlags, typeof (T), typeof (T2), typeof (T3));
}
<summary>
Executes a "create table if not exists" on the database for each type. It also
creates any specified indexes on the columns of the table. It uses
a schema automatically generated from the specified type. You can
later access this schema by calling GetMapping.
</summary>
<returns>
Whether the table was created or migrated for each type.
</returns>
public CreateTablesResult CreateTables<T, T2, T3, T4> (CreateFlags createFlags = CreateFlags.None)
where T : new()
where T2 : new()
where T3 : new()
where T4 : new()
{
return CreateTables (createFlags, typeof (T), typeof (T2), typeof (T3), typeof (T4));
}
<summary>
Executes a "create table if not exists" on the database for each type. It also
creates any specified indexes on the columns of the table. It uses
a schema automatically generated from the specified type. You can
later access this schema by calling GetMapping.
</summary>
<returns>
Whether the table was created or migrated for each type.
</returns>
public CreateTablesResult CreateTables<T, T2, T3, T4, T5> (CreateFlags createFlags = CreateFlags.None)
where T : new()
where T2 : new()
where T3 : new()
where T4 : new()
where T5 : new()
{
return CreateTables (createFlags, typeof (T), typeof (T2), typeof (T3), typeof (T4), typeof (T5));
}
<summary>
Executes a "create table if not exists" on the database for each type. It also
creates any specified indexes on the columns of the table. It uses
a schema automatically generated from the specified type. You can
later access this schema by calling GetMapping.
</summary>
<returns>
Whether the table was created or migrated for each type.
</returns>
public CreateTablesResult CreateTables (CreateFlags createFlags = CreateFlags.None, params Type[] types)
{
var result = new CreateTablesResult ();
foreach (Type type in types) {
var aResult = CreateTable (type, createFlags);
result.Results[type] = aResult;
}
return result;
}
<summary>
Creates an index for the specified table and columns.
</summary>
<param name="indexName">Name of the index to create</param>
<param name="tableName">Name of the database table</param>
<param name="columnNames">An array of column names to index</param>
<param name="unique">Whether the index should be unique</param>
<returns>Zero on success.</returns>
public int CreateIndex (string indexName, string tableName, string[] columnNames, bool unique = false)
{
const string sqlFormat = "create {2} index if not exists \"{3}\" on \"{0}\"(\"{1}\")";
var sql = String.Format (sqlFormat, tableName, string.Join ("\", \"", columnNames), unique ? "unique" : "", indexName);
return Execute (sql);
}
<summary>
Creates an index for the specified table and column.
</summary>
<param name="indexName">Name of the index to create</param>
<param name="tableName">Name of the database table</param>
<param name="columnName">Name of the column to index</param>
<param name="unique">Whether the index should be unique</param>
<returns>Zero on success.</returns>
public int CreateIndex (string indexName, string tableName, string columnName, bool unique = false)
{
return CreateIndex (indexName, tableName, new string[] { columnName }, unique);
}
<summary>
Creates an index for the specified table and column.
</summary>
<param name="tableName">Name of the database table</param>
<param name="columnName">Name of the column to index</param>
<param name="unique">Whether the index should be unique</param>
<returns>Zero on success.</returns>
public int CreateIndex (string tableName, string columnName, bool unique = false)
{
return CreateIndex (tableName + "_" + columnName, tableName, columnName, unique);
}
<summary>
Creates an index for the specified table and columns.
</summary>
<param name="tableName">Name of the database table</param>
<param name="columnNames">An array of column names to index</param>
<param name="unique">Whether the index should be unique</param>
<returns>Zero on success.</returns>
public int CreateIndex (string tableName, string[] columnNames, bool unique = false)
{
return CreateIndex (tableName + "_" + string.Join ("_", columnNames), tableName, columnNames, unique);
}
<summary>
Creates an index for the specified object property.
e.g. CreateIndex<Client>(c => c.Name);
</summary>
<typeparam name="T">Type to reflect to a database table.</typeparam>
<param name="property">Property to index</param>
<param name="unique">Whether the index should be unique</param>
<returns>Zero on success.</returns>
public int CreateIndex<T> (Expression<Func<T, object>> property, bool unique = false)
{
MemberExpression mx;
if (property.Body.NodeType == ExpressionType.Convert) {
mx = ((UnaryExpression)property.Body).Operand as MemberExpression;
}
else {
mx = (property.Body as MemberExpression);
}
var propertyInfo = mx.Member as PropertyInfo;
if (propertyInfo == null) {
throw new ArgumentException ("The lambda expression 'property' should point to a valid Property");
}
var propName = propertyInfo.Name;
var map = GetMapping<T> ();
var colName = map.<API key> (propName).Name;
return CreateIndex (map.TableName, colName, unique);
}
[Preserve (AllMembers = true)]
public class ColumnInfo
{
// public int cid { get; set; }
[Column ("name")]
public string Name { get; set; }
// [Column ("type")]
// public string ColumnType { get; set; }
public int notnull { get; set; }
// public string dflt_value { get; set; }
// public int pk { get; set; }
public override string ToString ()
{
return Name;
}
}
<summary>
Query the built-in sqlite table_info table for a specific tables columns.
</summary>
<returns>The columns contains in the table.</returns>
<param name="tableName">Table name.</param>
public List<ColumnInfo> GetTableInfo (string tableName)
{
var query = "pragma table_info(\"" + tableName + "\")";
return Query<ColumnInfo> (query);
}
void MigrateTable (TableMapping map, List<ColumnInfo> existingCols)
{
var toBeAdded = new List<TableMapping.Column> ();
foreach (var p in map.Columns) {
var found = false;
foreach (var c in existingCols) {
found = (string.Compare (p.Name, c.Name, StringComparison.OrdinalIgnoreCase) == 0);
if (found)
break;
}
if (!found) {
toBeAdded.Add (p);
}
}
foreach (var p in toBeAdded) {
var addCol = "alter table \"" + map.TableName + "\" add column " + Orm.SqlDecl (p, <API key>, <API key>);
Execute (addCol);
}
}
<summary>
Creates a new SQLiteCommand. Can be overridden to provide a sub-class.
</summary>
<seealso cref="SQLiteCommand.OnInstanceCreated"/>
protected virtual SQLiteCommand NewCommand ()
{
return new SQLiteCommand (this);
}
<summary>
Creates a new SQLiteCommand given the command text with arguments. Place a '?'
in the command text for each of the arguments.
</summary>
<param name="cmdText">
The fully escaped SQL.
</param>
<param name="ps">
Arguments to substitute for the occurences of '?' in the command text.
</param>
<returns>
A <see cref="SQLiteCommand"/>
</returns>
public SQLiteCommand CreateCommand (string cmdText, params object[] ps)
{
if (!_open)
throw SQLiteException.New (SQLite3.Result.Error, "Cannot create commands from unopened database");
var cmd = NewCommand ();
cmd.CommandText = cmdText;
foreach (var o in ps) {
cmd.Bind (o);
}
return cmd;
}
<summary>
Creates a new SQLiteCommand given the command text with named arguments. Place a "[@:$]VVV"
in the command text for each of the arguments. VVV represents an alphanumeric identifier.
For example, @name :name and $name can all be used in the query.
</summary>
<param name="cmdText">
The fully escaped SQL.
</param>
<param name="args">
Arguments to substitute for the occurences of "[@:$]VVV" in the command text.
</param>
<returns>
A <see cref="SQLiteCommand" />
</returns>
public SQLiteCommand CreateCommand (string cmdText, Dictionary<string, object> args)
{
if (!_open)
throw SQLiteException.New (SQLite3.Result.Error, "Cannot create commands from unopened database");
SQLiteCommand cmd = NewCommand ();
cmd.CommandText = cmdText;
foreach (var kv in args) {
cmd.Bind (kv.Key, kv.Value);
}
return cmd;
}
<summary>
Creates a SQLiteCommand given the command text (SQL) with arguments. Place a '?'
in the command text for each of the arguments and then executes that command.
Use this method instead of Query when you don't expect rows back. Such cases include
INSERTs, UPDATEs, and DELETEs.
You can set the Trace or TimeExecution properties of the connection
to profile execution.
</summary>
<param name="query">
The fully escaped SQL.
</param>
<param name="args">
Arguments to substitute for the occurences of '?' in the query.
</param>
<returns>
The number of rows modified in the database as a result of this execution.
</returns>
public int Execute (string query, params object[] args)
{
var cmd = CreateCommand (query, args);
if (TimeExecution) {
if (_sw == null) {
_sw = new Stopwatch ();
}
_sw.Reset ();
_sw.Start ();
}
var r = cmd.ExecuteNonQuery ();
if (TimeExecution) {
_sw.Stop ();
<API key> += _sw.ElapsedMilliseconds;
Tracer?.Invoke (string.Format ("Finished in {0} ms ({1:0.0} s total)", _sw.ElapsedMilliseconds, <API key> / 1000.0));
}
return r;
}
<summary>
Creates a SQLiteCommand given the command text (SQL) with arguments. Place a '?'
in the command text for each of the arguments and then executes that command.
Use this method when return primitive values.
You can set the Trace or TimeExecution properties of the connection
to profile execution.
</summary>
<param name="query">
The fully escaped SQL.
</param>
<param name="args">
Arguments to substitute for the occurences of '?' in the query.
</param>
<returns>
The number of rows modified in the database as a result of this execution.
</returns>
public T ExecuteScalar<T> (string query, params object[] args)
{
var cmd = CreateCommand (query, args);
if (TimeExecution) {
if (_sw == null) {
_sw = new Stopwatch ();
}
_sw.Reset ();
_sw.Start ();
}
var r = cmd.ExecuteScalar<T> ();
if (TimeExecution) {
_sw.Stop ();
<API key> += _sw.ElapsedMilliseconds;
Tracer?.Invoke (string.Format ("Finished in {0} ms ({1:0.0} s total)", _sw.ElapsedMilliseconds, <API key> / 1000.0));
}
return r;
}
<summary>
Creates a SQLiteCommand given the command text (SQL) with arguments. Place a '?'
in the command text for each of the arguments and then executes that command.
It returns each row of the result using the mapping automatically generated for
the given type.
</summary>
<param name="query">
The fully escaped SQL.
</param>
<param name="args">
Arguments to substitute for the occurences of '?' in the query.
</param>
<returns>
An enumerable with one result for each row returned by the query.
</returns>
public List<T> Query<T> (string query, params object[] args) where T : new()
{
var cmd = CreateCommand (query, args);
return cmd.ExecuteQuery<T> ();
}
<summary>
Creates a SQLiteCommand given the command text (SQL) with arguments. Place a '?'
in the command text for each of the arguments and then executes that command.
It returns the first column of each row of the result.
</summary>
<param name="query">
The fully escaped SQL.
</param>
<param name="args">
Arguments to substitute for the occurences of '?' in the query.
</param>
<returns>
An enumerable with one result for the first column of each row returned by the query.
</returns>
public List<T> QueryScalars<T> (string query, params object[] args)
{
var cmd = CreateCommand (query, args);
return cmd.ExecuteQueryScalars<T> ().ToList ();
}
<summary>
Creates a SQLiteCommand given the command text (SQL) with arguments. Place a '?'
in the command text for each of the arguments and then executes that command.
It returns each row of the result using the mapping automatically generated for
the given type.
</summary>
<param name="query">
The fully escaped SQL.
</param>
<param name="args">
Arguments to substitute for the occurences of '?' in the query.
</param>
<returns>
An enumerable with one result for each row returned by the query.
The enumerator (retrieved by calling GetEnumerator() on the result of this method)
will call sqlite3_step on each call to MoveNext, so the database
connection must remain open for the lifetime of the enumerator.
</returns>
public IEnumerable<T> DeferredQuery<T> (string query, params object[] args) where T : new()
{
var cmd = CreateCommand (query, args);
return cmd.<API key><T> ();
}
<summary>
Creates a SQLiteCommand given the command text (SQL) with arguments. Place a '?'
in the command text for each of the arguments and then executes that command.
It returns each row of the result using the specified mapping. This function is
only used by libraries in order to query the database via introspection. It is
normally not used.
</summary>
<param name="map">
A <see cref="TableMapping"/> to use to convert the resulting rows
into objects.
</param>
<param name="query">
The fully escaped SQL.
</param>
<param name="args">
Arguments to substitute for the occurences of '?' in the query.
</param>
<returns>
An enumerable with one result for each row returned by the query.
</returns>
public List<object> Query (TableMapping map, string query, params object[] args)
{
var cmd = CreateCommand (query, args);
return cmd.ExecuteQuery<object> (map);
}
<summary>
Creates a SQLiteCommand given the command text (SQL) with arguments. Place a '?'
in the command text for each of the arguments and then executes that command.
It returns each row of the result using the specified mapping. This function is
only used by libraries in order to query the database via introspection. It is
normally not used.
</summary>
<param name="map">
A <see cref="TableMapping"/> to use to convert the resulting rows
into objects.
</param>
<param name="query">
The fully escaped SQL.
</param>
<param name="args">
Arguments to substitute for the occurences of '?' in the query.
</param>
<returns>
An enumerable with one result for each row returned by the query.
The enumerator (retrieved by calling GetEnumerator() on the result of this method)
will call sqlite3_step on each call to MoveNext, so the database
connection must remain open for the lifetime of the enumerator.
</returns>
public IEnumerable<object> DeferredQuery (TableMapping map, string query, params object[] args)
{
var cmd = CreateCommand (query, args);
return cmd.<API key><object> (map);
}
<summary>
Returns a queryable interface to the table represented by the given type.
</summary>
<returns>
A queryable object that is able to translate Where, OrderBy, and Take
queries into native SQL.
</returns>
public TableQuery<T> Table<T> () where T : new()
{
return new TableQuery<T> (this);
}
<summary>
Attempts to retrieve an object with the given primary key from the table
associated with the specified type. Use of this method requires that
the given type have a designated PrimaryKey (using the PrimaryKeyAttribute).
</summary>
<param name="pk">
The primary key.
</param>
<returns>
The object with the given primary key. Throws a not found exception
if the object is not found.
</returns>
public T Get<T> (object pk) where T : new()
{
var map = GetMapping (typeof (T));
return Query<T> (map.GetByPrimaryKeySql, pk).First ();
}
<summary>
Attempts to retrieve an object with the given primary key from the table
associated with the specified type. Use of this method requires that
the given type have a designated PrimaryKey (using the PrimaryKeyAttribute).
</summary>
<param name="pk">
The primary key.
</param>
<param name="map">
The TableMapping used to identify the table.
</param>
<returns>
The object with the given primary key. Throws a not found exception
if the object is not found.
</returns>
public object Get (object pk, TableMapping map)
{
return Query (map, map.GetByPrimaryKeySql, pk).First ();
}
<summary>
Attempts to retrieve the first object that matches the predicate from the table
associated with the specified type.
</summary>
<param name="predicate">
A predicate for which object to find.
</param>
<returns>
The object that matches the given predicate. Throws a not found exception
if the object is not found.
</returns>
public T Get<T> (Expression<Func<T, bool>> predicate) where T : new()
{
return Table<T> ().Where (predicate).First ();
}
<summary>
Attempts to retrieve an object with the given primary key from the table
associated with the specified type. Use of this method requires that
the given type have a designated PrimaryKey (using the PrimaryKeyAttribute).
</summary>
<param name="pk">
The primary key.
</param>
<returns>
The object with the given primary key or null
if the object is not found.
</returns>
public T Find<T> (object pk) where T : new()
{
var map = GetMapping (typeof (T));
return Query<T> (map.GetByPrimaryKeySql, pk).FirstOrDefault ();
}
<summary>
Attempts to retrieve an object with the given primary key from the table
associated with the specified type. Use of this method requires that
the given type have a designated PrimaryKey (using the PrimaryKeyAttribute).
</summary>
<param name="pk">
The primary key.
</param>
<param name="map">
The TableMapping used to identify the table.
</param>
<returns>
The object with the given primary key or null
if the object is not found.
</returns>
public object Find (object pk, TableMapping map)
{
return Query (map, map.GetByPrimaryKeySql, pk).FirstOrDefault ();
}
<summary>
Attempts to retrieve the first object that matches the predicate from the table
associated with the specified type.
</summary>
<param name="predicate">
A predicate for which object to find.
</param>
<returns>
The object that matches the given predicate or null
if the object is not found.
</returns>
public T Find<T> (Expression<Func<T, bool>> predicate) where T : new()
{
return Table<T> ().Where (predicate).FirstOrDefault ();
}
<summary>
Attempts to retrieve the first object that matches the query from the table
associated with the specified type.
</summary>
<param name="query">
The fully escaped SQL.
</param>
<param name="args">
Arguments to substitute for the occurences of '?' in the query.
</param>
<returns>
The object that matches the given predicate or null
if the object is not found.
</returns>
public T FindWithQuery<T> (string query, params object[] args) where T : new()
{
return Query<T> (query, args).FirstOrDefault ();
}
<summary>
Attempts to retrieve the first object that matches the query from the table
associated with the specified type.
</summary>
<param name="map">
The TableMapping used to identify the table.
</param>
<param name="query">
The fully escaped SQL.
</param>
<param name="args">
Arguments to substitute for the occurences of '?' in the query.
</param>
<returns>
The object that matches the given predicate or null
if the object is not found.
</returns>
public object FindWithQuery (TableMapping map, string query, params object[] args)
{
return Query (map, query, args).FirstOrDefault ();
}
<summary>
Whether <see cref="BeginTransaction"/> has been called and the database is waiting for a <see cref="Commit"/>.
</summary>
public bool IsInTransaction {
get { return _transactionDepth > 0; }
}
<summary>
Begins a new transaction. Call <see cref="Commit"/> to end the transaction.
</summary>
<example cref="System.<API key>">Throws if a transaction has already begun.</example>
public void BeginTransaction ()
{
// The BEGIN command only works if the transaction stack is empty,
// or in other words if there are no pending transactions.
// If the transaction stack is not empty when the BEGIN command is invoked,
// then the command fails with an error.
// Rather than crash with an error, we will just ignore calls to BeginTransaction
// that would result in an error.
if (Interlocked.CompareExchange (ref _transactionDepth, 1, 0) == 0) {
try {
Execute ("begin transaction");
}
catch (Exception ex) {
var sqlExp = ex as SQLiteException;
if (sqlExp != null) {
// It is recommended that applications respond to the errors listed below
// by explicitly issuing a ROLLBACK command.
// TODO: This rollback failsafe should be localized to all throw sites.
switch (sqlExp.Result) {
case SQLite3.Result.IOError:
case SQLite3.Result.Full:
case SQLite3.Result.Busy:
case SQLite3.Result.NoMem:
case SQLite3.Result.Interrupt:
RollbackTo (null, true);
break;
}
}
else {
// Call decrement and not VolatileWrite in case we've already
// created a transaction point in <API key> since the catch.
Interlocked.Decrement (ref _transactionDepth);
}
throw;
}
}
else {
// Calling BeginTransaction on an already open transaction is invalid
throw new <API key> ("Cannot begin a transaction while already in a transaction.");
}
}
<summary>
Creates a savepoint in the database at the current point in the transaction timeline.
Begins a new transaction if one is not in progress.
Call <see cref="RollbackTo(string)"/> to undo transactions since the returned savepoint.
Call <see cref="Release"/> to commit transactions after the savepoint returned here.
Call <see cref="Commit"/> to end the transaction, committing all changes.
</summary>
<returns>A string naming the savepoint.</returns>
public string <API key> ()
{
int depth = Interlocked.Increment (ref _transactionDepth) - 1;
string retVal = "S" + _rand.Next (short.MaxValue) + "D" + depth;
try {
Execute ("savepoint " + retVal);
}
catch (Exception ex) {
var sqlExp = ex as SQLiteException;
if (sqlExp != null) {
// It is recommended that applications respond to the errors listed below
// by explicitly issuing a ROLLBACK command.
// TODO: This rollback failsafe should be localized to all throw sites.
switch (sqlExp.Result) {
case SQLite3.Result.IOError:
case SQLite3.Result.Full:
case SQLite3.Result.Busy:
case SQLite3.Result.NoMem:
case SQLite3.Result.Interrupt:
RollbackTo (null, true);
break;
}
}
else {
Interlocked.Decrement (ref _transactionDepth);
}
throw;
}
return retVal;
}
<summary>
Rolls back the transaction that was begun by <see cref="BeginTransaction"/> or <see cref="<API key>"/>.
</summary>
public void Rollback ()
{
RollbackTo (null, false);
}
<summary>
Rolls back the savepoint created by <see cref="BeginTransaction"/> or <API key>.
</summary>
<param name="savepoint">The name of the savepoint to roll back to, as returned by <see cref="<API key>"/>. If savepoint is null or empty, this method is equivalent to a call to <see cref="Rollback"/></param>
public void RollbackTo (string savepoint)
{
RollbackTo (savepoint, false);
}
<summary>
Rolls back the transaction that was begun by <see cref="BeginTransaction"/>.
</summary>
<param name="savepoint">The name of the savepoint to roll back to, as returned by <see cref="<API key>"/>. If savepoint is null or empty, this method is equivalent to a call to <see cref="Rollback"/></param>
<param name="noThrow">true to avoid throwing exceptions, false otherwise</param>
void RollbackTo (string savepoint, bool noThrow)
{
// Rolling back without a TO clause rolls backs all transactions
// and leaves the transaction stack empty.
try {
if (String.IsNullOrEmpty (savepoint)) {
if (Interlocked.Exchange (ref _transactionDepth, 0) > 0) {
Execute ("rollback");
}
}
else {
DoSavePointExecute (savepoint, "rollback to ");
}
}
catch (SQLiteException) {
if (!noThrow)
throw;
}
// No need to rollback if there are no transactions open.
}
<summary>
Releases a savepoint returned from <see cref="<API key>"/>. Releasing a savepoint
makes changes since that savepoint permanent if the savepoint began the transaction,
or otherwise the changes are permanent pending a call to <see cref="Commit"/>.
The RELEASE command is like a COMMIT for a SAVEPOINT.
</summary>
<param name="savepoint">The name of the savepoint to release. The string should be the result of a call to <see cref="<API key>"/></param>
public void Release (string savepoint)
{
try {
DoSavePointExecute (savepoint, "release ");
}
catch (SQLiteException ex) {
if (ex.Result == SQLite3.Result.Busy) {
// Force a rollback since most people don't know this function can fail
// Don't call Rollback() since the _transactionDepth is 0 and it won't try
// Calling rollback makes our _transactionDepth variable correct.
// Writes to the database only happen at depth=0, so this failure will only happen then.
try {
Execute ("rollback");
}
catch {
// rollback can fail in all sorts of wonderful version-dependent ways. Let's just hope for the best
}
}
throw;
}
}
void DoSavePointExecute (string savepoint, string cmd)
{
// Validate the savepoint
int firstLen = savepoint.IndexOf ('D');
if (firstLen >= 2 && savepoint.Length > firstLen + 1) {
int depth;
if (Int32.TryParse (savepoint.Substring (firstLen + 1), out depth)) {
// TODO: Mild race here, but inescapable without locking almost everywhere.
if (0 <= depth && depth < _transactionDepth) {
#if NETFX_CORE || USE_SQLITEPCL_RAW || NETCORE
Volatile.Write (ref _transactionDepth, depth);
#elif SILVERLIGHT
_transactionDepth = depth;
#else
Thread.VolatileWrite (ref _transactionDepth, depth);
#endif
Execute (cmd + savepoint);
return;
}
}
}
throw new ArgumentException ("savePoint is not valid, and should be the result of a call to <API key>.", "savePoint");
}
<summary>
Commits the transaction that was begun by <see cref="BeginTransaction"/>.
</summary>
public void Commit ()
{
if (Interlocked.Exchange (ref _transactionDepth, 0) != 0) {
try {
Execute ("commit");
}
catch {
// Force a rollback since most people don't know this function can fail
// Don't call Rollback() since the _transactionDepth is 0 and it won't try
// Calling rollback makes our _transactionDepth variable correct.
try {
Execute ("rollback");
}
catch {
// rollback can fail in all sorts of wonderful version-dependent ways. Let's just hope for the best
}
throw;
}
}
// Do nothing on a commit with no open transaction
}
<summary>
Executes <paramref name="action"/> within a (possibly nested) transaction by wrapping it in a SAVEPOINT. If an
exception occurs the whole transaction is rolled back, not just the current savepoint. The exception
is rethrown.
</summary>
<param name="action">
The <see cref="Action"/> to perform within a transaction. <paramref name="action"/> can contain any number
of operations on the connection but should never call <see cref="BeginTransaction"/> or
<see cref="Commit"/>.
</param>
public void RunInTransaction (Action action)
{
try {
var savePoint = <API key> ();
action ();
Release (savePoint);
}
catch (Exception) {
Rollback ();
throw;
}
}
<summary>
Inserts all specified objects.
</summary>
<param name="objects">
An <see cref="IEnumerable"/> of the objects to insert.
<param name="runInTransaction"/>
A boolean indicating if the inserts should be wrapped in a transaction.
</param>
<returns>
The number of rows added to the table.
</returns>
public int InsertAll (System.Collections.IEnumerable objects, bool runInTransaction = true)
{
var c = 0;
if (runInTransaction) {
RunInTransaction (() => {
foreach (var r in objects) {
c += Insert (r);
}
});
}
else {
foreach (var r in objects) {
c += Insert (r);
}
}
return c;
}
<summary>
Inserts all specified objects.
</summary>
<param name="objects">
An <see cref="IEnumerable"/> of the objects to insert.
</param>
<param name="extra">
Literal SQL code that gets placed into the command. INSERT {extra} INTO ...
</param>
<param name="runInTransaction">
A boolean indicating if the inserts should be wrapped in a transaction.
</param>
<returns>
The number of rows added to the table.
</returns>
public int InsertAll (System.Collections.IEnumerable objects, string extra, bool runInTransaction = true)
{
var c = 0;
if (runInTransaction) {
RunInTransaction (() => {
foreach (var r in objects) {
c += Insert (r, extra);
}
});
}
else {
foreach (var r in objects) {
c += Insert (r, extra);
}
}
return c;
}
<summary>
Inserts all specified objects.
</summary>
<param name="objects">
An <see cref="IEnumerable"/> of the objects to insert.
</param>
<param name="objType">
The type of object to insert.
</param>
<param name="runInTransaction">
A boolean indicating if the inserts should be wrapped in a transaction.
</param>
<returns>
The number of rows added to the table.
</returns>
public int InsertAll (System.Collections.IEnumerable objects, Type objType, bool runInTransaction = true)
{
var c = 0;
if (runInTransaction) {
RunInTransaction (() => {
foreach (var r in objects) {
c += Insert (r, objType);
}
});
}
else {
foreach (var r in objects) {
c += Insert (r, objType);
}
}
return c;
}
<summary>
Inserts the given object (and updates its
auto incremented primary key if it has one).
The return value is the number of rows added to the table.
</summary>
<param name="obj">
The object to insert.
</param>
<returns>
The number of rows added to the table.
</returns>
public int Insert (object obj)
{
if (obj == null) {
return 0;
}
return Insert (obj, "", Orm.GetType (obj));
}
<summary>
Inserts the given object (and updates its
auto incremented primary key if it has one).
The return value is the number of rows added to the table.
If a UNIQUE constraint violation occurs with
some pre-existing object, this function deletes
the old object.
</summary>
<param name="obj">
The object to insert.
</param>
<returns>
The number of rows modified.
</returns>
public int InsertOrReplace (object obj)
{
if (obj == null) {
return 0;
}
return Insert (obj, "OR REPLACE", Orm.GetType (obj));
}
<summary>
Inserts the given object (and updates its
auto incremented primary key if it has one).
The return value is the number of rows added to the table.
</summary>
<param name="obj">
The object to insert.
</param>
<param name="objType">
The type of object to insert.
</param>
<returns>
The number of rows added to the table.
</returns>
public int Insert (object obj, Type objType)
{
return Insert (obj, "", objType);
}
<summary>
Inserts the given object (and updates its
auto incremented primary key if it has one).
The return value is the number of rows added to the table.
If a UNIQUE constraint violation occurs with
some pre-existing object, this function deletes
the old object.
</summary>
<param name="obj">
The object to insert.
</param>
<param name="objType">
The type of object to insert.
</param>
<returns>
The number of rows modified.
</returns>
public int InsertOrReplace (object obj, Type objType)
{
return Insert (obj, "OR REPLACE", objType);
}
<summary>
Inserts the given object (and updates its
auto incremented primary key if it has one).
The return value is the number of rows added to the table.
</summary>
<param name="obj">
The object to insert.
</param>
<param name="extra">
Literal SQL code that gets placed into the command. INSERT {extra} INTO ...
</param>
<returns>
The number of rows added to the table.
</returns>
public int Insert (object obj, string extra)
{
if (obj == null) {
return 0;
}
return Insert (obj, extra, Orm.GetType (obj));
}
<summary>
Inserts the given object (and updates its
auto incremented primary key if it has one).
The return value is the number of rows added to the table.
</summary>
<param name="obj">
The object to insert.
</param>
<param name="extra">
Literal SQL code that gets placed into the command. INSERT {extra} INTO ...
</param>
<param name="objType">
The type of object to insert.
</param>
<returns>
The number of rows added to the table.
</returns>
public int Insert (object obj, string extra, Type objType)
{
if (obj == null || objType == null) {
return 0;
}
var map = GetMapping (objType);
if (map.PK != null && map.PK.IsAutoGuid) {
if (map.PK.GetValue (obj).Equals (Guid.Empty)) {
map.PK.SetValue (obj, Guid.NewGuid ());
}
}
var replacing = string.Compare (extra, "OR REPLACE", StringComparison.OrdinalIgnoreCase) == 0;
var cols = replacing ? map.<API key> : map.InsertColumns;
var vals = new object[cols.Length];
for (var i = 0; i < vals.Length; i++) {
vals[i] = cols[i].GetValue (obj);
}
var insertCmd = GetInsertCommand (map, extra);
int count;
lock (insertCmd) {
// We lock here to protect the prepared statement returned via GetInsertCommand.
// A SQLite prepared statement can be bound for only one operation at a time.
try {
count = insertCmd.ExecuteNonQuery (vals);
}
catch (SQLiteException ex) {
if (SQLite3.ExtendedErrCode (this.Handle) == SQLite3.ExtendedResult.ConstraintNotNull) {
throw <API key>.New (ex.Result, ex.Message, map, obj);
}
throw;
}
if (map.HasAutoIncPK) {
var id = SQLite3.LastInsertRowid (Handle);
map.SetAutoIncPK (obj, id);
}
}
if (count > 0)
OnTableChanged (map, <API key>.Insert);
return count;
}
readonly Dictionary<Tuple<string, string>, <API key>> _insertCommandMap = new Dictionary<Tuple<string, string>, <API key>> ();
<API key> GetInsertCommand (TableMapping map, string extra)
{
<API key> prepCmd;
var key = Tuple.Create (map.MappedType.FullName, extra);
lock (_insertCommandMap) {
if (_insertCommandMap.TryGetValue (key, out prepCmd)) {
return prepCmd;
}
}
prepCmd = CreateInsertCommand (map, extra);
lock (_insertCommandMap) {
if (_insertCommandMap.TryGetValue (key, out var existing)) {
prepCmd.Dispose ();
return existing;
}
_insertCommandMap.Add (key, prepCmd);
}
return prepCmd;
}
<API key> CreateInsertCommand (TableMapping map, string extra)
{
var cols = map.InsertColumns;
string insertSql;
if (cols.Length == 0 && map.Columns.Length == 1 && map.Columns[0].IsAutoInc) {
insertSql = string.Format ("insert {1} into \"{0}\" default values", map.TableName, extra);
}
else {
var replacing = string.Compare (extra, "OR REPLACE", StringComparison.OrdinalIgnoreCase) == 0;
if (replacing) {
cols = map.<API key>;
}
insertSql = string.Format ("insert {3} into \"{0}\"({1}) values ({2})", map.TableName,
string.Join (",", (from c in cols
select "\"" + c.Name + "\"").ToArray ()),
string.Join (",", (from c in cols
select "?").ToArray ()), extra);
}
var insertCommand = new <API key> (this, insertSql);
return insertCommand;
}
<summary>
Updates all of the columns of a table using the specified object
except for its primary key.
The object is required to have a primary key.
</summary>
<param name="obj">
The object to update. It must have a primary key designated using the PrimaryKeyAttribute.
</param>
<returns>
The number of rows updated.
</returns>
public int Update (object obj)
{
if (obj == null) {
return 0;
}
return Update (obj, Orm.GetType (obj));
}
<summary>
Updates all of the columns of a table using the specified object
except for its primary key.
The object is required to have a primary key.
</summary>
<param name="obj">
The object to update. It must have a primary key designated using the PrimaryKeyAttribute.
</param>
<param name="objType">
The type of object to insert.
</param>
<returns>
The number of rows updated.
</returns>
public int Update (object obj, Type objType)
{
int rowsAffected = 0;
if (obj == null || objType == null) {
return 0;
}
var map = GetMapping (objType);
var pk = map.PK;
if (pk == null) {
throw new <API key> ("Cannot update " + map.TableName + ": it has no PK");
}
var cols = from p in map.Columns
where p != pk
select p;
var vals = from c in cols
select c.GetValue (obj);
var ps = new List<object> (vals);
if (ps.Count == 0) {
// There is a PK but no accompanying data,
// so reset the PK to make the UPDATE work.
cols = map.Columns;
vals = from c in cols
select c.GetValue (obj);
ps = new List<object> (vals);
}
ps.Add (pk.GetValue (obj));
var q = string.Format ("update \"{0}\" set {1} where \"{2}\" = ? ", map.TableName, string.Join (",", (from c in cols
select "\"" + c.Name + "\" = ? ").ToArray ()), pk.Name);
try {
rowsAffected = Execute (q, ps.ToArray ());
}
catch (SQLiteException ex) {
if (ex.Result == SQLite3.Result.Constraint && SQLite3.ExtendedErrCode (this.Handle) == SQLite3.ExtendedResult.ConstraintNotNull) {
throw <API key>.New (ex, map, obj);
}
throw ex;
}
if (rowsAffected > 0)
OnTableChanged (map, <API key>.Update);
return rowsAffected;
}
<summary>
Updates all specified objects.
</summary>
<param name="objects">
An <see cref="IEnumerable"/> of the objects to insert.
</param>
<param name="runInTransaction">
A boolean indicating if the inserts should be wrapped in a transaction
</param>
<returns>
The number of rows modified.
</returns>
public int UpdateAll (System.Collections.IEnumerable objects, bool runInTransaction = true)
{
var c = 0;
if (runInTransaction) {
RunInTransaction (() => {
foreach (var r in objects) {
c += Update (r);
}
});
}
else {
foreach (var r in objects) {
c += Update (r);
}
}
return c;
}
<summary>
Deletes the given object from the database using its primary key.
</summary>
<param name="objectToDelete">
The object to delete. It must have a primary key designated using the PrimaryKeyAttribute.
</param>
<returns>
The number of rows deleted.
</returns>
public int Delete (object objectToDelete)
{
var map = GetMapping (Orm.GetType (objectToDelete));
var pk = map.PK;
if (pk == null) {
throw new <API key> ("Cannot delete " + map.TableName + ": it has no PK");
}
var q = string.Format ("delete from \"{0}\" where \"{1}\" = ?", map.TableName, pk.Name);
var count = Execute (q, pk.GetValue (objectToDelete));
if (count > 0)
OnTableChanged (map, <API key>.Delete);
return count;
}
<summary>
Deletes the object with the specified primary key.
</summary>
<param name="primaryKey">
The primary key of the object to delete.
</param>
<returns>
The number of objects deleted.
</returns>
<typeparam name='T'>
The type of object.
</typeparam>
public int Delete<T> (object primaryKey)
{
return Delete (primaryKey, GetMapping (typeof (T)));
}
<summary>
Deletes the object with the specified primary key.
</summary>
<param name="primaryKey">
The primary key of the object to delete.
</param>
<param name="map">
The TableMapping used to identify the table.
</param>
<returns>
The number of objects deleted.
</returns>
public int Delete (object primaryKey, TableMapping map)
{
var pk = map.PK;
if (pk == null) {
throw new <API key> ("Cannot delete " + map.TableName + ": it has no PK");
}
var q = string.Format ("delete from \"{0}\" where \"{1}\" = ?", map.TableName, pk.Name);
var count = Execute (q, primaryKey);
if (count > 0)
OnTableChanged (map, <API key>.Delete);
return count;
}
<summary>
Deletes all the objects from the specified table.
WARNING WARNING: Let me repeat. It deletes ALL the objects from the
specified table. Do you really want to do that?
</summary>
<returns>
The number of objects deleted.
</returns>
<typeparam name='T'>
The type of objects to delete.
</typeparam>
public int DeleteAll<T> ()
{
var map = GetMapping (typeof (T));
return DeleteAll (map);
}
<summary>
Deletes all the objects from the specified table.
WARNING WARNING: Let me repeat. It deletes ALL the objects from the
specified table. Do you really want to do that?
</summary>
<param name="map">
The TableMapping used to identify the table.
</param>
<returns>
The number of objects deleted.
</returns>
public int DeleteAll (TableMapping map)
{
var query = string.Format ("delete from \"{0}\"", map.TableName);
var count = Execute (query);
if (count > 0)
OnTableChanged (map, <API key>.Delete);
return count;
}
<summary>
Backup the entire database to the specified path.
</summary>
<param name="<API key>">Path to backup file.</param>
<param name="databaseName">The name of the database to backup (usually "main").</param>
public void Backup (string <API key>, string databaseName = "main")
{
// Open the destination
var r = SQLite3.Open (<API key>, out var destHandle);
if (r != SQLite3.Result.OK) {
throw SQLiteException.New (r, "Failed to open destination database");
}
// Init the backup
var backup = SQLite3.BackupInit (destHandle, databaseName, Handle, databaseName);
if (backup == NullBackupHandle) {
SQLite3.Close (destHandle);
throw new Exception ("Failed to create backup");
}
// Perform it
SQLite3.BackupStep (backup, -1);
SQLite3.BackupFinish (backup);
// Check for errors
r = SQLite3.GetResult (destHandle);
string msg = "";
if (r != SQLite3.Result.OK) {
msg = SQLite3.GetErrmsg (destHandle);
}
// Close everything and report errors
SQLite3.Close (destHandle);
if (r != SQLite3.Result.OK) {
throw SQLiteException.New (r, msg);
}
}
~SQLiteConnection ()
{
Dispose (false);
}
public void Dispose ()
{
Dispose (true);
GC.SuppressFinalize (this);
}
public void Close ()
{
Dispose (true);
}
protected virtual void Dispose (bool disposing)
{
var useClose2 = LibVersionNumber >= 3007014;
if (_open && Handle != NullHandle) {
try {
if (disposing) {
lock (_insertCommandMap) {
foreach (var sqlInsertCommand in _insertCommandMap.Values) {
sqlInsertCommand.Dispose ();
}
_insertCommandMap.Clear ();
}
var r = useClose2 ? SQLite3.Close2 (Handle) : SQLite3.Close (Handle);
if (r != SQLite3.Result.OK) {
string msg = SQLite3.GetErrmsg (Handle);
throw SQLiteException.New (r, msg);
}
}
else {
var r = useClose2 ? SQLite3.Close2 (Handle) : SQLite3.Close (Handle);
}
}
finally {
Handle = NullHandle;
_open = false;
}
}
}
void OnTableChanged (TableMapping table, <API key> action)
{
var ev = TableChanged;
if (ev != null)
ev (this, new <API key> (table, action));
}
public event EventHandler<<API key>> TableChanged;
}
public class <API key> : EventArgs
{
public TableMapping Table { get; private set; }
public <API key> Action { get; private set; }
public <API key> (TableMapping table, <API key> action)
{
Table = table;
Action = action;
}
}
public enum <API key>
{
Insert,
Update,
Delete,
}
<summary>
Represents a parsed connection string.
</summary>
public class <API key>
{
const string <API key> = "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fff";
public string UniqueKey { get; }
public string DatabasePath { get; }
public bool <API key> { get; }
public bool <API key> { get; }
public string <API key> { get; }
public System.Globalization.DateTimeStyles DateTimeStyle { get; }
public object Key { get; }
public SQLiteOpenFlags OpenFlags { get; }
public Action<SQLiteConnection> PreKeyAction { get; }
public Action<SQLiteConnection> PostKeyAction { get; }
public string VfsName { get; }
#if NETFX_CORE
static readonly string MetroStyleDataPath = Windows.Storage.ApplicationData.Current.LocalFolder.Path;
public static readonly string[] InMemoryDbPaths = new[]
{
":memory:",
"file::memory:"
};
public static bool IsInMemoryPath(string databasePath)
{
return InMemoryDbPaths.Any(i => i.Equals(databasePath, StringComparison.OrdinalIgnoreCase));
}
#endif
<summary>
Constructs a new <API key> with all the data needed to open an SQLiteConnection.
</summary>
<param name="databasePath">
Specifies the path to the database file.
</param>
<param name="<API key>">
Specifies whether to store DateTime properties as ticks (true) or strings (false). You
absolutely do want to store them as Ticks in all new projects. The value of false is
only here for backwards compatibility. There is a *significant* speed advantage, with no
down sides, when setting <API key> = true.
If you use DateTimeOffset properties, it will be always stored as ticks regardingless
the <API key> parameter.
</param>
public <API key> (string databasePath, bool <API key> = true)
: this (databasePath, SQLiteOpenFlags.Create | SQLiteOpenFlags.ReadWrite, <API key>)
{
}
<summary>
Constructs a new <API key> with all the data needed to open an SQLiteConnection.
</summary>
<param name="databasePath">
Specifies the path to the database file.
</param>
<param name="<API key>">
Specifies whether to store DateTime properties as ticks (true) or strings (false). You
absolutely do want to store them as Ticks in all new projects. The value of false is
only here for backwards compatibility. There is a *significant* speed advantage, with no
down sides, when setting <API key> = true.
If you use DateTimeOffset properties, it will be always stored as ticks regardingless
the <API key> parameter.
</param>
<param name="key">
Specifies the encryption key to use on the database. Should be a string or a byte[].
</param>
<param name="preKeyAction">
Executes prior to setting key for SQLCipher databases
</param>
<param name="postKeyAction">
Executes after setting key for SQLCipher databases
</param>
<param name="vfsName">
Specifies the Virtual File System to use on the database.
</param>
public <API key> (string databasePath, bool <API key>, object key = null, Action<SQLiteConnection> preKeyAction = null, Action<SQLiteConnection> postKeyAction = null, string vfsName = null)
: this (databasePath, SQLiteOpenFlags.Create | SQLiteOpenFlags.ReadWrite, <API key>, key, preKeyAction, postKeyAction, vfsName)
{
}
<summary>
Constructs a new <API key> with all the data needed to open an SQLiteConnection.
</summary>
<param name="databasePath">
Specifies the path to the database file.
</param>
<param name="openFlags">
Flags controlling how the connection should be opened.
</param>
<param name="<API key>">
Specifies whether to store DateTime properties as ticks (true) or strings (false). You
absolutely do want to store them as Ticks in all new projects. The value of false is
only here for backwards compatibility. There is a *significant* speed advantage, with no
down sides, when setting <API key> = true.
If you use DateTimeOffset properties, it will be always stored as ticks regardingless
the <API key> parameter.
</param>
<param name="key">
Specifies the encryption key to use on the database. Should be a string or a byte[].
</param>
<param name="preKeyAction">
Executes prior to setting key for SQLCipher databases
</param>
<param name="postKeyAction">
Executes after setting key for SQLCipher databases
</param>
<param name="vfsName">
Specifies the Virtual File System to use on the database.
</param>
<param name="<API key>">
Specifies the format to use when storing DateTime properties as strings.
</param>
<param name="<API key>">
Specifies whether to store TimeSpan properties as ticks (true) or strings (false). You
absolutely do want to store them as Ticks in all new projects. The value of false is
only here for backwards compatibility. There is a *significant* speed advantage, with no
down sides, when setting <API key> = true.
</param>
public <API key> (string databasePath, SQLiteOpenFlags openFlags, bool <API key>, object key = null, Action<SQLiteConnection> preKeyAction = null, Action<SQLiteConnection> postKeyAction = null, string vfsName = null, string <API key> = <API key>, bool <API key> = true)
{
if (key != null && !((key is byte[]) || (key is string)))
throw new ArgumentException ("Encryption keys must be strings or byte arrays", nameof (key));
UniqueKey = string.Format ("{0}_{1:X8}", databasePath, (uint)openFlags);
<API key> = <API key>;
<API key> = <API key>;
<API key> = <API key>;
DateTimeStyle = "o".Equals (<API key>, StringComparison.OrdinalIgnoreCase) || "r".Equals (<API key>, StringComparison.OrdinalIgnoreCase) ? System.Globalization.DateTimeStyles.RoundtripKind : System.Globalization.DateTimeStyles.None;
Key = key;
PreKeyAction = preKeyAction;
PostKeyAction = postKeyAction;
OpenFlags = openFlags;
VfsName = vfsName;
#if NETFX_CORE
DatabasePath = IsInMemoryPath(databasePath)
? databasePath
: System.IO.Path.Combine(MetroStyleDataPath, databasePath);
#else
DatabasePath = databasePath;
#endif
}
}
[AttributeUsage (AttributeTargets.Class)]
public class TableAttribute : Attribute
{
public string Name { get; set; }
<summary>
Flag whether to create the table without rowid (see https://sqlite.org/withoutrowid.html)
The default is <c>false</c> so that sqlite adds an implicit <c>rowid</c> to every table created.
</summary>
public bool WithoutRowId { get; set; }
public TableAttribute (string name)
{
Name = name;
}
}
[AttributeUsage (AttributeTargets.Property)]
public class ColumnAttribute : Attribute
{
public string Name { get; set; }
public ColumnAttribute (string name)
{
Name = name;
}
}
[AttributeUsage (AttributeTargets.Property)]
public class PrimaryKeyAttribute : Attribute
{
}
[AttributeUsage (AttributeTargets.Property)]
public class <API key> : Attribute
{
}
[AttributeUsage (AttributeTargets.Property)]
public class IndexedAttribute : Attribute
{
public string Name { get; set; }
public int Order { get; set; }
public virtual bool Unique { get; set; }
public IndexedAttribute ()
{
}
public IndexedAttribute (string name, int order)
{
Name = name;
Order = order;
}
}
[AttributeUsage (AttributeTargets.Property)]
public class IgnoreAttribute : Attribute
{
}
[AttributeUsage (AttributeTargets.Property)]
public class UniqueAttribute : IndexedAttribute
{
public override bool Unique {
get { return true; }
set { /* throw? */ }
}
}
[AttributeUsage (AttributeTargets.Property)]
public class MaxLengthAttribute : Attribute
{
public int Value { get; private set; }
public MaxLengthAttribute (int length)
{
Value = length;
}
}
public sealed class PreserveAttribute : System.Attribute
{
public bool AllMembers;
public bool Conditional;
}
<summary>
Select the collating sequence to use on a column.
"BINARY", "NOCASE", and "RTRIM" are supported.
"BINARY" is the default.
</summary>
[AttributeUsage (AttributeTargets.Property)]
public class CollationAttribute : Attribute
{
public string Value { get; private set; }
public CollationAttribute (string collation)
{
Value = collation;
}
}
[AttributeUsage (AttributeTargets.Property)]
public class NotNullAttribute : Attribute
{
}
[AttributeUsage (AttributeTargets.Enum)]
public class <API key> : Attribute
{
}
public class TableMapping
{
public Type MappedType { get; private set; }
public string TableName { get; private set; }
public bool WithoutRowId { get; private set; }
public Column[] Columns { get; private set; }
public Column PK { get; private set; }
public string GetByPrimaryKeySql { get; private set; }
public CreateFlags CreateFlags { get; private set; }
internal MapMethod Method { get; private set; } = MapMethod.ByName;
readonly Column _autoPk;
readonly Column[] _insertColumns;
readonly Column[] <API key>;
public TableMapping (Type type, CreateFlags createFlags = CreateFlags.None)
{
MappedType = type;
CreateFlags = createFlags;
var typeInfo = type.GetTypeInfo ();
#if ENABLE_IL2CPP
var tableAttr = typeInfo.GetCustomAttribute<TableAttribute> ();
#else
var tableAttr =
typeInfo.CustomAttributes
.Where (x => x.AttributeType == typeof (TableAttribute))
.Select (x => (TableAttribute)Orm.InflateAttribute (x))
.FirstOrDefault ();
#endif
TableName = (tableAttr != null && !string.IsNullOrEmpty (tableAttr.Name)) ? tableAttr.Name : MappedType.Name;
WithoutRowId = tableAttr != null ? tableAttr.WithoutRowId : false;
var members = GetPublicMembers(type);
var cols = new List<Column>(members.Count);
foreach(var m in members)
{
var ignore = m.IsDefined(typeof(IgnoreAttribute), true);
if(!ignore)
cols.Add(new Column(m, createFlags));
}
Columns = cols.ToArray ();
foreach (var c in Columns) {
if (c.IsAutoInc && c.IsPK) {
_autoPk = c;
}
if (c.IsPK) {
PK = c;
}
}
HasAutoIncPK = _autoPk != null;
if (PK != null) {
GetByPrimaryKeySql = string.Format ("select * from \"{0}\" where \"{1}\" = ?", TableName, PK.Name);
}
else {
// People should not be calling Get/Find without a PK
GetByPrimaryKeySql = string.Format ("select * from \"{0}\" limit 1", TableName);
}
_insertColumns = Columns.Where (c => !c.IsAutoInc).ToArray ();
<API key> = Columns.ToArray ();
}
private IReadOnlyCollection<MemberInfo> GetPublicMembers(Type type)
{
if(type.Name.StartsWith("ValueTuple`"))
return <API key>(type);
var members = new List<MemberInfo>();
var memberNames = new HashSet<string>();
var newMembers = new List<MemberInfo>();
do
{
var ti = type.GetTypeInfo();
newMembers.Clear();
newMembers.AddRange(
from p in ti.DeclaredProperties
where !memberNames.Contains(p.Name) &&
p.CanRead && p.CanWrite &&
p.GetMethod != null && p.SetMethod != null &&
p.GetMethod.IsPublic && p.SetMethod.IsPublic &&
!p.GetMethod.IsStatic && !p.SetMethod.IsStatic
select p);
members.AddRange(newMembers);
foreach(var m in newMembers)
memberNames.Add(m.Name);
type = ti.BaseType;
}
while(type != typeof(object));
return members;
}
private IReadOnlyCollection<MemberInfo> <API key>(Type type)
{
Method = MapMethod.ByPosition;
var fields = type.GetFields();
if(fields.Length >= 8)
throw new <API key>("ValueTuple with more than 7 members not supported due to nesting; see https://docs.microsoft.com/en-us/dotnet/api/system.valuetuple-8.rest");
return fields;
}
public bool HasAutoIncPK { get; private set; }
public void SetAutoIncPK (object obj, long id)
{
if (_autoPk != null) {
_autoPk.SetValue (obj, Convert.ChangeType (id, _autoPk.ColumnType, null));
}
}
public Column[] InsertColumns {
get {
return _insertColumns;
}
}
public Column[] <API key> {
get {
return <API key>;
}
}
public Column <API key> (string propertyName)
{
var exact = Columns.FirstOrDefault (c => c.PropertyName == propertyName);
return exact;
}
public Column FindColumn (string columnName)
{
if(Method != MapMethod.ByName)
throw new <API key>($"This {nameof(TableMapping)} is not mapped by name, but {Method}.");
var exact = Columns.FirstOrDefault (c => c.Name.ToLower () == columnName.ToLower ());
return exact;
}
public class Column
{
MemberInfo _member;
public string Name { get; private set; }
public PropertyInfo PropertyInfo => _member as PropertyInfo;
public string PropertyName { get { return _member.Name; } }
public Type ColumnType { get; private set; }
public string Collation { get; private set; }
public bool IsAutoInc { get; private set; }
public bool IsAutoGuid { get; private set; }
public bool IsPK { get; private set; }
public IEnumerable<IndexedAttribute> Indices { get; set; }
public bool IsNullable { get; private set; }
public int? MaxStringLength { get; private set; }
public bool StoreAsText { get; private set; }
public Column (MemberInfo member, CreateFlags createFlags = CreateFlags.None)
{
_member = member;
var memberType = GetMemberType(member);
var colAttr = member.CustomAttributes.FirstOrDefault (x => x.AttributeType == typeof (ColumnAttribute));
#if ENABLE_IL2CPP
var ca = member.GetCustomAttribute(typeof(ColumnAttribute)) as ColumnAttribute;
Name = ca == null ? member.Name : ca.Name;
#else
Name = (colAttr != null && colAttr.<API key>.Count > 0) ?
colAttr.<API key>[0].Value?.ToString () :
member.Name;
#endif
//If this type is Nullable<T> then Nullable.GetUnderlyingType returns the T, otherwise it returns null, so get the actual type instead
ColumnType = Nullable.GetUnderlyingType (memberType) ?? memberType;
Collation = Orm.Collation (member);
IsPK = Orm.IsPK (member) ||
(((createFlags & CreateFlags.ImplicitPK) == CreateFlags.ImplicitPK) &&
string.Compare (member.Name, Orm.ImplicitPkName, StringComparison.OrdinalIgnoreCase) == 0);
var isAuto = Orm.IsAutoInc (member) || (IsPK && ((createFlags & CreateFlags.AutoIncPK) == CreateFlags.AutoIncPK));
IsAutoGuid = isAuto && ColumnType == typeof (Guid);
IsAutoInc = isAuto && !IsAutoGuid;
Indices = Orm.GetIndices (member);
if (!Indices.Any ()
&& !IsPK
&& ((createFlags & CreateFlags.ImplicitIndex) == CreateFlags.ImplicitIndex)
&& Name.EndsWith (Orm.ImplicitIndexSuffix, StringComparison.OrdinalIgnoreCase)
) {
Indices = new IndexedAttribute[] { new IndexedAttribute () };
}
IsNullable = !(IsPK || Orm.IsMarkedNotNull (member));
MaxStringLength = Orm.MaxStringLength (member);
StoreAsText = memberType.GetTypeInfo ().CustomAttributes.Any (x => x.AttributeType == typeof (<API key>));
}
public Column (PropertyInfo member, CreateFlags createFlags = CreateFlags.None)
: this((MemberInfo)member, createFlags)
{ }
public void SetValue (object obj, object val)
{
if(_member is PropertyInfo propy)
{
if (val != null && ColumnType.GetTypeInfo ().IsEnum)
propy.SetValue (obj, Enum.ToObject (ColumnType, val));
else
propy.SetValue (obj, val);
}
else if(_member is FieldInfo field)
{
if (val != null && ColumnType.GetTypeInfo ().IsEnum)
field.SetValue (obj, Enum.ToObject (ColumnType, val));
else
field.SetValue (obj, val);
}
else
throw new <API key>("unreachable condition");
}
public object GetValue (object obj)
{
if(_member is PropertyInfo propy)
return propy.GetValue(obj);
else if(_member is FieldInfo field)
return field.GetValue(obj);
else
throw new <API key>("unreachable condition");
}
private static Type GetMemberType(MemberInfo m)
{
switch(m.MemberType)
{
case MemberTypes.Property: return ((PropertyInfo)m).PropertyType;
case MemberTypes.Field: return ((FieldInfo)m).FieldType;
default: throw new <API key>($"{nameof(TableMapping)} supports properties or fields only.");
}
}
}
internal enum MapMethod
{
ByName,
ByPosition
}
}
class EnumCacheInfo
{
public EnumCacheInfo (Type type)
{
var typeInfo = type.GetTypeInfo ();
IsEnum = typeInfo.IsEnum;
if (IsEnum) {
StoreAsText = typeInfo.CustomAttributes.Any (x => x.AttributeType == typeof (<API key>));
if (StoreAsText) {
EnumValues = new Dictionary<int, string> ();
foreach (object e in Enum.GetValues (type)) {
EnumValues[Convert.ToInt32 (e)] = e.ToString ();
}
}
}
}
public bool IsEnum { get; private set; }
public bool StoreAsText { get; private set; }
public Dictionary<int, string> EnumValues { get; private set; }
}
static class EnumCache
{
static readonly Dictionary<Type, EnumCacheInfo> Cache = new Dictionary<Type, EnumCacheInfo> ();
public static EnumCacheInfo GetInfo<T> ()
{
return GetInfo (typeof (T));
}
public static EnumCacheInfo GetInfo (Type type)
{
lock (Cache) {
EnumCacheInfo info = null;
if (!Cache.TryGetValue (type, out info)) {
info = new EnumCacheInfo (type);
Cache[type] = info;
}
return info;
}
}
}
public static class Orm
{
public const int <API key> = 140;
public const string ImplicitPkName = "Id";
public const string ImplicitIndexSuffix = "Id";
public static Type GetType (object obj)
{
if (obj == null)
return typeof (object);
var rt = obj as IReflectableType;
if (rt != null)
return rt.GetTypeInfo ().AsType ();
return obj.GetType ();
}
public static string SqlDecl (TableMapping.Column p, bool <API key>, bool <API key>)
{
string decl = "\"" + p.Name + "\" " + SqlType (p, <API key>, <API key>) + " ";
if (p.IsPK) {
decl += "primary key ";
}
if (p.IsAutoInc) {
decl += "autoincrement ";
}
if (!p.IsNullable) {
decl += "not null ";
}
if (!string.IsNullOrEmpty (p.Collation)) {
decl += "collate " + p.Collation + " ";
}
return decl;
}
public static string SqlType (TableMapping.Column p, bool <API key>, bool <API key>)
{
var clrType = p.ColumnType;
if (clrType == typeof (Boolean) || clrType == typeof (Byte) || clrType == typeof (UInt16) || clrType == typeof (SByte) || clrType == typeof (Int16) || clrType == typeof (Int32) || clrType == typeof (UInt32) || clrType == typeof (Int64)) {
return "integer";
}
else if (clrType == typeof (Single) || clrType == typeof (Double) || clrType == typeof (Decimal)) {
return "float";
}
else if (clrType == typeof (String) || clrType == typeof (StringBuilder) || clrType == typeof (Uri) || clrType == typeof (UriBuilder)) {
int? len = p.MaxStringLength;
if (len.HasValue)
return "varchar(" + len.Value + ")";
return "varchar";
}
else if (clrType == typeof (TimeSpan)) {
return <API key> ? "bigint" : "time";
}
else if (clrType == typeof (DateTime)) {
return <API key> ? "bigint" : "datetime";
}
else if (clrType == typeof (DateTimeOffset)) {
return "bigint";
}
else if (clrType.GetTypeInfo ().IsEnum) {
if (p.StoreAsText)
return "varchar";
else
return "integer";
}
else if (clrType == typeof (byte[])) {
return "blob";
}
else if (clrType == typeof (Guid)) {
return "varchar(36)";
}
else {
throw new <API key> ("Don't know about " + clrType);
}
}
public static bool IsPK (MemberInfo p)
{
return p.CustomAttributes.Any (x => x.AttributeType == typeof (PrimaryKeyAttribute));
}
public static string Collation (MemberInfo p)
{
#if ENABLE_IL2CPP
return (p.GetCustomAttribute<CollationAttribute> ()?.Value) ?? "";
#else
return
(p.CustomAttributes
.Where (x => typeof (CollationAttribute) == x.AttributeType)
.Select (x => {
var args = x.<API key>;
return args.Count > 0 ? ((args[0].Value as string) ?? "") : "";
})
.FirstOrDefault ()) ?? "";
#endif
}
public static bool IsAutoInc (MemberInfo p)
{
return p.CustomAttributes.Any (x => x.AttributeType == typeof (<API key>));
}
public static FieldInfo GetField (TypeInfo t, string name)
{
var f = t.GetDeclaredField (name);
if (f != null)
return f;
return GetField (t.BaseType.GetTypeInfo (), name);
}
public static PropertyInfo GetProperty (TypeInfo t, string name)
{
var f = t.GetDeclaredProperty (name);
if (f != null)
return f;
return GetProperty (t.BaseType.GetTypeInfo (), name);
}
public static object InflateAttribute (CustomAttributeData x)
{
var atype = x.AttributeType;
var typeInfo = atype.GetTypeInfo ();
#if ENABLE_IL2CPP
var r = Activator.CreateInstance (x.AttributeType);
#else
var args = x.<API key>.Select (a => a.Value).ToArray ();
var r = Activator.CreateInstance (x.AttributeType, args);
foreach (var arg in x.NamedArguments) {
if (arg.IsField) {
GetField (typeInfo, arg.MemberName).SetValue (r, arg.TypedValue.Value);
}
else {
GetProperty (typeInfo, arg.MemberName).SetValue (r, arg.TypedValue.Value);
}
}
#endif
return r;
}
public static IEnumerable<IndexedAttribute> GetIndices (MemberInfo p)
{
#if ENABLE_IL2CPP
return p.GetCustomAttributes<IndexedAttribute> ();
#else
var indexedInfo = typeof (IndexedAttribute).GetTypeInfo ();
return
p.CustomAttributes
.Where (x => indexedInfo.IsAssignableFrom (x.AttributeType.GetTypeInfo ()))
.Select (x => (IndexedAttribute)InflateAttribute (x));
#endif
}
public static int? MaxStringLength (MemberInfo p)
{
#if ENABLE_IL2CPP
return p.GetCustomAttribute<MaxLengthAttribute> ()?.Value;
#else
var attr = p.CustomAttributes.FirstOrDefault (x => x.AttributeType == typeof (MaxLengthAttribute));
if (attr != null) {
var attrv = (MaxLengthAttribute)InflateAttribute (attr);
return attrv.Value;
}
return null;
#endif
}
public static int? MaxStringLength (PropertyInfo p) => MaxStringLength((MemberInfo)p);
public static bool IsMarkedNotNull (MemberInfo p)
{
return p.CustomAttributes.Any (x => x.AttributeType == typeof (NotNullAttribute));
}
}
public partial class SQLiteCommand
{
SQLiteConnection _conn;
private List<Binding> _bindings;
public string CommandText { get; set; }
public SQLiteCommand (SQLiteConnection conn)
{
_conn = conn;
_bindings = new List<Binding> ();
CommandText = "";
}
public int ExecuteNonQuery ()
{
if (_conn.Trace) {
_conn.Tracer?.Invoke ("Executing: " + this);
}
var r = SQLite3.Result.OK;
var stmt = Prepare ();
r = SQLite3.Step (stmt);
Finalize (stmt);
if (r == SQLite3.Result.Done) {
int rowsAffected = SQLite3.Changes (_conn.Handle);
return rowsAffected;
}
else if (r == SQLite3.Result.Error) {
string msg = SQLite3.GetErrmsg (_conn.Handle);
throw SQLiteException.New (r, msg);
}
else if (r == SQLite3.Result.Constraint) {
if (SQLite3.ExtendedErrCode (_conn.Handle) == SQLite3.ExtendedResult.ConstraintNotNull) {
throw <API key>.New (r, SQLite3.GetErrmsg (_conn.Handle));
}
}
throw SQLiteException.New (r, SQLite3.GetErrmsg (_conn.Handle));
}
public IEnumerable<T> <API key><T> ()
{
return <API key><T> (_conn.GetMapping (typeof (T)));
}
public List<T> ExecuteQuery<T> ()
{
return <API key><T> (_conn.GetMapping (typeof (T))).ToList ();
}
public List<T> ExecuteQuery<T> (TableMapping map)
{
return <API key><T> (map).ToList ();
}
<summary>
Invoked every time an instance is loaded from the database.
</summary>
<param name='obj'>
The newly created object.
</param>
<remarks>
This can be overridden in combination with the <see cref="SQLiteConnection.NewCommand"/>
method to hook into the life-cycle of objects.
</remarks>
protected virtual void OnInstanceCreated (object obj)
{
// Can be overridden.
}
public IEnumerable<T> <API key><T> (TableMapping map)
{
if (_conn.Trace) {
_conn.Tracer?.Invoke ("Executing Query: " + this);
}
var stmt = Prepare ();
try {
var cols = new TableMapping.Column[SQLite3.ColumnCount (stmt)];
var fastColumnSetters = new Action<object, Sqlite3Statement, int>[SQLite3.ColumnCount (stmt)];
if (map.Method == TableMapping.MapMethod.ByPosition)
{
Array.Copy(map.Columns, cols, Math.Min(cols.Length, map.Columns.Length));
}
else if (map.Method == TableMapping.MapMethod.ByName) {
MethodInfo getSetter = null;
if (typeof(T) != map.MappedType) {
getSetter = typeof(FastColumnSetter)
.GetMethod (nameof(FastColumnSetter.GetFastSetter),
BindingFlags.NonPublic | BindingFlags.Static).MakeGenericMethod (map.MappedType);
}
for (int i = 0; i < cols.Length; i++) {
var name = SQLite3.ColumnName16 (stmt, i);
cols[i] = map.FindColumn (name);
if (cols[i] != null)
if (getSetter != null) {
fastColumnSetters[i] = (Action<object, Sqlite3Statement, int>)getSetter.Invoke(null, new object[]{ _conn, cols[i]});
}
else {
fastColumnSetters[i] = FastColumnSetter.GetFastSetter<T>(_conn, cols[i]);
}
}
}
while (SQLite3.Step (stmt) == SQLite3.Result.Row) {
var obj = Activator.CreateInstance (map.MappedType);
for (int i = 0; i < cols.Length; i++) {
if (cols[i] == null)
continue;
if (fastColumnSetters[i] != null) {
fastColumnSetters[i].Invoke (obj, stmt, i);
}
else {
var colType = SQLite3.ColumnType (stmt, i);
var val = ReadCol (stmt, i, colType, cols[i].ColumnType);
cols[i].SetValue (obj, val);
}
}
OnInstanceCreated (obj);
yield return (T)obj;
}
}
finally {
SQLite3.Finalize (stmt);
}
}
public T ExecuteScalar<T> ()
{
if (_conn.Trace) {
_conn.Tracer?.Invoke ("Executing Query: " + this);
}
T val = default (T);
var stmt = Prepare ();
try {
var r = SQLite3.Step (stmt);
if (r == SQLite3.Result.Row) {
var colType = SQLite3.ColumnType (stmt, 0);
var colval = ReadCol (stmt, 0, colType, typeof (T));
if (colval != null) {
val = (T)colval;
}
}
else if (r == SQLite3.Result.Done) {
}
else {
throw SQLiteException.New (r, SQLite3.GetErrmsg (_conn.Handle));
}
}
finally {
Finalize (stmt);
}
return val;
}
public IEnumerable<T> ExecuteQueryScalars<T> ()
{
if (_conn.Trace) {
_conn.Tracer?.Invoke ("Executing Query: " + this);
}
var stmt = Prepare ();
try {
if (SQLite3.ColumnCount (stmt) < 1) {
throw new <API key> ("QueryScalars should return at least one column");
}
while (SQLite3.Step (stmt) == SQLite3.Result.Row) {
var colType = SQLite3.ColumnType (stmt, 0);
var val = ReadCol (stmt, 0, colType, typeof (T));
if (val == null) {
yield return default (T);
}
else {
yield return (T)val;
}
}
}
finally {
Finalize (stmt);
}
}
public void Bind (string name, object val)
{
_bindings.Add (new Binding {
Name = name,
Value = val
});
}
public void Bind (object val)
{
Bind (null, val);
}
public override string ToString ()
{
var parts = new string[1 + _bindings.Count];
parts[0] = CommandText;
var i = 1;
foreach (var b in _bindings) {
parts[i] = string.Format (" {0}: {1}", i - 1, b.Value);
i++;
}
return string.Join (Environment.NewLine, parts);
}
Sqlite3Statement Prepare ()
{
var stmt = SQLite3.Prepare2 (_conn.Handle, CommandText);
BindAll (stmt);
return stmt;
}
void Finalize (Sqlite3Statement stmt)
{
SQLite3.Finalize (stmt);
}
void BindAll (Sqlite3Statement stmt)
{
int nextIdx = 1;
foreach (var b in _bindings) {
if (b.Name != null) {
b.Index = SQLite3.BindParameterIndex (stmt, b.Name);
}
else {
b.Index = nextIdx++;
}
BindParameter (stmt, b.Index, b.Value, _conn.<API key>, _conn.<API key>, _conn.<API key>);
}
}
static IntPtr NegativePointer = new IntPtr (-1);
internal static void BindParameter (Sqlite3Statement stmt, int index, object value, bool <API key>, string <API key>, bool <API key>)
{
if (value == null) {
SQLite3.BindNull (stmt, index);
}
else {
if (value is Int32) {
SQLite3.BindInt (stmt, index, (int)value);
}
else if (value is String) {
SQLite3.BindText (stmt, index, (string)value, -1, NegativePointer);
}
else if (value is Byte || value is UInt16 || value is SByte || value is Int16) {
SQLite3.BindInt (stmt, index, Convert.ToInt32 (value));
}
else if (value is Boolean) {
SQLite3.BindInt (stmt, index, (bool)value ? 1 : 0);
}
else if (value is UInt32 || value is Int64) {
SQLite3.BindInt64 (stmt, index, Convert.ToInt64 (value));
}
else if (value is Single || value is Double || value is Decimal) {
SQLite3.BindDouble (stmt, index, Convert.ToDouble (value));
}
else if (value is TimeSpan) {
if (<API key>) {
SQLite3.BindInt64 (stmt, index, ((TimeSpan)value).Ticks);
}
else {
SQLite3.BindText (stmt, index, ((TimeSpan)value).ToString (), -1, NegativePointer);
}
}
else if (value is DateTime) {
if (<API key>) {
SQLite3.BindInt64 (stmt, index, ((DateTime)value).Ticks);
}
else {
SQLite3.BindText (stmt, index, ((DateTime)value).ToString (<API key>, System.Globalization.CultureInfo.InvariantCulture), -1, NegativePointer);
}
}
else if (value is DateTimeOffset) {
SQLite3.BindInt64 (stmt, index, ((DateTimeOffset)value).UtcTicks);
}
else if (value is byte[]) {
SQLite3.BindBlob (stmt, index, (byte[])value, ((byte[])value).Length, NegativePointer);
}
else if (value is Guid) {
SQLite3.BindText (stmt, index, ((Guid)value).ToString (), 72, NegativePointer);
}
else if (value is Uri) {
SQLite3.BindText (stmt, index, ((Uri)value).ToString (), -1, NegativePointer);
}
else if (value is StringBuilder) {
SQLite3.BindText (stmt, index, ((StringBuilder)value).ToString (), -1, NegativePointer);
}
else if (value is UriBuilder) {
SQLite3.BindText (stmt, index, ((UriBuilder)value).ToString (), -1, NegativePointer);
}
else {
// Now we could possibly get an enum, retrieve cached info
var valueType = value.GetType ();
var enumInfo = EnumCache.GetInfo (valueType);
if (enumInfo.IsEnum) {
var enumIntValue = Convert.ToInt32 (value);
if (enumInfo.StoreAsText)
SQLite3.BindText (stmt, index, enumInfo.EnumValues[enumIntValue], -1, NegativePointer);
else
SQLite3.BindInt (stmt, index, enumIntValue);
}
else {
throw new <API key> ("Cannot store type: " + Orm.GetType (value));
}
}
}
}
class Binding
{
public string Name { get; set; }
public object Value { get; set; }
public int Index { get; set; }
}
object ReadCol (Sqlite3Statement stmt, int index, SQLite3.ColType type, Type clrType)
{
if (type == SQLite3.ColType.Null) {
return null;
}
else {
var clrTypeInfo = clrType.GetTypeInfo ();
if (clrTypeInfo.IsGenericType && clrTypeInfo.<API key> () == typeof (Nullable<>)) {
clrType = clrTypeInfo.<API key>[0];
clrTypeInfo = clrType.GetTypeInfo ();
}
if (clrType == typeof (String)) {
return SQLite3.ColumnString (stmt, index);
}
else if (clrType == typeof (Int32)) {
return (int)SQLite3.ColumnInt (stmt, index);
}
else if (clrType == typeof (Boolean)) {
return SQLite3.ColumnInt (stmt, index) == 1;
}
else if (clrType == typeof (double)) {
return SQLite3.ColumnDouble (stmt, index);
}
else if (clrType == typeof (float)) {
return (float)SQLite3.ColumnDouble (stmt, index);
}
else if (clrType == typeof (TimeSpan)) {
if (_conn.<API key>) {
return new TimeSpan (SQLite3.ColumnInt64 (stmt, index));
}
else {
var text = SQLite3.ColumnString (stmt, index);
TimeSpan resultTime;
if (!TimeSpan.TryParseExact (text, "c", System.Globalization.CultureInfo.InvariantCulture, System.Globalization.TimeSpanStyles.None, out resultTime)) {
resultTime = TimeSpan.Parse (text);
}
return resultTime;
}
}
else if (clrType == typeof (DateTime)) {
if (_conn.<API key>) {
return new DateTime (SQLite3.ColumnInt64 (stmt, index));
}
else {
var text = SQLite3.ColumnString (stmt, index);
DateTime resultDate;
if (!DateTime.TryParseExact (text, _conn.<API key>, System.Globalization.CultureInfo.InvariantCulture, _conn.DateTimeStyle, out resultDate)) {
resultDate = DateTime.Parse (text);
}
return resultDate;
}
}
else if (clrType == typeof (DateTimeOffset)) {
return new DateTimeOffset (SQLite3.ColumnInt64 (stmt, index), TimeSpan.Zero);
}
else if (clrTypeInfo.IsEnum) {
if (type == SQLite3.ColType.Text) {
var value = SQLite3.ColumnString (stmt, index);
return Enum.Parse (clrType, value.ToString (), true);
}
else
return SQLite3.ColumnInt (stmt, index);
}
else if (clrType == typeof (Int64)) {
return SQLite3.ColumnInt64 (stmt, index);
}
else if (clrType == typeof (UInt32)) {
return (uint)SQLite3.ColumnInt64 (stmt, index);
}
else if (clrType == typeof (decimal)) {
return (decimal)SQLite3.ColumnDouble (stmt, index);
}
else if (clrType == typeof (Byte)) {
return (byte)SQLite3.ColumnInt (stmt, index);
}
else if (clrType == typeof (UInt16)) {
return (ushort)SQLite3.ColumnInt (stmt, index);
}
else if (clrType == typeof (Int16)) {
return (short)SQLite3.ColumnInt (stmt, index);
}
else if (clrType == typeof (sbyte)) {
return (sbyte)SQLite3.ColumnInt (stmt, index);
}
else if (clrType == typeof (byte[])) {
return SQLite3.ColumnByteArray (stmt, index);
}
else if (clrType == typeof (Guid)) {
var text = SQLite3.ColumnString (stmt, index);
return new Guid (text);
}
else if (clrType == typeof (Uri)) {
var text = SQLite3.ColumnString (stmt, index);
return new Uri (text);
}
else if (clrType == typeof (StringBuilder)) {
var text = SQLite3.ColumnString (stmt, index);
return new StringBuilder (text);
}
else if (clrType == typeof (UriBuilder)) {
var text = SQLite3.ColumnString (stmt, index);
return new UriBuilder (text);
}
else {
throw new <API key> ("Don't know how to read " + clrType);
}
}
}
}
internal class FastColumnSetter
{
<summary>
Creates a delegate that can be used to quickly set object members from query columns.
Note that this frontloads the slow reflection-based type checking for columns to only happen once at the beginning of a query,
and then afterwards each row of the query can invoke the delegate returned by this function to get much better performance (up to 10x speed boost, depending on query size and platform).
</summary>
<typeparam name="T">The type of the destination object that the query will read into</typeparam>
<param name="conn">The active connection. Note that this is primarily needed in order to read preferences regarding how certain data types (such as TimeSpan / DateTime) should be encoded in the database.</param>
<param name="column">The table mapping used to map the statement column to a member of the destination object type</param>
<returns>
A delegate for fast-setting of object members from statement columns.
If no fast setter is available for the requested column (enums in particular cause headache), then this function returns null.
</returns>
internal static Action<object, Sqlite3Statement, int> GetFastSetter<T> (SQLiteConnection conn, TableMapping.Column column)
{
Action<object, Sqlite3Statement, int> fastSetter = null;
Type clrType = column.PropertyInfo.PropertyType;
var clrTypeInfo = clrType.GetTypeInfo ();
if (clrTypeInfo.IsGenericType && clrTypeInfo.<API key> () == typeof (Nullable<>)) {
clrType = clrTypeInfo.<API key>[0];
clrTypeInfo = clrType.GetTypeInfo ();
}
if (clrType == typeof (String)) {
fastSetter = <API key><T, string> (column, (stmt, index) => {
return SQLite3.ColumnString (stmt, index);
});
}
else if (clrType == typeof (Int32)) {
fastSetter = <API key><T, int> (column, (stmt, index)=>{
return SQLite3.ColumnInt (stmt, index);
});
}
else if (clrType == typeof (Boolean)) {
fastSetter = <API key><T, bool> (column, (stmt, index) => {
return SQLite3.ColumnInt (stmt, index) == 1;
});
}
else if (clrType == typeof (double)) {
fastSetter = <API key><T, double> (column, (stmt, index) => {
return SQLite3.ColumnDouble (stmt, index);
});
}
else if (clrType == typeof (float)) {
fastSetter = <API key><T, float> (column, (stmt, index) => {
return (float) SQLite3.ColumnDouble (stmt, index);
});
}
else if (clrType == typeof (TimeSpan)) {
if (conn.<API key>) {
fastSetter = <API key><T, TimeSpan> (column, (stmt, index) => {
return new TimeSpan (SQLite3.ColumnInt64 (stmt, index));
});
}
else {
fastSetter = <API key><T, TimeSpan> (column, (stmt, index) => {
var text = SQLite3.ColumnString (stmt, index);
TimeSpan resultTime;
if (!TimeSpan.TryParseExact (text, "c", System.Globalization.CultureInfo.InvariantCulture, System.Globalization.TimeSpanStyles.None, out resultTime)) {
resultTime = TimeSpan.Parse (text);
}
return resultTime;
});
}
}
else if (clrType == typeof (DateTime)) {
if (conn.<API key>) {
fastSetter = <API key><T, DateTime> (column, (stmt, index) => {
return new DateTime (SQLite3.ColumnInt64 (stmt, index));
});
}
else {
fastSetter = <API key><T, DateTime> (column, (stmt, index) => {
var text = SQLite3.ColumnString (stmt, index);
DateTime resultDate;
if (!DateTime.TryParseExact (text, conn.<API key>, System.Globalization.CultureInfo.InvariantCulture, conn.DateTimeStyle, out resultDate)) {
resultDate = DateTime.Parse (text);
}
return resultDate;
});
}
}
else if (clrType == typeof (DateTimeOffset)) {
fastSetter = <API key><T, DateTimeOffset> (column, (stmt, index) => {
return new DateTimeOffset (SQLite3.ColumnInt64 (stmt, index), TimeSpan.Zero);
});
}
else if (clrTypeInfo.IsEnum) {
// NOTE: Not sure of a good way (if any?) to do a strongly-typed fast setter like this for enumerated types -- for now, return null and column sets will revert back to the safe (but slow) Reflection-based method of column prop.Set()
}
else if (clrType == typeof (Int64)) {
fastSetter = <API key><T, Int64> (column, (stmt, index) => {
return SQLite3.ColumnInt64 (stmt, index);
});
}
else if (clrType == typeof (UInt32)) {
fastSetter = <API key><T, UInt32> (column, (stmt, index) => {
return (uint)SQLite3.ColumnInt64 (stmt, index);
});
}
else if (clrType == typeof (decimal)) {
fastSetter = <API key><T, decimal> (column, (stmt, index) => {
return (decimal)SQLite3.ColumnDouble (stmt, index);
});
}
else if (clrType == typeof (Byte)) {
fastSetter = <API key><T, Byte> (column, (stmt, index) => {
return (byte)SQLite3.ColumnInt (stmt, index);
});
}
else if (clrType == typeof (UInt16)) {
fastSetter = <API key><T, UInt16> (column, (stmt, index) => {
return (ushort)SQLite3.ColumnInt (stmt, index);
});
}
else if (clrType == typeof (Int16)) {
fastSetter = <API key><T, Int16> (column, (stmt, index) => {
return (short)SQLite3.ColumnInt (stmt, index);
});
}
else if (clrType == typeof (sbyte)) {
fastSetter = <API key><T, sbyte> (column, (stmt, index) => {
return (sbyte)SQLite3.ColumnInt (stmt, index);
});
}
else if (clrType == typeof (byte[])) {
fastSetter = <API key><T, byte[]> (column, (stmt, index) => {
return SQLite3.ColumnByteArray (stmt, index);
});
}
else if (clrType == typeof (Guid)) {
fastSetter = <API key><T, Guid> (column, (stmt, index) => {
var text = SQLite3.ColumnString (stmt, index);
return new Guid (text);
});
}
else if (clrType == typeof (Uri)) {
fastSetter = <API key><T, Uri> (column, (stmt, index) => {
var text = SQLite3.ColumnString (stmt, index);
return new Uri (text);
});
}
else if (clrType == typeof (StringBuilder)) {
fastSetter = <API key><T, StringBuilder> (column, (stmt, index) => {
var text = SQLite3.ColumnString (stmt, index);
return new StringBuilder (text);
});
}
else if (clrType == typeof (UriBuilder)) {
fastSetter = <API key><T, UriBuilder> (column, (stmt, index) => {
var text = SQLite3.ColumnString (stmt, index);
return new UriBuilder (text);
});
}
else {
// NOTE: Will fall back to the slow setter method in the event that we are unable to create a fast setter delegate for a particular column type
}
return fastSetter;
}
<summary>
This creates a strongly typed delegate that will permit fast setting of column values given a Sqlite3Statement and a column index.
Note that this is identical to <API key>(), but has an extra check to see if it should create a nullable version of the delegate.
</summary>
<typeparam name="ObjectType">The type of the object whose member column is being set</typeparam>
<typeparam name="ColumnMemberType">The CLR type of the member in the object which corresponds to the given SQLite columnn</typeparam>
<param name="column">The column mapping that identifies the target member of the destination object</param>
<param name="getColumnValue">A lambda that can be used to retrieve the column value at query-time</param>
<returns>A strongly-typed delegate</returns>
private static Action<object, Sqlite3Statement, int> <API key><ObjectType, ColumnMemberType> (TableMapping.Column column, Func<Sqlite3Statement, int, ColumnMemberType> getColumnValue) where ColumnMemberType : struct
{
var clrTypeInfo = column.PropertyInfo.PropertyType.GetTypeInfo();
bool isNullable = false;
if (clrTypeInfo.IsGenericType && clrTypeInfo.<API key> () == typeof (Nullable<>)) {
isNullable = true;
}
if (isNullable) {
var setProperty = (Action<ObjectType, ColumnMemberType?>)Delegate.CreateDelegate (
typeof (Action<ObjectType, ColumnMemberType?>), null,
column.PropertyInfo.GetSetMethod ());
return (o, stmt, i) => {
var colType = SQLite3.ColumnType (stmt, i);
if (colType != SQLite3.ColType.Null)
setProperty.Invoke ((ObjectType)o, getColumnValue.Invoke (stmt, i));
};
}
return <API key><ObjectType, ColumnMemberType> (column, getColumnValue);
}
<summary>
This creates a strongly typed delegate that will permit fast setting of column values given a Sqlite3Statement and a column index.
</summary>
<typeparam name="ObjectType">The type of the object whose member column is being set</typeparam>
<typeparam name="ColumnMemberType">The CLR type of the member in the object which corresponds to the given SQLite columnn</typeparam>
<param name="column">The column mapping that identifies the target member of the destination object</param>
<param name="getColumnValue">A lambda that can be used to retrieve the column value at query-time</param>
<returns>A strongly-typed delegate</returns>
private static Action<object, Sqlite3Statement, int> <API key><ObjectType, ColumnMemberType> (TableMapping.Column column, Func<Sqlite3Statement, int, ColumnMemberType> getColumnValue)
{
var setProperty = (Action<ObjectType, ColumnMemberType>)Delegate.CreateDelegate (
typeof (Action<ObjectType, ColumnMemberType>), null,
column.PropertyInfo.GetSetMethod ());
return (o, stmt, i) => {
var colType = SQLite3.ColumnType (stmt, i);
if (colType != SQLite3.ColType.Null)
setProperty.Invoke ((ObjectType)o, getColumnValue.Invoke (stmt, i));
};
}
}
<summary>
Since the insert never changed, we only need to prepare once.
</summary>
class <API key> : IDisposable
{
bool Initialized;
SQLiteConnection Connection;
string CommandText;
Sqlite3Statement Statement;
static readonly Sqlite3Statement NullStatement = default (Sqlite3Statement);
public <API key> (SQLiteConnection conn, string commandText)
{
Connection = conn;
CommandText = commandText;
}
public int ExecuteNonQuery (object[] source)
{
if (Initialized && Statement == NullStatement) {
throw new <API key> (nameof (<API key>));
}
if (Connection.Trace) {
Connection.Tracer?.Invoke ("Executing: " + CommandText);
}
var r = SQLite3.Result.OK;
if (!Initialized) {
Statement = SQLite3.Prepare2 (Connection.Handle, CommandText);
Initialized = true;
}
//bind the values.
if (source != null) {
for (int i = 0; i < source.Length; i++) {
SQLiteCommand.BindParameter (Statement, i + 1, source[i], Connection.<API key>, Connection.<API key>, Connection.<API key>);
}
}
r = SQLite3.Step (Statement);
if (r == SQLite3.Result.Done) {
int rowsAffected = SQLite3.Changes (Connection.Handle);
SQLite3.Reset (Statement);
return rowsAffected;
}
else if (r == SQLite3.Result.Error) {
string msg = SQLite3.GetErrmsg (Connection.Handle);
SQLite3.Reset (Statement);
throw SQLiteException.New (r, msg);
}
else if (r == SQLite3.Result.Constraint && SQLite3.ExtendedErrCode (Connection.Handle) == SQLite3.ExtendedResult.ConstraintNotNull) {
SQLite3.Reset (Statement);
throw <API key>.New (r, SQLite3.GetErrmsg (Connection.Handle));
}
else {
SQLite3.Reset (Statement);
throw SQLiteException.New (r, SQLite3.GetErrmsg (Connection.Handle));
}
}
public void Dispose ()
{
Dispose (true);
GC.SuppressFinalize (this);
}
void Dispose (bool disposing)
{
var s = Statement;
Statement = NullStatement;
Connection = null;
if (s != NullStatement) {
SQLite3.Finalize (s);
}
}
~<API key> ()
{
Dispose (false);
}
}
public enum CreateTableResult
{
Created,
Migrated,
}
public class CreateTablesResult
{
public Dictionary<Type, CreateTableResult> Results { get; private set; }
public CreateTablesResult ()
{
Results = new Dictionary<Type, CreateTableResult> ();
}
}
public abstract class BaseTableQuery
{
protected class Ordering
{
public string ColumnName { get; set; }
public bool Ascending { get; set; }
}
}
public class TableQuery<T> : BaseTableQuery, IEnumerable<T>
{
public SQLiteConnection Connection { get; private set; }
public TableMapping Table { get; private set; }
Expression _where;
List<Ordering> _orderBys;
int? _limit;
int? _offset;
BaseTableQuery _joinInner;
Expression <API key>;
BaseTableQuery _joinOuter;
Expression <API key>;
Expression _joinSelector;
Expression _selector;
TableQuery (SQLiteConnection conn, TableMapping table)
{
Connection = conn;
Table = table;
}
public TableQuery (SQLiteConnection conn)
{
Connection = conn;
Table = Connection.GetMapping (typeof (T));
}
public TableQuery<U> Clone<U> ()
{
var q = new TableQuery<U> (Connection, Table);
q._where = _where;
q._deferred = _deferred;
if (_orderBys != null) {
q._orderBys = new List<Ordering> (_orderBys);
}
q._limit = _limit;
q._offset = _offset;
q._joinInner = _joinInner;
q.<API key> = <API key>;
q._joinOuter = _joinOuter;
q.<API key> = <API key>;
q._joinSelector = _joinSelector;
q._selector = _selector;
return q;
}
<summary>
Filters the query based on a predicate.
</summary>
public TableQuery<T> Where (Expression<Func<T, bool>> predExpr)
{
if (predExpr.NodeType == ExpressionType.Lambda) {
var lambda = (LambdaExpression)predExpr;
var pred = lambda.Body;
var q = Clone<T> ();
q.AddWhere (pred);
return q;
}
else {
throw new <API key> ("Must be a predicate");
}
}
<summary>
Delete all the rows that match this query.
</summary>
public int Delete ()
{
return Delete (null);
}
<summary>
Delete all the rows that match this query and the given predicate.
</summary>
public int Delete (Expression<Func<T, bool>> predExpr)
{
if (_limit.HasValue || _offset.HasValue)
throw new <API key> ("Cannot delete with limits or offsets");
if (_where == null && predExpr == null)
throw new <API key> ("No condition specified");
var pred = _where;
if (predExpr != null && predExpr.NodeType == ExpressionType.Lambda) {
var lambda = (LambdaExpression)predExpr;
pred = pred != null ? Expression.AndAlso (pred, lambda.Body) : lambda.Body;
}
var args = new List<object> ();
var cmdText = "delete from \"" + Table.TableName + "\"";
var w = CompileExpr (pred, args);
cmdText += " where " + w.CommandText;
var command = Connection.CreateCommand (cmdText, args.ToArray ());
int result = command.ExecuteNonQuery ();
return result;
}
<summary>
Yields a given number of elements from the query and then skips the remainder.
</summary>
public TableQuery<T> Take (int n)
{
var q = Clone<T> ();
q._limit = n;
return q;
}
<summary>
Skips a given number of elements from the query and then yields the remainder.
</summary>
public TableQuery<T> Skip (int n)
{
var q = Clone<T> ();
q._offset = n;
return q;
}
<summary>
Returns the element at a given index
</summary>
public T ElementAt (int index)
{
return Skip (index).Take (1).First ();
}
bool _deferred;
public TableQuery<T> Deferred ()
{
var q = Clone<T> ();
q._deferred = true;
return q;
}
<summary>
Order the query results according to a key.
</summary>
public TableQuery<T> OrderBy<U> (Expression<Func<T, U>> orderExpr)
{
return AddOrderBy<U> (orderExpr, true);
}
<summary>
Order the query results according to a key.
</summary>
public TableQuery<T> OrderByDescending<U> (Expression<Func<T, U>> orderExpr)
{
return AddOrderBy<U> (orderExpr, false);
}
<summary>
Order the query results according to a key.
</summary>
public TableQuery<T> ThenBy<U> (Expression<Func<T, U>> orderExpr)
{
return AddOrderBy<U> (orderExpr, true);
}
<summary>
Order the query results according to a key.
</summary>
public TableQuery<T> ThenByDescending<U> (Expression<Func<T, U>> orderExpr)
{
return AddOrderBy<U> (orderExpr, false);
}
TableQuery<T> AddOrderBy<U> (Expression<Func<T, U>> orderExpr, bool asc)
{
if (orderExpr.NodeType == ExpressionType.Lambda) {
var lambda = (LambdaExpression)orderExpr;
MemberExpression mem = null;
var unary = lambda.Body as UnaryExpression;
if (unary != null && unary.NodeType == ExpressionType.Convert) {
mem = unary.Operand as MemberExpression;
}
else {
mem = lambda.Body as MemberExpression;
}
if (mem != null && (mem.Expression.NodeType == ExpressionType.Parameter)) {
var q = Clone<T> ();
if (q._orderBys == null) {
q._orderBys = new List<Ordering> ();
}
q._orderBys.Add (new Ordering {
ColumnName = Table.<API key> (mem.Member.Name).Name,
Ascending = asc
});
return q;
}
else {
throw new <API key> ("Order By does not support: " + orderExpr);
}
}
else {
throw new <API key> ("Must be a predicate");
}
}
private void AddWhere (Expression pred)
{
if (_where == null) {
_where = pred;
}
else {
_where = Expression.AndAlso (_where, pred);
}
}
// <summary>
// Performs an inner join of two queries based on matching keys extracted from the elements.
// </summary>
//public TableQuery<TResult> Join<TInner, TKey, TResult> (
// TableQuery<TInner> inner,
// Expression<Func<T, TKey>> outerKeySelector,
// Expression<Func<TInner, TKey>> innerKeySelector,
// Expression<Func<T, TInner, TResult>> resultSelector)
// var q = new TableQuery<TResult> (Connection, Connection.GetMapping (typeof (TResult))) {
// _joinOuter = this,
// <API key> = outerKeySelector,
// _joinInner = inner,
// <API key> = innerKeySelector,
// _joinSelector = resultSelector,
// return q;
// Not needed until Joins are supported
// Keeping this commented out forces the default Linq to objects processor to run
//public TableQuery<TResult> Select<TResult> (Expression<Func<T, TResult>> selector)
// var q = Clone<TResult> ();
// q._selector = selector;
// return q;
private SQLiteCommand GenerateCommand (string selectionList)
{
if (_joinInner != null && _joinOuter != null) {
throw new <API key> ("Joins are not supported.");
}
else {
var cmdText = "select " + selectionList + " from \"" + Table.TableName + "\"";
var args = new List<object> ();
if (_where != null) {
var w = CompileExpr (_where, args);
cmdText += " where " + w.CommandText;
}
if ((_orderBys != null) && (_orderBys.Count > 0)) {
var t = string.Join (", ", _orderBys.Select (o => "\"" + o.ColumnName + "\"" + (o.Ascending ? "" : " desc")).ToArray ());
cmdText += " order by " + t;
}
if (_limit.HasValue) {
cmdText += " limit " + _limit.Value;
}
if (_offset.HasValue) {
if (!_limit.HasValue) {
cmdText += " limit -1 ";
}
cmdText += " offset " + _offset.Value;
}
return Connection.CreateCommand (cmdText, args.ToArray ());
}
}
class CompileResult
{
public string CommandText { get; set; }
public object Value { get; set; }
}
private CompileResult CompileExpr (Expression expr, List<object> queryArgs)
{
if (expr == null) {
throw new <API key> ("Expression is NULL");
}
else if (expr is BinaryExpression) {
var bin = (BinaryExpression)expr;
// VB turns 'x=="foo"' into 'CompareString(x,"foo",true/false)==0', so we need to unwrap it
if (bin.Left.NodeType == ExpressionType.Call) {
var call = (<API key>)bin.Left;
if (call.Method.DeclaringType.FullName == "Microsoft.VisualBasic.CompilerServices.Operators"
&& call.Method.Name == "CompareString")
bin = Expression.MakeBinary (bin.NodeType, call.Arguments[0], call.Arguments[1]);
}
var leftr = CompileExpr (bin.Left, queryArgs);
var rightr = CompileExpr (bin.Right, queryArgs);
//If either side is a parameter and is null, then handle the other side specially (for "is null"/"is not null")
string text;
if (leftr.CommandText == "?" && leftr.Value == null)
text = <API key> (bin, rightr);
else if (rightr.CommandText == "?" && rightr.Value == null)
text = <API key> (bin, leftr);
else
text = "(" + leftr.CommandText + " " + GetSqlName (bin) + " " + rightr.CommandText + ")";
return new CompileResult { CommandText = text };
}
else if (expr.NodeType == ExpressionType.Not) {
var operandExpr = ((UnaryExpression)expr).Operand;
var opr = CompileExpr (operandExpr, queryArgs);
object val = opr.Value;
if (val is bool)
val = !((bool)val);
return new CompileResult {
CommandText = "NOT(" + opr.CommandText + ")",
Value = val
};
}
else if (expr.NodeType == ExpressionType.Call) {
var call = (<API key>)expr;
var args = new CompileResult[call.Arguments.Count];
var obj = call.Object != null ? CompileExpr (call.Object, queryArgs) : null;
for (var i = 0; i < args.Length; i++) {
args[i] = CompileExpr (call.Arguments[i], queryArgs);
}
var sqlCall = "";
if (call.Method.Name == "Like" && args.Length == 2) {
sqlCall = "(" + args[0].CommandText + " like " + args[1].CommandText + ")";
}
else if (call.Method.Name == "Contains" && args.Length == 2) {
sqlCall = "(" + args[1].CommandText + " in " + args[0].CommandText + ")";
}
else if (call.Method.Name == "Contains" && args.Length == 1) {
if (call.Object != null && call.Object.Type == typeof (string)) {
sqlCall = "( instr(" + obj.CommandText + "," + args[0].CommandText + ") >0 )";
}
else {
sqlCall = "(" + args[0].CommandText + " in " + obj.CommandText + ")";
}
}
else if (call.Method.Name == "StartsWith" && args.Length >= 1) {
var startsWithCmpOp = StringComparison.CurrentCulture;
if (args.Length == 2) {
startsWithCmpOp = (StringComparison)args[1].Value;
}
switch (startsWithCmpOp) {
case StringComparison.Ordinal:
case StringComparison.CurrentCulture:
sqlCall = "( substr(" + obj.CommandText + ", 1, " + args[0].Value.ToString ().Length + ") = " + args[0].CommandText + ")";
break;
case StringComparison.OrdinalIgnoreCase:
case StringComparison.<API key>:
sqlCall = "(" + obj.CommandText + " like (" + args[0].CommandText + " || '%'))";
break;
}
}
else if (call.Method.Name == "EndsWith" && args.Length >= 1) {
var endsWithCmpOp = StringComparison.CurrentCulture;
if (args.Length == 2) {
endsWithCmpOp = (StringComparison)args[1].Value;
}
switch (endsWithCmpOp) {
case StringComparison.Ordinal:
case StringComparison.CurrentCulture:
sqlCall = "( substr(" + obj.CommandText + ", length(" + obj.CommandText + ") - " + args[0].Value.ToString ().Length + "+1, " + args[0].Value.ToString ().Length + ") = " + args[0].CommandText + ")";
break;
case StringComparison.OrdinalIgnoreCase:
case StringComparison.<API key>:
sqlCall = "(" + obj.CommandText + " like ('%' || " + args[0].CommandText + "))";
break;
}
}
else if (call.Method.Name == "Equals" && args.Length == 1) {
sqlCall = "(" + obj.CommandText + " = (" + args[0].CommandText + "))";
}
else if (call.Method.Name == "ToLower") {
sqlCall = "(lower(" + obj.CommandText + "))";
}
else if (call.Method.Name == "ToUpper") {
sqlCall = "(upper(" + obj.CommandText + "))";
}
else if (call.Method.Name == "Replace" && args.Length == 2) {
sqlCall = "(replace(" + obj.CommandText + "," + args[0].CommandText + "," + args[1].CommandText + "))";
}
else if (call.Method.Name == "IsNullOrEmpty" && args.Length == 1) {
sqlCall = "(" + args[0].CommandText + " is null or" + args[0].CommandText + " ='' )";
}
else {
sqlCall = call.Method.Name.ToLower () + "(" + string.Join (",", args.Select (a => a.CommandText).ToArray ()) + ")";
}
return new CompileResult { CommandText = sqlCall };
}
else if (expr.NodeType == ExpressionType.Constant) {
var c = (ConstantExpression)expr;
queryArgs.Add (c.Value);
return new CompileResult {
CommandText = "?",
Value = c.Value
};
}
else if (expr.NodeType == ExpressionType.Convert) {
var u = (UnaryExpression)expr;
var ty = u.Type;
var valr = CompileExpr (u.Operand, queryArgs);
return new CompileResult {
CommandText = valr.CommandText,
Value = valr.Value != null ? ConvertTo (valr.Value, ty) : null
};
}
else if (expr.NodeType == ExpressionType.MemberAccess) {
var mem = (MemberExpression)expr;
var paramExpr = mem.Expression as ParameterExpression;
if (paramExpr == null) {
var convert = mem.Expression as UnaryExpression;
if (convert != null && convert.NodeType == ExpressionType.Convert) {
paramExpr = convert.Operand as ParameterExpression;
}
}
if (paramExpr != null) {
// This is a column of our table, output just the column name
// Need to translate it if that column name is mapped
var columnName = Table.<API key> (mem.Member.Name).Name;
return new CompileResult { CommandText = "\"" + columnName + "\"" };
}
else {
object obj = null;
if (mem.Expression != null) {
var r = CompileExpr (mem.Expression, queryArgs);
if (r.Value == null) {
throw new <API key> ("Member access failed to compile expression");
}
if (r.CommandText == "?") {
queryArgs.RemoveAt (queryArgs.Count - 1);
}
obj = r.Value;
}
// Get the member value
object val = null;
if (mem.Member is PropertyInfo) {
var m = (PropertyInfo)mem.Member;
val = m.GetValue (obj, null);
}
else if (mem.Member is FieldInfo) {
var m = (FieldInfo)mem.Member;
val = m.GetValue (obj);
}
else {
throw new <API key> ("MemberExpr: " + mem.Member.GetType ());
}
// Work special magic for enumerables
if (val != null && val is System.Collections.IEnumerable && !(val is string) && !(val is System.Collections.Generic.IEnumerable<byte>)) {
var sb = new System.Text.StringBuilder ();
sb.Append ("(");
var head = "";
foreach (var a in (System.Collections.IEnumerable)val) {
queryArgs.Add (a);
sb.Append (head);
sb.Append ("?");
head = ",";
}
sb.Append (")");
return new CompileResult {
CommandText = sb.ToString (),
Value = val
};
}
else {
queryArgs.Add (val);
return new CompileResult {
CommandText = "?",
Value = val
};
}
}
}
throw new <API key> ("Cannot compile: " + expr.NodeType.ToString ());
}
static object ConvertTo (object obj, Type t)
{
Type nut = Nullable.GetUnderlyingType (t);
if (nut != null) {
if (obj == null)
return null;
return Convert.ChangeType (obj, nut);
}
else {
return Convert.ChangeType (obj, t);
}
}
<summary>
Compiles a BinaryExpression where one of the parameters is null.
</summary>
<param name="expression">The expression to compile</param>
<param name="parameter">The non-null parameter</param>
private string <API key> (BinaryExpression expression, CompileResult parameter)
{
if (expression.NodeType == ExpressionType.Equal)
return "(" + parameter.CommandText + " is ?)";
else if (expression.NodeType == ExpressionType.NotEqual)
return "(" + parameter.CommandText + " is not ?)";
else if (expression.NodeType == ExpressionType.GreaterThan
|| expression.NodeType == ExpressionType.GreaterThanOrEqual
|| expression.NodeType == ExpressionType.LessThan
|| expression.NodeType == ExpressionType.LessThanOrEqual)
return "(" + parameter.CommandText + " < ?)"; // always false
else
throw new <API key> ("Cannot compile <API key> with type " + expression.NodeType.ToString ());
}
string GetSqlName (Expression expr)
{
var n = expr.NodeType;
if (n == ExpressionType.GreaterThan)
return ">";
else if (n == ExpressionType.GreaterThanOrEqual) {
return ">=";
}
else if (n == ExpressionType.LessThan) {
return "<";
}
else if (n == ExpressionType.LessThanOrEqual) {
return "<=";
}
else if (n == ExpressionType.And) {
return "&";
}
else if (n == ExpressionType.AndAlso) {
return "and";
}
else if (n == ExpressionType.Or) {
return "|";
}
else if (n == ExpressionType.OrElse) {
return "or";
}
else if (n == ExpressionType.Equal) {
return "=";
}
else if (n == ExpressionType.NotEqual) {
return "!=";
}
else {
throw new <API key> ("Cannot get SQL for: " + n);
}
}
<summary>
Execute SELECT COUNT(*) on the query
</summary>
public int Count ()
{
return GenerateCommand ("count(*)").ExecuteScalar<int> ();
}
<summary>
Execute SELECT COUNT(*) on the query with an additional WHERE clause.
</summary>
public int Count (Expression<Func<T, bool>> predExpr)
{
return Where (predExpr).Count ();
}
public IEnumerator<T> GetEnumerator ()
{
if (!_deferred)
return GenerateCommand ("*").ExecuteQuery<T> ().GetEnumerator ();
return GenerateCommand ("*").<API key><T> ().GetEnumerator ();
}
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator ()
{
return GetEnumerator ();
}
<summary>
Queries the database and returns the results as a List.
</summary>
public List<T> ToList ()
{
return GenerateCommand ("*").ExecuteQuery<T> ();
}
<summary>
Queries the database and returns the results as an array.
</summary>
public T[] ToArray ()
{
return GenerateCommand ("*").ExecuteQuery<T> ().ToArray ();
}
<summary>
Returns the first element of this query.
</summary>
public T First ()
{
var query = Take (1);
return query.ToList ().First ();
}
<summary>
Returns the first element of this query, or null if no element is found.
</summary>
public T FirstOrDefault ()
{
var query = Take (1);
return query.ToList ().FirstOrDefault ();
}
<summary>
Returns the first element of this query that matches the predicate.
</summary>
public T First (Expression<Func<T, bool>> predExpr)
{
return Where (predExpr).First ();
}
<summary>
Returns the first element of this query that matches the predicate, or null
if no element is found.
</summary>
public T FirstOrDefault (Expression<Func<T, bool>> predExpr)
{
return Where (predExpr).FirstOrDefault ();
}
}
public static class SQLite3
{
public enum Result : int
{
OK = 0,
Error = 1,
Internal = 2,
Perm = 3,
Abort = 4,
Busy = 5,
Locked = 6,
NoMem = 7,
ReadOnly = 8,
Interrupt = 9,
IOError = 10,
Corrupt = 11,
NotFound = 12,
Full = 13,
CannotOpen = 14,
LockErr = 15,
Empty = 16,
SchemaChngd = 17,
TooBig = 18,
Constraint = 19,
Mismatch = 20,
Misuse = 21,
NotImplementedLFS = 22,
AccessDenied = 23,
Format = 24,
Range = 25,
NonDBFile = 26,
Notice = 27,
Warning = 28,
Row = 100,
Done = 101
}
public enum ExtendedResult : int
{
IOErrorRead = (Result.IOError | (1 << 8)),
IOErrorShortRead = (Result.IOError | (2 << 8)),
IOErrorWrite = (Result.IOError | (3 << 8)),
IOErrorFsync = (Result.IOError | (4 << 8)),
IOErrorDirFSync = (Result.IOError | (5 << 8)),
IOErrorTruncate = (Result.IOError | (6 << 8)),
IOErrorFStat = (Result.IOError | (7 << 8)),
IOErrorUnlock = (Result.IOError | (8 << 8)),
IOErrorRdlock = (Result.IOError | (9 << 8)),
IOErrorDelete = (Result.IOError | (10 << 8)),
IOErrorBlocked = (Result.IOError | (11 << 8)),
IOErrorNoMem = (Result.IOError | (12 << 8)),
IOErrorAccess = (Result.IOError | (13 << 8)),
<API key> = (Result.IOError | (14 << 8)),
IOErrorLock = (Result.IOError | (15 << 8)),
IOErrorClose = (Result.IOError | (16 << 8)),
IOErrorDirClose = (Result.IOError | (17 << 8)),
IOErrorSHMOpen = (Result.IOError | (18 << 8)),
IOErrorSHMSize = (Result.IOError | (19 << 8)),
IOErrorSHMLock = (Result.IOError | (20 << 8)),
IOErrorSHMMap = (Result.IOError | (21 << 8)),
IOErrorSeek = (Result.IOError | (22 << 8)),
IOErrorDeleteNoEnt = (Result.IOError | (23 << 8)),
IOErrorMMap = (Result.IOError | (24 << 8)),
LockedSharedcache = (Result.Locked | (1 << 8)),
BusyRecovery = (Result.Busy | (1 << 8)),
<API key> = (Result.CannotOpen | (1 << 8)),
CannotOpenIsDir = (Result.CannotOpen | (2 << 8)),
CannotOpenFullPath = (Result.CannotOpen | (3 << 8)),
CorruptVTab = (Result.Corrupt | (1 << 8)),
ReadonlyRecovery = (Result.ReadOnly | (1 << 8)),
ReadonlyCannotLock = (Result.ReadOnly | (2 << 8)),
ReadonlyRollback = (Result.ReadOnly | (3 << 8)),
AbortRollback = (Result.Abort | (2 << 8)),
ConstraintCheck = (Result.Constraint | (1 << 8)),
<API key> = (Result.Constraint | (2 << 8)),
<API key> = (Result.Constraint | (3 << 8)),
ConstraintFunction = (Result.Constraint | (4 << 8)),
ConstraintNotNull = (Result.Constraint | (5 << 8)),
<API key> = (Result.Constraint | (6 << 8)),
ConstraintTrigger = (Result.Constraint | (7 << 8)),
ConstraintUnique = (Result.Constraint | (8 << 8)),
ConstraintVTab = (Result.Constraint | (9 << 8)),
NoticeRecoverWAL = (Result.Notice | (1 << 8)),
<API key> = (Result.Notice | (2 << 8))
}
public enum ConfigOption : int
{
SingleThread = 1,
MultiThread = 2,
Serialized = 3
}
const string LibraryPath = "sqlite3";
#if !USE_CSHARP_SQLITE && !<API key> && !USE_SQLITEPCL_RAW
[DllImport(LibraryPath, EntryPoint = "sqlite3_threadsafe", CallingConvention=CallingConvention.Cdecl)]
public static extern int Threadsafe ();
[DllImport(LibraryPath, EntryPoint = "sqlite3_open", CallingConvention=CallingConvention.Cdecl)]
public static extern Result Open ([MarshalAs(UnmanagedType.LPStr)] string filename, out IntPtr db);
[DllImport(LibraryPath, EntryPoint = "sqlite3_open_v2", CallingConvention=CallingConvention.Cdecl)]
public static extern Result Open ([MarshalAs(UnmanagedType.LPStr)] string filename, out IntPtr db, int flags, [MarshalAs (UnmanagedType.LPStr)] string zvfs);
[DllImport(LibraryPath, EntryPoint = "sqlite3_open_v2", CallingConvention = CallingConvention.Cdecl)]
public static extern Result Open(byte[] filename, out IntPtr db, int flags, [MarshalAs (UnmanagedType.LPStr)] string zvfs);
[DllImport(LibraryPath, EntryPoint = "sqlite3_open16", CallingConvention = CallingConvention.Cdecl)]
public static extern Result Open16([MarshalAs(UnmanagedType.LPWStr)] string filename, out IntPtr db);
[DllImport(LibraryPath, EntryPoint = "<API key>", CallingConvention=CallingConvention.Cdecl)]
public static extern Result EnableLoadExtension (IntPtr db, int onoff);
[DllImport(LibraryPath, EntryPoint = "sqlite3_close", CallingConvention=CallingConvention.Cdecl)]
public static extern Result Close (IntPtr db);
[DllImport(LibraryPath, EntryPoint = "sqlite3_close_v2", CallingConvention = CallingConvention.Cdecl)]
public static extern Result Close2(IntPtr db);
[DllImport(LibraryPath, EntryPoint = "sqlite3_initialize", CallingConvention=CallingConvention.Cdecl)]
public static extern Result Initialize();
[DllImport(LibraryPath, EntryPoint = "sqlite3_shutdown", CallingConvention=CallingConvention.Cdecl)]
public static extern Result Shutdown();
[DllImport(LibraryPath, EntryPoint = "sqlite3_config", CallingConvention=CallingConvention.Cdecl)]
public static extern Result Config (ConfigOption option);
[DllImport(LibraryPath, EntryPoint = "<API key>", CallingConvention=CallingConvention.Cdecl, CharSet=CharSet.Unicode)]
public static extern int SetDirectory (uint directoryType, string directoryPath);
[DllImport(LibraryPath, EntryPoint = "<API key>", CallingConvention=CallingConvention.Cdecl)]
public static extern Result BusyTimeout (IntPtr db, int milliseconds);
[DllImport(LibraryPath, EntryPoint = "sqlite3_changes", CallingConvention=CallingConvention.Cdecl)]
public static extern int Changes (IntPtr db);
[DllImport(LibraryPath, EntryPoint = "sqlite3_prepare_v2", CallingConvention=CallingConvention.Cdecl)]
public static extern Result Prepare2 (IntPtr db, [MarshalAs(UnmanagedType.LPStr)] string sql, int numBytes, out IntPtr stmt, IntPtr pzTail);
#if NETFX_CORE
[DllImport (LibraryPath, EntryPoint = "sqlite3_prepare_v2", CallingConvention = CallingConvention.Cdecl)]
public static extern Result Prepare2 (IntPtr db, byte[] queryBytes, int numBytes, out IntPtr stmt, IntPtr pzTail);
#endif
public static IntPtr Prepare2 (IntPtr db, string query)
{
IntPtr stmt;
#if NETFX_CORE
byte[] queryBytes = System.Text.UTF8Encoding.UTF8.GetBytes (query);
var r = Prepare2 (db, queryBytes, queryBytes.Length, out stmt, IntPtr.Zero);
#else
var r = Prepare2 (db, query, System.Text.UTF8Encoding.UTF8.GetByteCount (query), out stmt, IntPtr.Zero);
#endif
if (r != Result.OK) {
throw SQLiteException.New (r, GetErrmsg (db));
}
return stmt;
}
[DllImport(LibraryPath, EntryPoint = "sqlite3_step", CallingConvention=CallingConvention.Cdecl)]
public static extern Result Step (IntPtr stmt);
[DllImport(LibraryPath, EntryPoint = "sqlite3_reset", CallingConvention=CallingConvention.Cdecl)]
public static extern Result Reset (IntPtr stmt);
[DllImport(LibraryPath, EntryPoint = "sqlite3_finalize", CallingConvention=CallingConvention.Cdecl)]
public static extern Result Finalize (IntPtr stmt);
[DllImport(LibraryPath, EntryPoint = "<API key>", CallingConvention=CallingConvention.Cdecl)]
public static extern long LastInsertRowid (IntPtr db);
[DllImport(LibraryPath, EntryPoint = "sqlite3_errmsg16", CallingConvention=CallingConvention.Cdecl)]
public static extern IntPtr Errmsg (IntPtr db);
public static string GetErrmsg (IntPtr db)
{
return Marshal.PtrToStringUni (Errmsg (db));
}
[DllImport(LibraryPath, EntryPoint = "<API key>", CallingConvention=CallingConvention.Cdecl)]
public static extern int BindParameterIndex (IntPtr stmt, [MarshalAs(UnmanagedType.LPStr)] string name);
[DllImport(LibraryPath, EntryPoint = "sqlite3_bind_null", CallingConvention=CallingConvention.Cdecl)]
public static extern int BindNull (IntPtr stmt, int index);
[DllImport(LibraryPath, EntryPoint = "sqlite3_bind_int", CallingConvention=CallingConvention.Cdecl)]
public static extern int BindInt (IntPtr stmt, int index, int val);
[DllImport(LibraryPath, EntryPoint = "sqlite3_bind_int64", CallingConvention=CallingConvention.Cdecl)]
public static extern int BindInt64 (IntPtr stmt, int index, long val);
[DllImport(LibraryPath, EntryPoint = "sqlite3_bind_double", CallingConvention=CallingConvention.Cdecl)]
public static extern int BindDouble (IntPtr stmt, int index, double val);
[DllImport(LibraryPath, EntryPoint = "sqlite3_bind_text16", CallingConvention=CallingConvention.Cdecl, CharSet = CharSet.Unicode)]
public static extern int BindText (IntPtr stmt, int index, [MarshalAs(UnmanagedType.LPWStr)] string val, int n, IntPtr free);
[DllImport(LibraryPath, EntryPoint = "sqlite3_bind_blob", CallingConvention=CallingConvention.Cdecl)]
public static extern int BindBlob (IntPtr stmt, int index, byte[] val, int n, IntPtr free);
[DllImport(LibraryPath, EntryPoint = "<API key>", CallingConvention=CallingConvention.Cdecl)]
public static extern int ColumnCount (IntPtr stmt);
[DllImport(LibraryPath, EntryPoint = "sqlite3_column_name", CallingConvention=CallingConvention.Cdecl)]
public static extern IntPtr ColumnName (IntPtr stmt, int index);
[DllImport(LibraryPath, EntryPoint = "<API key>", CallingConvention=CallingConvention.Cdecl)]
static extern IntPtr <API key> (IntPtr stmt, int index);
public static string ColumnName16(IntPtr stmt, int index)
{
return Marshal.PtrToStringUni(<API key>(stmt, index));
}
[DllImport(LibraryPath, EntryPoint = "sqlite3_column_type", CallingConvention=CallingConvention.Cdecl)]
public static extern ColType ColumnType (IntPtr stmt, int index);
[DllImport(LibraryPath, EntryPoint = "sqlite3_column_int", CallingConvention=CallingConvention.Cdecl)]
public static extern int ColumnInt (IntPtr stmt, int index);
[DllImport(LibraryPath, EntryPoint = "<API key>", CallingConvention=CallingConvention.Cdecl)]
public static extern long ColumnInt64 (IntPtr stmt, int index);
[DllImport(LibraryPath, EntryPoint = "<API key>", CallingConvention=CallingConvention.Cdecl)]
public static extern double ColumnDouble (IntPtr stmt, int index);
[DllImport(LibraryPath, EntryPoint = "sqlite3_column_text", CallingConvention=CallingConvention.Cdecl)]
public static extern IntPtr ColumnText (IntPtr stmt, int index);
[DllImport(LibraryPath, EntryPoint = "<API key>", CallingConvention=CallingConvention.Cdecl)]
public static extern IntPtr ColumnText16 (IntPtr stmt, int index);
[DllImport(LibraryPath, EntryPoint = "sqlite3_column_blob", CallingConvention=CallingConvention.Cdecl)]
public static extern IntPtr ColumnBlob (IntPtr stmt, int index);
[DllImport(LibraryPath, EntryPoint = "<API key>", CallingConvention=CallingConvention.Cdecl)]
public static extern int ColumnBytes (IntPtr stmt, int index);
public static string ColumnString (IntPtr stmt, int index)
{
return Marshal.PtrToStringUni (SQLite3.ColumnText16 (stmt, index));
}
public static byte[] ColumnByteArray (IntPtr stmt, int index)
{
int length = ColumnBytes (stmt, index);
var result = new byte[length];
if (length > 0)
Marshal.Copy (ColumnBlob (stmt, index), result, 0, length);
return result;
}
[DllImport (LibraryPath, EntryPoint = "sqlite3_errcode", CallingConvention = CallingConvention.Cdecl)]
public static extern Result GetResult (<API key> db);
[DllImport (LibraryPath, EntryPoint = "<API key>", CallingConvention = CallingConvention.Cdecl)]
public static extern ExtendedResult ExtendedErrCode (IntPtr db);
[DllImport (LibraryPath, EntryPoint = "<API key>", CallingConvention = CallingConvention.Cdecl)]
public static extern int LibVersionNumber ();
[DllImport (LibraryPath, EntryPoint = "sqlite3_backup_init", CallingConvention = CallingConvention.Cdecl)]
public static extern Sqlite3BackupHandle BackupInit (<API key> destDb, [MarshalAs (UnmanagedType.LPStr)] string destName, <API key> sourceDb, [MarshalAs (UnmanagedType.LPStr)] string sourceName);
[DllImport (LibraryPath, EntryPoint = "sqlite3_backup_step", CallingConvention = CallingConvention.Cdecl)]
public static extern Result BackupStep (Sqlite3BackupHandle backup, int numPages);
[DllImport (LibraryPath, EntryPoint = "<API key>", CallingConvention = CallingConvention.Cdecl)]
public static extern Result BackupFinish (Sqlite3BackupHandle backup);
#else
public static Result Open (string filename, out <API key> db)
{
return (Result)Sqlite3.sqlite3_open (filename, out db);
}
public static Result Open (string filename, out <API key> db, int flags, string vfsName)
{
#if <API key>
return (Result)Sqlite3.sqlite3_open_v2(filename, out db, flags, vfsName ?? "");
#else
return (Result)Sqlite3.sqlite3_open_v2 (filename, out db, flags, vfsName);
#endif
}
public static Result Close (<API key> db)
{
return (Result)Sqlite3.sqlite3_close (db);
}
public static Result Close2 (<API key> db)
{
return (Result)Sqlite3.sqlite3_close_v2 (db);
}
public static Result BusyTimeout (<API key> db, int milliseconds)
{
return (Result)Sqlite3.<API key> (db, milliseconds);
}
public static int Changes (<API key> db)
{
return Sqlite3.sqlite3_changes (db);
}
public static Sqlite3Statement Prepare2 (<API key> db, string query)
{
Sqlite3Statement stmt = default (Sqlite3Statement);
#if <API key> || USE_SQLITEPCL_RAW
var r = Sqlite3.sqlite3_prepare_v2 (db, query, out stmt);
#else
stmt = new Sqlite3Statement();
var r = Sqlite3.sqlite3_prepare_v2(db, query, -1, ref stmt, 0);
#endif
if (r != 0) {
throw SQLiteException.New ((Result)r, GetErrmsg (db));
}
return stmt;
}
public static Result Step (Sqlite3Statement stmt)
{
return (Result)Sqlite3.sqlite3_step (stmt);
}
public static Result Reset (Sqlite3Statement stmt)
{
return (Result)Sqlite3.sqlite3_reset (stmt);
}
public static Result Finalize (Sqlite3Statement stmt)
{
return (Result)Sqlite3.sqlite3_finalize (stmt);
}
public static long LastInsertRowid (<API key> db)
{
return Sqlite3.<API key> (db);
}
public static string GetErrmsg (<API key> db)
{
return Sqlite3.sqlite3_errmsg (db).utf8_to_string ();
}
public static int BindParameterIndex (Sqlite3Statement stmt, string name)
{
return Sqlite3.<API key> (stmt, name);
}
public static int BindNull (Sqlite3Statement stmt, int index)
{
return Sqlite3.sqlite3_bind_null (stmt, index);
}
public static int BindInt (Sqlite3Statement stmt, int index, int val)
{
return Sqlite3.sqlite3_bind_int (stmt, index, val);
}
public static int BindInt64 (Sqlite3Statement stmt, int index, long val)
{
return Sqlite3.sqlite3_bind_int64 (stmt, index, val);
}
public static int BindDouble (Sqlite3Statement stmt, int index, double val)
{
return Sqlite3.sqlite3_bind_double (stmt, index, val);
}
public static int BindText (Sqlite3Statement stmt, int index, string val, int n, IntPtr free)
{
#if <API key>
return Sqlite3.sqlite3_bind_text(stmt, index, val, n);
#elif USE_SQLITEPCL_RAW
return Sqlite3.sqlite3_bind_text (stmt, index, val);
#else
return Sqlite3.sqlite3_bind_text(stmt, index, val, n, null);
#endif
}
public static int BindBlob (Sqlite3Statement stmt, int index, byte[] val, int n, IntPtr free)
{
#if <API key>
return Sqlite3.sqlite3_bind_blob(stmt, index, val, n);
#elif USE_SQLITEPCL_RAW
return Sqlite3.sqlite3_bind_blob (stmt, index, val);
#else
return Sqlite3.sqlite3_bind_blob(stmt, index, val, n, null);
#endif
}
public static int ColumnCount (Sqlite3Statement stmt)
{
return Sqlite3.<API key> (stmt);
}
public static string ColumnName (Sqlite3Statement stmt, int index)
{
return Sqlite3.sqlite3_column_name (stmt, index).utf8_to_string ();
}
public static string ColumnName16 (Sqlite3Statement stmt, int index)
{
return Sqlite3.sqlite3_column_name (stmt, index).utf8_to_string ();
}
public static ColType ColumnType (Sqlite3Statement stmt, int index)
{
return (ColType)Sqlite3.sqlite3_column_type (stmt, index);
}
public static int ColumnInt (Sqlite3Statement stmt, int index)
{
return Sqlite3.sqlite3_column_int (stmt, index);
}
public static long ColumnInt64 (Sqlite3Statement stmt, int index)
{
return Sqlite3.<API key> (stmt, index);
}
public static double ColumnDouble (Sqlite3Statement stmt, int index)
{
return Sqlite3.<API key> (stmt, index);
}
public static string ColumnText (Sqlite3Statement stmt, int index)
{
return Sqlite3.sqlite3_column_text (stmt, index).utf8_to_string ();
}
public static string ColumnText16 (Sqlite3Statement stmt, int index)
{
return Sqlite3.sqlite3_column_text (stmt, index).utf8_to_string ();
}
public static byte[] ColumnBlob (Sqlite3Statement stmt, int index)
{
return Sqlite3.sqlite3_column_blob (stmt, index).ToArray ();
}
public static int ColumnBytes (Sqlite3Statement stmt, int index)
{
return Sqlite3.<API key> (stmt, index);
}
public static string ColumnString (Sqlite3Statement stmt, int index)
{
return Sqlite3.sqlite3_column_text (stmt, index).utf8_to_string ();
}
public static byte[] ColumnByteArray (Sqlite3Statement stmt, int index)
{
int length = ColumnBytes (stmt, index);
if (length > 0) {
return ColumnBlob (stmt, index);
}
return new byte[0];
}
public static Result EnableLoadExtension (<API key> db, int onoff)
{
return (Result)Sqlite3.<API key> (db, onoff);
}
public static int LibVersionNumber ()
{
return Sqlite3.<API key> ();
}
public static Result GetResult (<API key> db)
{
return (Result)Sqlite3.sqlite3_errcode (db);
}
public static ExtendedResult ExtendedErrCode (<API key> db)
{
return (ExtendedResult)Sqlite3.<API key> (db);
}
public static Sqlite3BackupHandle BackupInit (<API key> destDb, string destName, <API key> sourceDb, string sourceName)
{
return Sqlite3.sqlite3_backup_init (destDb, destName, sourceDb, sourceName);
}
public static Result BackupStep (Sqlite3BackupHandle backup, int numPages)
{
return (Result)Sqlite3.sqlite3_backup_step (backup, numPages);
}
public static Result BackupFinish (Sqlite3BackupHandle backup)
{
return (Result)Sqlite3.<API key> (backup);
}
#endif
public enum ColType : int
{
Integer = 1,
Float = 2,
Text = 3,
Blob = 4,
Null = 5
}
}
}
|
<?xml version="1.0" ?><!DOCTYPE TS><TS language="nl" version="2.1">
<context>
<name>AboutDialog</name>
<message>
<location filename="../forms/aboutdialog.ui" line="+14"/>
<source>About IadixCoin</source>
<translation>Over IadixCoin</translation>
</message>
<message>
<location line="+39"/>
<source><b>IadixCoin</b> version</source>
<translation><b>IadixCoin</b> versie</translation>
</message>
<message>
<location line="+41"/>
<source>Copyright © 2009-2014 The Bitcoin developers
Copyright © 2012-2014 The NovaCoin developers
Copyright © 2014 The IadixCoin developers</source>
<translation>Copyright © 2009-2014 De Bitcoin ontwikkelaars
Copyright © 2012-2014 De NovaCoin ontwikkelaars
Copyright © 2014 De IadixCoin ontwikkelaars</translation>
</message>
<message>
<location line="+15"/>
<source>
This is experimental software.
Distributed under the MIT/X11 software license, see the accompanying file COPYING or <a href="http:
This product includes software developed by the OpenSSL Project for use in the OpenSSL Toolkit (<a href="https:
<translation type="unfinished"/>
</message>
</context>
<context>
<name>AddressBookPage</name>
<message>
<location filename="../forms/addressbookpage.ui" line="+14"/>
<source>Address Book</source>
<translation>Adresboek</translation>
</message>
<message>
<location line="+22"/>
<source>Double-click to edit address or label</source>
<translation>Dubbelklik om het adres of label te wijzigen</translation>
</message>
<message>
<location line="+24"/>
<source>Create a new address</source>
<translation>Maak een nieuw adres aan</translation>
</message>
<message>
<location line="+10"/>
<source>Copy the currently selected address to the system clipboard</source>
<translation>Kopieer het huidig geselecteerde adres naar het klembord</translation>
</message>
<message>
<location line="-7"/>
<source>&New Address</source>
<translation>&Nieuw adres</translation>
</message>
<message>
<location line="-43"/>
<source>These are your IadixCoin addresses for receiving payments. You may want to give a different one to each sender so you can keep track of who is paying you.</source>
<translation>Dit zijn al jou IadixCoin adressen om betalingen mee te ontvangen. Je kunt iedere verzender een apart adres geven zodat je kunt volgen wie jou betaald.</translation>
</message>
<message>
<location line="+53"/>
<source>&Copy Address</source>
<translation>&Kopiëer Adres</translation>
</message>
<message>
<location line="+7"/>
<source>Show &QR Code</source>
<translation>Toon &QR Code</translation>
</message>
<message>
<location line="+7"/>
<source>Sign a message to prove you own a IadixCoin address</source>
<translation>Teken een bericht om te bewijzen dat je een IadixCoin adres bezit.</translation>
</message>
<message>
<location line="+3"/>
<source>Sign &Message</source>
<translation>Teken &Bericht</translation>
</message>
<message>
<location line="+17"/>
<source>Delete the currently selected address from the list</source>
<translation>Verwijder het geselecteerde adres van de lijst</translation>
</message>
<message>
<location line="-10"/>
<source>Verify a message to ensure it was signed with a specified IadixCoin address</source>
<translation>Verifieer een bericht om zeker te zijn dat deze is ondertekend met een specifiek IadixCoin adres</translation>
</message>
<message>
<location line="+3"/>
<source>&Verify Message</source>
<translation>&Verifieer Bericht</translation>
</message>
<message>
<location line="+10"/>
<source>&Delete</source>
<translation>&Verwijder</translation>
</message>
<message>
<location filename="../addressbookpage.cpp" line="+66"/>
<source>Copy &Label</source>
<translation>Kopiëer &Label</translation>
</message>
<message>
<location line="+1"/>
<source>&Edit</source>
<translation>&Bewerk</translation>
</message>
<message>
<location line="+248"/>
<source>Export Address Book Data</source>
<translation>Exporteer Adresboek Data</translation>
</message>
<message>
<location line="+1"/>
<source>Comma separated file (*.csv)</source>
<translation>Kommagescheiden bestand (*.csv)</translation>
</message>
<message>
<location line="+13"/>
<source>Error exporting</source>
<translation>Fout bij exporteren</translation>
</message>
<message>
<location line="+0"/>
<source>Could not write to file %1.</source>
<translation>Kan niet schrijven naat bestand %1</translation>
</message>
</context>
<context>
<name>AddressTableModel</name>
<message>
<location filename="../addresstablemodel.cpp" line="+145"/>
<source>Label</source>
<translation>Label</translation>
</message>
<message>
<location line="+0"/>
<source>Address</source>
<translation>Adres</translation>
</message>
<message>
<location line="+36"/>
<source>(no label)</source>
<translation>(geen label)</translation>
</message>
</context>
<context>
<name>AskPassphraseDialog</name>
<message>
<location filename="../forms/askpassphrasedialog.ui" line="+26"/>
<source>Passphrase Dialog</source>
<translation>Wachtwoordscherm</translation>
</message>
<message>
<location line="+21"/>
<source>Enter passphrase</source>
<translation>Voer wachtwoord in</translation>
</message>
<message>
<location line="+14"/>
<source>New passphrase</source>
<translation>Nieuw wachtwoord</translation>
</message>
<message>
<location line="+14"/>
<source>Repeat new passphrase</source>
<translation>Herhaal wachtwoord</translation>
</message>
<message>
<location line="+33"/>
<source>Serves to disable the trivial sendmoney when OS account compromised. Provides no real security.</source>
<translation>Bedoeld om het command 'sendmoney' uit te schakelen indien het OS niet meer veilig is. Geeft geen echte beveiliging.</translation>
</message>
<message>
<location line="+3"/>
<source>For staking only</source>
<translation>Alleen voor staking</translation>
</message>
<message>
<location filename="../askpassphrasedialog.cpp" line="+38"/>
<source>Encrypt wallet</source>
<translation>Versleutel portemonnee</translation>
</message>
<message>
<location line="+7"/>
<source>This operation needs your wallet passphrase to unlock the wallet.</source>
<translation>Deze operatie vereist uw <API key> om de portemonnee te openen.</translation>
</message>
<message>
<location line="+5"/>
<source>Unlock wallet</source>
<translation>Open portemonnee</translation>
</message>
<message>
<location line="+3"/>
<source>This operation needs your wallet passphrase to decrypt the wallet.</source>
<translation>Deze operatie vereist uw <API key> om de portemonnee te ontsleutelen</translation>
</message>
<message>
<location line="+5"/>
<source>Decrypt wallet</source>
<translation>Ontsleutel portemonnee</translation>
</message>
<message>
<location line="+3"/>
<source>Change passphrase</source>
<translation>Wijzig wachtwoord</translation>
</message>
<message>
<location line="+1"/>
<source>Enter the old and new passphrase to the wallet.</source>
<translation>Vul uw oude en nieuwe <API key> in.</translation>
</message>
<message>
<location line="+45"/>
<source>Confirm wallet encryption</source>
<translation>Bevestig versleuteling van de portemonnee</translation>
</message>
<message>
<location line="+1"/>
<source>Warning: If you encrypt your wallet and lose your passphrase, you will <b>LOSE ALL OF YOUR COINS</b>!</source>
<translation>Waarschuwing: Als je je portemonnee versleuteld en je verliest je wachtwoord zul je <b>AL JE MUNTEN VERLIEZEN</b>!</translation>
</message>
<message>
<location line="+0"/>
<source>Are you sure you wish to encrypt your wallet?</source>
<translation>Weet u zeker dat u uw portemonnee wilt versleutelen?</translation>
</message>
<message>
<location line="+15"/>
<source>IMPORTANT: Any previous backups you have made of your wallet file should be replaced with the newly generated, encrypted wallet file. For security reasons, previous backups of the unencrypted wallet file will become useless as soon as you start using the new, encrypted wallet.</source>
<translation>BELANGRIJK: Elke eerder gemaakte backup van uw portemonneebestand dient u te vervangen door het nieuw gegenereerde, versleutelde portemonneebestand. Om veiligheidsredenen zullen eerdere backups van het niet-versleutelde portemonneebestand onbruikbaar worden zodra u uw nieuwe, versleutelde, portemonnee begint te gebruiken.</translation>
</message>
<message>
<location line="+103"/>
<location line="+24"/>
<source>Warning: The Caps Lock key is on!</source>
<translation>Waarschuwing: De Caps-Lock-toets staat aan!</translation>
</message>
<message>
<location line="-133"/>
<location line="+60"/>
<source>Wallet encrypted</source>
<translation>Portemonnee versleuteld</translation>
</message>
<message>
<location line="-140"/>
<source>Enter the new passphrase to the wallet.<br/>Please use a passphrase of <b>ten or more random characters</b>, or <b>eight or more words</b>.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+82"/>
<source>IadixCoin will close now to finish the encryption process. Remember that encrypting your wallet cannot fully protect your coins from being stolen by malware infecting your computer.</source>
<translation>IadixCoin zal nu sluiten om het versleutel proces te voltooien. Onthou dat het versleutelen van je portemonnee je niet volledig beschermt tegen diefstal van munten door malware op je computer.</translation>
</message>
<message>
<location line="+13"/>
<location line="+7"/>
<location line="+44"/>
<location line="+6"/>
<source>Wallet encryption failed</source>
<translation><API key> mislukt</translation>
</message>
<message>
<location line="-56"/>
<source>Wallet encryption failed due to an internal error. Your wallet was not encrypted.</source>
<translation><API key> mislukt door een interne fout. Uw portemonnee is niet versleuteld.</translation>
</message>
<message>
<location line="+7"/>
<location line="+50"/>
<source>The supplied passphrases do not match.</source>
<translation>De opgegeven wachtwoorden komen niet overeen</translation>
</message>
<message>
<location line="-38"/>
<source>Wallet unlock failed</source>
<translation>Portemonnee openen mislukt</translation>
</message>
<message>
<location line="+1"/>
<location line="+12"/>
<location line="+19"/>
<source>The passphrase entered for the wallet decryption was incorrect.</source>
<translation>Het opgegeven wachtwoord voor de <API key> is niet correct.</translation>
</message>
<message>
<location line="-20"/>
<source>Wallet decryption failed</source>
<translation><API key> mislukt</translation>
</message>
<message>
<location line="+14"/>
<source>Wallet passphrase was successfully changed.</source>
<translation><API key> is met succes gewijzigd.</translation>
</message>
</context>
<context>
<name>BitcoinGUI</name>
<message>
<location filename="../bitcoingui.cpp" line="+297"/>
<source>Sign &message...</source>
<translation>&Onderteken bericht...</translation>
</message>
<message>
<location line="-64"/>
<source>Show general overview of wallet</source>
<translation>Toon algemeen overzicht van de portemonnee</translation>
</message>
<message>
<location line="+17"/>
<source>&Transactions</source>
<translation>&Transacties</translation>
</message>
<message>
<location line="+1"/>
<source>Browse transaction history</source>
<translation>Blader door transactieverleden</translation>
</message>
<message>
<location line="+5"/>
<source>&Address Book</source>
<translation>&Adresboek</translation>
</message>
<message>
<location line="+1"/>
<source>Edit the list of stored addresses and labels</source>
<translation>Wijzig de lijst met bewaarde adressen en labels</translation>
</message>
<message>
<location line="-18"/>
<source>Show the list of addresses for receiving payments</source>
<translation>Toon de lijst aan adressen voor ontvangen betalingen</translation>
</message>
<message>
<location line="+34"/>
<source>E&xit</source>
<translation>&Afsluiten</translation>
</message>
<message>
<location line="+1"/>
<source>Quit application</source>
<translation>Programma afsluiten</translation>
</message>
<message>
<location line="+4"/>
<source>Show information about IadixCoin</source>
<translation>Toon informatie over IadixCoin</translation>
</message>
<message>
<location line="+2"/>
<source>About &Qt</source>
<translation>Over &Qt</translation>
</message>
<message>
<location line="+1"/>
<source>Show information about Qt</source>
<translation>Toon informatie over Qt</translation>
</message>
<message>
<location line="+2"/>
<source>&Options...</source>
<translation>&Opties...</translation>
</message>
<message>
<location line="+4"/>
<source>&Encrypt Wallet...</source>
<translation>&Versleutel Portemonnee...</translation>
</message>
<message>
<location line="+2"/>
<source>&Backup Wallet...</source>
<translation>&Backup Portemonnee...</translation>
</message>
<message>
<location line="+2"/>
<source>&Change Passphrase...</source>
<translation>&Wijzig Wachtwoord</translation>
</message>
<message>
<location line="+9"/>
<source>&Export...</source>
<translation>&Exporteren...</translation>
</message>
<message>
<location line="-55"/>
<source>Send coins to a IadixCoin address</source>
<translation>Verstuur munten naar een IadixCoin adres</translation>
</message>
<message>
<location line="+39"/>
<source>Modify configuration options for IadixCoin</source>
<translation>Verander configuratie opties voor IadixCoin</translation>
</message>
<message>
<location line="+17"/>
<source>Export the data in the current tab to a file</source>
<translation>Exporteer de data in de huidige tab naar een bestand</translation>
</message>
<message>
<location line="-13"/>
<source>Encrypt or decrypt wallet</source>
<translation>Versleutel of ontsleutel de portemonnee</translation>
</message>
<message>
<location line="+2"/>
<source>Backup wallet to another location</source>
<translation>Backup portemonnee naar een andere locatie</translation>
</message>
<message>
<location line="+2"/>
<source>Change the passphrase used for wallet encryption</source>
<translation>Wijzig het wachtwoord voor uw <API key></translation>
</message>
<message>
<location line="+10"/>
<source>&Debug window</source>
<translation>&Debugscherm</translation>
</message>
<message>
<location line="+1"/>
<source>Open debugging and diagnostic console</source>
<translation>Open debugging en diagnostische console</translation>
</message>
<message>
<location line="-5"/>
<source>&Verify message...</source>
<translation>&Verifiëer bericht...</translation>
</message>
<message>
<location line="-214"/>
<location line="+555"/>
<source>IadixCoin</source>
<translation>IadixCoin</translation>
</message>
<message>
<location line="-555"/>
<source>Wallet</source>
<translation>Portemonnee</translation>
</message>
<message>
<location line="+193"/>
<source>&About IadixCoin</source>
<translation>&Over IadixCoin</translation>
</message>
<message>
<location line="+9"/>
<source>&Show / Hide</source>
<translation>&Toon / Verberg</translation>
</message>
<message>
<location line="+8"/>
<source>Unlock wallet</source>
<translation>Open portemonnee</translation>
</message>
<message>
<location line="+1"/>
<source>&Lock Wallet</source>
<translation>&Sluit portemonnee</translation>
</message>
<message>
<location line="+1"/>
<source>Lock wallet</source>
<translation>Sluit portemonnee</translation>
</message>
<message>
<location line="+32"/>
<source>&File</source>
<translation>&Bestand</translation>
</message>
<message>
<location line="+8"/>
<source>&Settings</source>
<translation>&Instellingen</translation>
</message>
<message>
<location line="+8"/>
<source>&Help</source>
<translation>&Hulp</translation>
</message>
<message>
<location line="+17"/>
<source>Tabs toolbar</source>
<translation>Tab-werkbalk</translation>
</message>
<message>
<location line="+46"/>
<location line="+9"/>
<source>[testnet]</source>
<translation>[testnetwerk]</translation>
</message>
<message>
<location line="+0"/>
<location line="+58"/>
<source>IadixCoin client</source>
<translation>IadixCoin client</translation>
</message>
<message numerus="yes">
<location line="+70"/>
<source>%n active connection(s) to IadixCoin network</source>
<translation><numerusform>%n actieve verbinding naar IadixCoin netwerk</numerusform><numerusform>%n actieve verbindingen naar IadixCoin netwerk</numerusform></translation>
</message>
<message>
<location line="+488"/>
<source>Staking.<br>Your weight is %1<br>Network weight is %2<br>Expected time to earn reward is %3</source>
<translation>Staking. <br> Uw gewicht wordt %1 <br> Network gewicht is %2 <br> Verwachte tijd om beloning te verdienen is %3</translation>
</message>
<message>
<location line="+6"/>
<source>Not staking because wallet is locked</source>
<translation>Niet staking omdat portemonnee beveiligd is</translation>
</message>
<message>
<location line="+2"/>
<source>Not staking because wallet is offline</source>
<translation>Niet staking omdat portemonnee offline is</translation>
</message>
<message>
<location line="+2"/>
<source>Not staking because wallet is syncing</source>
<translation>Niet staking omdat portemonnee aan het synchroniseren is.</translation>
</message>
<message>
<location line="+2"/>
<source>Not staking because you don't have mature coins</source>
<translation>Niet staking omdat je geen mature munten hebt</translation>
</message>
<message>
<location line="-812"/>
<source>&Dashboard</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+6"/>
<source>&Receive</source>
<translation>&Ontvangen</translation>
</message>
<message>
<location line="+6"/>
<source>&Send</source>
<translation>&Verzenden</translation>
</message>
<message>
<location line="+49"/>
<source>&Unlock Wallet...</source>
<translation>Ontgrendel portemonnee...</translation>
</message>
<message>
<location line="+277"/>
<source>Up to date</source>
<translation>Bijgewerkt</translation>
</message>
<message>
<location line="+43"/>
<source>Catching up...</source>
<translation>Aan het bijwerken...</translation>
</message>
<message>
<location line="+113"/>
<source>Confirm transaction fee</source>
<translation>Bevestig transactie kosten</translation>
</message>
<message>
<location line="+27"/>
<source>Sent transaction</source>
<translation>Verzonden transactie</translation>
</message>
<message>
<location line="+1"/>
<source>Incoming transaction</source>
<translation>Binnenkomende transactie</translation>
</message>
<message>
<location line="+1"/>
<source>Date: %1
Amount: %2
Type: %3
Address: %4
</source>
<translation>Datum: %1
Bedrag: %2
Type: %3
Adres: %4
</translation>
</message>
<message>
<location line="+100"/>
<location line="+15"/>
<source>URI handling</source>
<translation>URI-behandeling</translation>
</message>
<message>
<location line="-15"/>
<location line="+15"/>
<source>URI can not be parsed! This can be caused by an invalid IadixCoin address or malformed URI parameters.</source>
<translation>URI kan niet ontleedt worden! Mogelijke oorzaken zijn een ongeldig IadixCoin adres of incorrecte URI parameters.</translation>
</message>
<message>
<location line="+9"/>
<source>Wallet is <b>not encrypted</b></source>
<translation type="unfinished"/>
</message>
<message>
<location line="+8"/>
<source>Wallet is <b>encrypted</b> and currently <b>unlocked</b></source>
<translation>Portemonnee is <b>versleuteld</b> en momenteel <b>geopend</b></translation>
</message>
<message>
<location line="+8"/>
<source>Wallet is <b>encrypted</b> and currently <b>locked</b></source>
<translation>Portemonnee is <b>versleuteld</b> en momenteel <b>gesloten</b></translation>
</message>
<message>
<location line="+24"/>
<source>Backup Wallet</source>
<translation>Backup Portemonnee</translation>
</message>
<message>
<location line="+0"/>
<source>Wallet Data (*.dat)</source>
<translation>Portemonnee bestanden (*.dat)</translation>
</message>
<message>
<location line="+3"/>
<source>Backup Failed</source>
<translation>Backup mislukt</translation>
</message>
<message>
<location line="+0"/>
<source>There was an error trying to save the wallet data to the new location.</source>
<translation>Er was een fout opgetreden bij het opslaan van de wallet data naar de nieuwe locatie.</translation>
</message>
<message numerus="yes">
<location line="+91"/>
<source>%n second(s)</source>
<translation><numerusform>%n seconden</numerusform><numerusform>%n seconden</numerusform></translation>
</message>
<message numerus="yes">
<location line="+4"/>
<source>%n minute(s)</source>
<translation><numerusform>%n minuut</numerusform><numerusform>%n minuten</numerusform></translation>
</message>
<message numerus="yes">
<location line="-429"/>
<location line="+433"/>
<source>%n hour(s)</source>
<translation><numerusform>%n uur</numerusform><numerusform>%n uur</numerusform></translation>
</message>
<message>
<location line="-456"/>
<source>Processed %1 blocks of transaction history.</source>
<translation type="unfinished"/>
</message>
<message numerus="yes">
<location line="+27"/>
<location line="+433"/>
<source>%n day(s)</source>
<translation><numerusform>%n dag</numerusform><numerusform>%n dagen</numerusform></translation>
</message>
<message numerus="yes">
<location line="-429"/>
<location line="+6"/>
<source>%n week(s)</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation>
</message>
<message>
<location line="+0"/>
<source>%1 and %2</source>
<translation type="unfinished"/>
</message>
<message numerus="yes">
<location line="+0"/>
<source>%n year(s)</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation>
</message>
<message>
<location line="+5"/>
<source>%1 behind</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+15"/>
<source>Last received block was generated %1 ago.</source>
<translation>Laatst ontvangen block was %1 geleden</translation>
</message>
<message>
<location line="+2"/>
<source>Transactions after this will not yet be visible.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+23"/>
<source>Error</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Warning</source>
<translation>Waarschuwing</translation>
</message>
<message>
<location line="+3"/>
<source>Information</source>
<translation>Informatie</translation>
</message>
<message>
<location line="+69"/>
<source>This transaction is over the size limit. You can still send it for a fee of %1, which goes to the nodes that process your transaction and helps to support the network. Do you want to pay the fee?</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+324"/>
<source>Not staking</source>
<translation>Niet aan het staken.</translation>
</message>
<message>
<location filename="../bitcoin.cpp" line="+104"/>
<source>A fatal error occurred. IadixCoin can no longer continue safely and will quit.</source>
<translation>Een fatale fout . Iadixcoin kan niet langer veilig doorgaan en sluit af.</translation>
</message>
</context>
<context>
<name>ClientModel</name>
<message>
<location filename="../clientmodel.cpp" line="+110"/>
<source>Network Alert</source>
<translation>Netwerkwaarschuwing</translation>
</message>
</context>
<context>
<name>CoinControlDialog</name>
<message>
<location filename="../forms/coincontroldialog.ui" line="+14"/>
<source>Coin Control</source>
<translation>Coin controle opties</translation>
</message>
<message>
<location line="+31"/>
<source>Quantity:</source>
<translation>Kwantiteit</translation>
</message>
<message>
<location line="+32"/>
<source>Bytes:</source>
<translation>Bytes:</translation>
</message>
<message>
<location line="+48"/>
<source>Amount:</source>
<translation>Bedrag:</translation>
</message>
<message>
<location line="+32"/>
<source>Priority:</source>
<translation>Prioriteit:</translation>
</message>
<message>
<location line="+48"/>
<source>Fee:</source>
<translation>Vergoeding:</translation>
</message>
<message>
<location line="+35"/>
<source>Low Output:</source>
<translation>Lage uitvoer:</translation>
</message>
<message>
<location filename="../coincontroldialog.cpp" line="+537"/>
<source>no</source>
<translation>nee</translation>
</message>
<message>
<location filename="../forms/coincontroldialog.ui" line="+51"/>
<source>After Fee:</source>
<translation>Na vergoeding:</translation>
</message>
<message>
<location line="+35"/>
<source>Change:</source>
<translation>Wijzigen:</translation>
</message>
<message>
<location line="+69"/>
<source>(un)select all</source>
<translation>(de)selecteer alles</translation>
</message>
<message>
<location line="+13"/>
<source>Tree mode</source>
<translation>Boom modus</translation>
</message>
<message>
<location line="+16"/>
<source>List mode</source>
<translation>Lijst modus</translation>
</message>
<message>
<location line="+45"/>
<source>Amount</source>
<translation>Bedrag</translation>
</message>
<message>
<location line="+5"/>
<source>Label</source>
<translation>Label</translation>
</message>
<message>
<location line="+5"/>
<source>Address</source>
<translation>Adres</translation>
</message>
<message>
<location line="+5"/>
<source>Date</source>
<translation>Datum</translation>
</message>
<message>
<location line="+5"/>
<source>Confirmations</source>
<translation>Bevestigingen</translation>
</message>
<message>
<location line="+3"/>
<source>Confirmed</source>
<translation>Bevestigd</translation>
</message>
<message>
<location line="+5"/>
<source>Priority</source>
<translation>Prioriteit</translation>
</message>
<message>
<location filename="../coincontroldialog.cpp" line="-500"/>
<source>Copy address</source>
<translation>Kopieer adres</translation>
</message>
<message>
<location line="+1"/>
<source>Copy label</source>
<translation>Kopieer label</translation>
</message>
<message>
<location line="+1"/>
<location line="+26"/>
<source>Copy amount</source>
<translation>Kopieer bedrag</translation>
</message>
<message>
<location line="-25"/>
<source>Copy transaction ID</source>
<translation>Kopieer transactie-ID</translation>
</message>
<message>
<location line="+24"/>
<source>Copy quantity</source>
<translation>Kopieer aantal</translation>
</message>
<message>
<location line="+2"/>
<source>Copy fee</source>
<translation>Kopieer vergoeding</translation>
</message>
<message>
<location line="+1"/>
<source>Copy after fee</source>
<translation>Kopieer na vergoeding</translation>
</message>
<message>
<location line="+1"/>
<source>Copy bytes</source>
<translation>Kopieer bytes</translation>
</message>
<message>
<location line="+1"/>
<source>Copy priority</source>
<translation>Kopieer prioriteit</translation>
</message>
<message>
<location line="+1"/>
<source>Copy low output</source>
<translation>Kopieer lage uitvoer</translation>
</message>
<message>
<location line="+1"/>
<source>Copy change</source>
<translation>Kopieer wijzig</translation>
</message>
<message>
<location line="+317"/>
<source>highest</source>
<translation>hoogste</translation>
</message>
<message>
<location line="+1"/>
<source>high</source>
<translation>hoog</translation>
</message>
<message>
<location line="+1"/>
<source>medium-high</source>
<translation>gemiddeld hoog</translation>
</message>
<message>
<location line="+1"/>
<source>medium</source>
<translation>gemiddeld</translation>
</message>
<message>
<location line="+4"/>
<source>low-medium</source>
<translation>laag gemiddeld</translation>
</message>
<message>
<location line="+1"/>
<source>low</source>
<translation>laag</translation>
</message>
<message>
<location line="+1"/>
<source>lowest</source>
<translation>laagste</translation>
</message>
<message>
<location line="+140"/>
<source>DUST</source>
<translation>STOF</translation>
</message>
<message>
<location line="+0"/>
<source>yes</source>
<translation>ja</translation>
</message>
<message>
<location line="+10"/>
<source>This label turns red, if the transaction size is bigger than 10000 bytes.
This means a fee of at least %1 per kb is required.
Can vary +/- 1 Byte per input.</source>
<translation>Dit label wordt rood, als de transactie grootte groter is dan 10000 bytes.<br>
Dit betekend een fee van minimaal %1 per kb is noodzakelijk.<br>
Kan varieren van +/- 1 Byte per invulling</translation>
</message>
<message>
<location line="+1"/>
<source>Transactions with higher priority get more likely into a block.
This label turns red, if the priority is smaller than "medium".
This means a fee of at least %1 per kb is required.</source>
<translation>Transacties met hogere prioriteit komen sneller in een blok
Dit label wordt rood, als de prioriteit kleiner is dan "normaal".
Dit betekend een fee van minimaal %1 per kb is noodzakelijk.</translation>
</message>
<message>
<location line="+1"/>
<source>This label turns red, if any recipient receives an amount smaller than %1.
This means a fee of at least %2 is required.
Amounts below 0.546 times the minimum relay fee are shown as DUST.</source>
<translation>Dit label wordt rood, als elke ontvanger ontvangt een bedrag dat kleiner is dan 1%.
Dit betekent dat een vergoeding van ten minste 2% is vereist.
Bedragen onder 0.546 keer het minimum vergoeding worden weergegeven als DUST.</translation>
</message>
<message>
<location line="+1"/>
<source>This label turns red, if the change is smaller than %1.
This means a fee of at least %2 is required.</source>
<translation>Dit label wordt rood, als de verandering kleiner is dan %1.
Dit betekend dat een fee van %2 is vereist.</translation>
</message>
<message>
<location line="+36"/>
<location line="+66"/>
<source>(no label)</source>
<translation>(geen label)</translation>
</message>
<message>
<location line="-9"/>
<source>change from %1 (%2)</source>
<translation>wijzig van %1 (%2)</translation>
</message>
<message>
<location line="+1"/>
<source>(change)</source>
<translation>(wijzig)</translation>
</message>
</context>
<context>
<name>EditAddressDialog</name>
<message>
<location filename="../forms/editaddressdialog.ui" line="+14"/>
<source>Edit Address</source>
<translation>Bewerk Adres</translation>
</message>
<message>
<location line="+11"/>
<source>&Label</source>
<translation>&Label</translation>
</message>
<message>
<location line="+10"/>
<source>The label associated with this address book entry</source>
<translation>Het label geassocieerd met deze notitie in het adresboek</translation>
</message>
<message>
<location line="+7"/>
<source>&Address</source>
<translation>&Adres</translation>
</message>
<message>
<location line="+10"/>
<source>The address associated with this address book entry. This can only be modified for sending addresses.</source>
<translation>Het adres geassocieerd met deze notitie in het adresboek. Dit kan enkel aangepast worden bij verzend-adressen.</translation>
</message>
<message>
<location filename="../editaddressdialog.cpp" line="+21"/>
<source>New receiving address</source>
<translation>Nieuw ontvangstadres</translation>
</message>
<message>
<location line="+4"/>
<source>New sending address</source>
<translation>Nieuw adres om naar te verzenden</translation>
</message>
<message>
<location line="+3"/>
<source>Edit receiving address</source>
<translation>Bewerk ontvangstadres</translation>
</message>
<message>
<location line="+4"/>
<source>Edit sending address</source>
<translation>Bewerk adres om naar te verzenden</translation>
</message>
<message>
<location line="+76"/>
<source>The entered address "%1" is already in the address book.</source>
<translation>Het opgegeven adres "%1" bestaat al in uw adresboek.</translation>
</message>
<message>
<location line="-5"/>
<source>The entered address "%1" is not a valid IadixCoin address.</source>
<translation>Het ingevoerde adres "%1" is geen geldig Iadixcoin adres.</translation>
</message>
<message>
<location line="+10"/>
<source>Could not unlock wallet.</source>
<translation>Kon de portemonnee niet openen.</translation>
</message>
<message>
<location line="+5"/>
<source>New key generation failed.</source>
<translation>Genereren nieuwe sleutel mislukt.</translation>
</message>
</context>
<context>
<name>GUIUtil::HelpMessageBox</name>
<message>
<location filename="../guiutil.cpp" line="+426"/>
<location line="+12"/>
<source>IadixCoin-Qt</source>
<translation>IadixCoin-Qt</translation>
</message>
<message>
<location line="-12"/>
<source>version</source>
<translation>versie</translation>
</message>
<message>
<location line="+2"/>
<source>Usage:</source>
<translation>Gebruik:</translation>
</message>
<message>
<location line="+1"/>
<source>command-line options</source>
<translation><API key></translation>
</message>
<message>
<location line="+4"/>
<source>UI options</source>
<translation><API key></translation>
</message>
<message>
<location line="+1"/>
<source>Set language, for example "de_DE" (default: system locale)</source>
<translation>Stel taal in, bijvoorbeeld "de_DE" (standaard: systeeminstellingen)</translation>
</message>
<message>
<location line="+1"/>
<source>Start minimized</source>
<translation>Geminimaliseerd starten</translation>
</message>
<message>
<location line="+1"/>
<source>Show splash screen on startup (default: 1)</source>
<translation>Laat laadscherm zien bij het opstarten. (standaard: 1)</translation>
</message>
</context>
<context>
<name>OptionsDialog</name>
<message>
<location filename="../forms/optionsdialog.ui" line="+14"/>
<source>Options</source>
<translation>Opties</translation>
</message>
<message>
<location line="+16"/>
<source>&Main</source>
<translation>&Algemeen</translation>
</message>
<message>
<location line="+6"/>
<source>Optional transaction fee per kB that helps make sure your transactions are processed quickly. Most transactions are 1 kB. Fee 0.01 recommended.</source>
<translation>Optioneel transactiekosten per kB dat helpt ervoor zorgen dat uw transacties worden snel verwerkt. De meeste transacties zijn 1 kB. Fee 0.01 aanbevolen.</translation>
</message>
<message>
<location line="+15"/>
<source>Pay transaction &fee</source>
<translation>Betaal &transactiekosten</translation>
</message>
<message>
<location line="+31"/>
<source>Reserved amount does not participate in staking and is therefore spendable at any time.</source>
<translation>Gereserveerde hoeveelheid doet niet mee in staking en is daarom altijd uitgeefbaar.</translation>
</message>
<message>
<location line="+15"/>
<source>Reserve</source>
<translation>Gereserveerd</translation>
</message>
<message>
<location line="+31"/>
<source>Automatically start IadixCoin after logging in to the system.</source>
<translation>Automatisch starten van Iadixcoin na inloggen van het systeem.</translation>
</message>
<message>
<location line="+3"/>
<source>&Start IadixCoin on system login</source>
<translation>&Start Iadixcoin bij systeem aanmelding</translation>
</message>
<message>
<location line="+21"/>
<source>&Network</source>
<translation>&Netwerk</translation>
</message>
<message>
<location line="+6"/>
<source>Automatically open the IadixCoin client port on the router. This only works when your router supports UPnP and it is enabled.</source>
<translation>De IadixCoin client poort automatisch openen op de router. Dit werkt alleen wanneer uw router UPnP ondersteunt en deze is ingeschakeld.</translation>
</message>
<message>
<location line="+3"/>
<source>Map port using &UPnP</source>
<translation>Portmapping via &UPnP</translation>
</message>
<message>
<location line="+19"/>
<source>Proxy &IP:</source>
<translation>Proxy &IP:</translation>
</message>
<message>
<location line="+19"/>
<source>IP address of the proxy (e.g. 127.0.0.1)</source>
<translation>IP Adres van de proxy (bijv. 127.0.0.1)</translation>
</message>
<message>
<location line="+7"/>
<source>&Port:</source>
<translation>&Poort:</translation>
</message>
<message>
<location line="+19"/>
<source>Port of the proxy (e.g. 9050)</source>
<translation>Poort van de proxy (bijv. 9050)</translation>
</message>
<message>
<location line="-57"/>
<source>Connect to the IadixCoin network through a SOCKS5 proxy (e.g. when connecting through Tor).</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>&Connect through SOCKS5 proxy:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+90"/>
<source>&Window</source>
<translation>&Scherm</translation>
</message>
<message>
<location line="+6"/>
<source>Show only a tray icon after minimizing the window.</source>
<translation>Laat alleen een systeemvak-icoon zien wanneer het venster geminimaliseerd is</translation>
</message>
<message>
<location line="+3"/>
<source>&Minimize to the tray instead of the taskbar</source>
<translation>&Minimaliseer naar het systeemvak in plaats van de taakbalk</translation>
</message>
<message>
<location line="+7"/>
<source>Minimize instead of exit the application when the window is closed. When this option is enabled, the application will be closed only after selecting Quit in the menu.</source>
<translation>Minimaliseer het venster in de plaats van de applicatie af te sluiten als het venster gesloten wordt. Wanneer deze optie aan staan, kan de applicatie alleen worden afgesloten door Afsluiten te kiezen in het menu.</translation>
</message>
<message>
<location line="+3"/>
<source>M&inimize on close</source>
<translation>Minimaliseer bij sluiten van het &venster</translation>
</message>
<message>
<location line="+21"/>
<source>&Display</source>
<translation>&Interface</translation>
</message>
<message>
<location line="+8"/>
<source>User Interface &language:</source>
<translation>Taal &Gebruikersinterface:</translation>
</message>
<message>
<location line="+13"/>
<source>The user interface language can be set here. This setting will take effect after restarting IadixCoin.</source>
<translation>De user interface-taal kan hier ingesteld worden. Deze instelling word toegepast na IadixCoin opnieuw op te starten.</translation>
</message>
<message>
<location line="+11"/>
<source>&Unit to show amounts in:</source>
<translation>&Eenheid om bedrag in te tonen:</translation>
</message>
<message>
<location line="+13"/>
<source>Choose the default subdivision unit to show in the interface and when sending coins.</source>
<translation>Kies de standaard <API key> om weer te geven in uw programma, en voor het versturen van munten</translation>
</message>
<message>
<location line="+9"/>
<source>Whether to show coin control features or not.</source>
<translation>Munt controle functies weergeven of niet.</translation>
</message>
<message>
<location line="+3"/>
<source>Display coin &control features (experts only!)</source>
<translation>Laat coin & control functies zien (enkel voor gevorderden!)</translation>
</message>
<message>
<location line="+7"/>
<source>Whether to select the coin outputs randomly or with minimal coin age.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Minimize weight consumption (experimental)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Use black visual theme (requires restart)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+71"/>
<source>&OK</source>
<translation>&OK</translation>
</message>
<message>
<location line="+7"/>
<source>&Cancel</source>
<translation>Ann&uleren</translation>
</message>
<message>
<location line="+10"/>
<source>&Apply</source>
<translation>&Toepassen</translation>
</message>
<message>
<location filename="../optionsdialog.cpp" line="+47"/>
<source>default</source>
<translation>standaard</translation>
</message>
<message>
<location line="+148"/>
<location line="+9"/>
<source>Warning</source>
<translation>Waarschuwing</translation>
</message>
<message>
<location line="-9"/>
<location line="+9"/>
<source>This setting will take effect after restarting IadixCoin.</source>
<translation>Deze instelling word toegepast na een restart van IadixCoin.</translation>
</message>
<message>
<location line="+29"/>
<source>The supplied proxy address is invalid.</source>
<translation>Het opgegeven proxyadres is ongeldig.</translation>
</message>
</context>
<context>
<name>OverviewPage</name>
<message>
<location filename="../forms/overviewpage.ui" line="+14"/>
<source>Form</source>
<translation>Vorm</translation>
</message>
<message>
<location line="+46"/>
<location line="+247"/>
<source>The displayed information may be out of date. Your wallet automatically synchronizes with the IadixCoin network after a connection is established, but this process has not completed yet.</source>
<translation>De weergegeven informatie kan verouderd zijn, Je portemonnee synchroniseerd automatisch met het IadixCoin netwerk nadat er verbindig is gemaakt, maar dit proces is nog niet voltooid.</translation>
</message>
<message>
<location line="-173"/>
<source>Stake:</source>
<translation>Stake:</translation>
</message>
<message>
<location line="+32"/>
<source>Unconfirmed:</source>
<translation>Onbevestigd:</translation>
</message>
<message>
<location line="-113"/>
<source>Wallet</source>
<translation>Portemonnee</translation>
</message>
<message>
<location line="+49"/>
<source>Spendable:</source>
<translation>Uitgeefbaar:</translation>
</message>
<message>
<location line="+16"/>
<source>Your current spendable balance</source>
<translation>Uw beschikbare saldo</translation>
</message>
<message>
<location line="+80"/>
<source>Immature:</source>
<translation>Immatuur:</translation>
</message>
<message>
<location line="+13"/>
<source>Mined balance that has not yet matured</source>
<translation>Gedolven saldo dat nog niet tot wasdom is gekomen</translation>
</message>
<message>
<location line="+23"/>
<source>Total:</source>
<translation>Totaal:</translation>
</message>
<message>
<location line="+16"/>
<source>Your current total balance</source>
<translation>Uw totale saldo</translation>
</message>
<message>
<location line="+50"/>
<source><b>Recent transactions</b></source>
<translation><b>Recente transacties</b></translation>
</message>
<message>
<location line="-118"/>
<source>Total of transactions that have yet to be confirmed, and do not yet count toward the current balance</source>
<translation>Totaal van de transacties die nog moeten worden bevestigd, en nog niet mee voor het huidige balans</translation>
</message>
<message>
<location line="-32"/>
<source>Total of coins that was staked, and do not yet count toward the current balance</source>
<translation>Totaal aantal munten dat was staked, en nog niet telt voor huidige balans.</translation>
</message>
<message>
<location filename="../overviewpage.cpp" line="+116"/>
<location line="+1"/>
<source>out of sync</source>
<translation>niet gesynchroniseerd</translation>
</message>
</context>
<context>
<name>PaymentServer</name>
<message>
<location filename="../paymentserver.cpp" line="+107"/>
<source>Cannot start iadixcoin: click-to-pay handler</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>QRCodeDialog</name>
<message>
<location filename="../forms/qrcodedialog.ui" line="+14"/>
<source>QR Code Dialog</source>
<translation>QR Code Scherm</translation>
</message>
<message>
<location line="+59"/>
<source>Request Payment</source>
<translation>Vraag betaling</translation>
</message>
<message>
<location line="+56"/>
<source>Amount:</source>
<translation>Hoeveelheid:</translation>
</message>
<message>
<location line="-44"/>
<source>Label:</source>
<translation>Label:</translation>
</message>
<message>
<location line="+19"/>
<source>Message:</source>
<translation>Bericht:</translation>
</message>
<message>
<location line="+71"/>
<source>&Save As...</source>
<translation>&Opslaan als...</translation>
</message>
<message>
<location filename="../qrcodedialog.cpp" line="+62"/>
<source>Error encoding URI into QR Code.</source>
<translation>Fout tijdens encoderen URI in QR-code</translation>
</message>
<message>
<location line="+40"/>
<source>The entered amount is invalid, please check.</source>
<translation>De ingevoerde hoeveel is ongeldig, controleer aub.</translation>
</message>
<message>
<location line="+23"/>
<source>Resulting URI too long, try to reduce the text for label / message.</source>
<translation>Resulterende URI te lang, probeer de tekst korter te maken voor het label/bericht.</translation>
</message>
<message>
<location line="+25"/>
<source>Save QR Code</source>
<translation>Sla QR Code op.</translation>
</message>
<message>
<location line="+0"/>
<source>PNG Images (*.png)</source>
<translation>PNG Afbeeldingen (*.png)</translation>
</message>
</context>
<context>
<name>RPCConsole</name>
<message>
<location filename="../forms/rpcconsole.ui" line="+46"/>
<source>Client name</source>
<translation>Clientnaam</translation>
</message>
<message>
<location line="+10"/>
<location line="+23"/>
<location line="+26"/>
<location line="+23"/>
<location line="+23"/>
<location line="+36"/>
<location line="+53"/>
<location line="+23"/>
<source>N/A</source>
<translation>N.v.t.</translation>
</message>
<message>
<location line="-194"/>
<source>Client version</source>
<translation>Clientversie</translation>
</message>
<message>
<location line="-45"/>
<source>&Information</source>
<translation>&Informatie</translation>
</message>
<message>
<location line="+68"/>
<source>Using OpenSSL version</source>
<translation>Gebruikt OpenSSL versie</translation>
</message>
<message>
<location line="+49"/>
<source>Startup time</source>
<translation>Opstarttijd</translation>
</message>
<message>
<location line="+29"/>
<source>Network</source>
<translation>Netwerk</translation>
</message>
<message>
<location line="+7"/>
<source>Number of connections</source>
<translation>Aantal connecties</translation>
</message>
<message>
<location line="+23"/>
<source>On testnet</source>
<translation>Op testnetwerk</translation>
</message>
<message>
<location line="+23"/>
<source>Block chain</source>
<translation>Blokketen</translation>
</message>
<message>
<location line="+7"/>
<source>Current number of blocks</source>
<translation>Huidig aantal blokken</translation>
</message>
<message>
<location line="+197"/>
<source>&Network Traffic</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+52"/>
<source>&Clear</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+13"/>
<source>Totals</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+64"/>
<source>In:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+80"/>
<source>Out:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-383"/>
<source>Last block time</source>
<translation>Tijd laatste blok</translation>
</message>
<message>
<location line="+52"/>
<source>&Open</source>
<translation>&Open</translation>
</message>
<message>
<location line="+16"/>
<source>Command-line options</source>
<translation><API key></translation>
</message>
<message>
<location line="+7"/>
<source>Show the IadixCoin-Qt help message to get a list with possible IadixCoin command-line options.</source>
<translation>Laat het Iadixcoin-QT help bericht zien om een lijst te krijgen met mogelijke Iadixcoin command-regel opties.</translation>
</message>
<message>
<location line="+3"/>
<source>&Show</source>
<translation>&Show</translation>
</message>
<message>
<location line="+24"/>
<source>&Console</source>
<translation>&Console</translation>
</message>
<message>
<location line="-237"/>
<source>Build date</source>
<translation>Bouwdatum</translation>
</message>
<message>
<location line="-104"/>
<source>IadixCoin - Debug window</source>
<translation>Iadixcoin - Debugscherm</translation>
</message>
<message>
<location line="+25"/>
<source>IadixCoin Core</source>
<translation>IadixCoin Kern</translation>
</message>
<message>
<location line="+256"/>
<source>Debug log file</source>
<translation>Debug-logbestand</translation>
</message>
<message>
<location line="+7"/>
<source>Open the IadixCoin debug log file from the current data directory. This can take a few seconds for large log files.</source>
<translation>Open het IadixCoin debug log bestand van de huidige data map. Dit kan een paar seconden duren voor grote log bestanden.</translation>
</message>
<message>
<location line="+102"/>
<source>Clear console</source>
<translation>Maak console leeg</translation>
</message>
<message>
<location filename="../rpcconsole.cpp" line="+325"/>
<source>Welcome to the IadixCoin RPC console.</source>
<translation>Welkom bij de IadixCoin RPC console.</translation>
</message>
<message>
<location line="+1"/>
<source>Use up and down arrows to navigate history, and <b>Ctrl-L</b> to clear screen.</source>
<translation>Gebruik de pijltjestoetsen om door de geschiedenis te navigeren, en <b>Ctrl-L</b> om het scherm leeg te maken.</translation>
</message>
<message>
<location line="+1"/>
<source>Type <b>help</b> for an overview of available commands.</source>
<translation>Typ <b>help</b> voor een overzicht van de beschikbare commando's.</translation>
</message>
<message>
<location line="+127"/>
<source>%1 B</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>%1 KB</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>%1 MB</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>%1 GB</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>%1 m</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>%1 h</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>%1 h %2 m</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>SendCoinsDialog</name>
<message>
<location filename="../forms/sendcoinsdialog.ui" line="+14"/>
<location filename="../sendcoinsdialog.cpp" line="+182"/>
<location line="+5"/>
<location line="+5"/>
<location line="+5"/>
<location line="+6"/>
<location line="+5"/>
<location line="+5"/>
<source>Send Coins</source>
<translation>Verstuur munten</translation>
</message>
<message>
<location line="+76"/>
<source>Coin Control Features</source>
<translation>Coin controle opties</translation>
</message>
<message>
<location line="+20"/>
<source>Inputs...</source>
<translation>Invoer...</translation>
</message>
<message>
<location line="+7"/>
<source>automatically selected</source>
<translation>automatisch geselecteerd</translation>
</message>
<message>
<location line="+19"/>
<source>Insufficient funds!</source>
<translation>Onvoldoende fonds!</translation>
</message>
<message>
<location line="+77"/>
<source>Quantity:</source>
<translation>Kwantiteit</translation>
</message>
<message>
<location line="+22"/>
<location line="+35"/>
<source>0</source>
<translation>0</translation>
</message>
<message>
<location line="-19"/>
<source>Bytes:</source>
<translation>Bytes:</translation>
</message>
<message>
<location line="+51"/>
<source>Amount:</source>
<translation>Bedrag:</translation>
</message>
<message>
<location line="+35"/>
<source>Priority:</source>
<translation>Prioriteit:</translation>
</message>
<message>
<location line="+19"/>
<source>medium</source>
<translation>gemiddeld</translation>
</message>
<message>
<location line="+32"/>
<source>Fee:</source>
<translation>Vergoeding:</translation>
</message>
<message>
<location line="+35"/>
<source>Low Output:</source>
<translation>Lage uitvoer:</translation>
</message>
<message>
<location line="+19"/>
<source>no</source>
<translation>nee</translation>
</message>
<message>
<location line="+32"/>
<source>After Fee:</source>
<translation>Na vergoeding:</translation>
</message>
<message>
<location line="+35"/>
<source>Change</source>
<translation>Wijzigen</translation>
</message>
<message>
<location line="+50"/>
<source>custom change address</source>
<translation>handmatig veranderen adres</translation>
</message>
<message>
<location line="+106"/>
<source>Send to multiple recipients at once</source>
<translation>Verstuur aan verschillende ontvangers ineens</translation>
</message>
<message>
<location line="+3"/>
<source>Add &Recipient</source>
<translation>Voeg &Ontvanger Toe</translation>
</message>
<message>
<location line="+16"/>
<source>Remove all transaction fields</source>
<translation>Verwijder alles in de invulvelden</translation>
</message>
<message>
<location line="+3"/>
<source>Clear &All</source>
<translation>Verwijder &Alles</translation>
</message>
<message>
<location line="+24"/>
<source>Balance:</source>
<translation>Saldo:</translation>
</message>
<message>
<location line="+47"/>
<source>Confirm the send action</source>
<translation>Bevestig de verstuuractie</translation>
</message>
<message>
<location line="+3"/>
<source>S&end</source>
<translation>&Verstuur</translation>
</message>
<message>
<location filename="../sendcoinsdialog.cpp" line="-174"/>
<source>Enter a IadixCoin address (e.g. <API key>)</source>
<translation>Voeg een Iadixcoin adres in (bijv. <API key>)</translation>
</message>
<message>
<location line="+15"/>
<source>Copy quantity</source>
<translation>Kopieer aantal</translation>
</message>
<message>
<location line="+1"/>
<source>Copy amount</source>
<translation>Kopieer bedrag</translation>
</message>
<message>
<location line="+1"/>
<source>Copy fee</source>
<translation>Kopieer vergoeding</translation>
</message>
<message>
<location line="+1"/>
<source>Copy after fee</source>
<translation>Kopieer na vergoeding</translation>
</message>
<message>
<location line="+1"/>
<source>Copy bytes</source>
<translation>Kopieer bytes</translation>
</message>
<message>
<location line="+1"/>
<source>Copy priority</source>
<translation>Kopieer prioriteit</translation>
</message>
<message>
<location line="+1"/>
<source>Copy low output</source>
<translation>Kopieer lage uitvoer</translation>
</message>
<message>
<location line="+1"/>
<source>Copy change</source>
<translation>Kopieer wijzig</translation>
</message>
<message>
<location line="+87"/>
<source><b>%1</b> to %2 (%3)</source>
<translation><b> %1 </b> to %2 (%3)</translation>
</message>
<message>
<location line="+5"/>
<source>Confirm send coins</source>
<translation>Bevestig versturen munten</translation>
</message>
<message>
<location line="+1"/>
<source>Are you sure you want to send %1?</source>
<translation>Weet je zeker dat je %1 wilt verzenden?</translation>
</message>
<message>
<location line="+0"/>
<source> and </source>
<translation>en</translation>
</message>
<message>
<location line="+29"/>
<source>The recipient address is not valid, please recheck.</source>
<translation>Het ontvangstadres is niet geldig, controleer uw invoer.</translation>
</message>
<message>
<location line="+5"/>
<source>The amount to pay must be larger than 0.</source>
<translation>Het ingevoerde bedrag moet groter zijn dan 0.</translation>
</message>
<message>
<location line="+5"/>
<source>The amount exceeds your balance.</source>
<translation>Bedrag is hoger dan uw huidige saldo</translation>
</message>
<message>
<location line="+5"/>
<source>The total exceeds your balance when the %1 transaction fee is included.</source>
<translation>Totaal overschrijdt uw huidige saldo wanneer de %1 transactiekosten worden meegerekend</translation>
</message>
<message>
<location line="+6"/>
<source>Duplicate address found, can only send to each address once per send operation.</source>
<translation>Dubbel adres gevonden, u kunt slechts eenmaal naar een bepaald adres verzenden per verstuurtransactie</translation>
</message>
<message>
<location line="+5"/>
<source>Error: Transaction creation failed!</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Error: The transaction was rejected. This might happen if some of the coins in your wallet were already spent, such as if you used a copy of wallet.dat and coins were spent in the copy but not marked as spent here.</source>
<translation>Fout: De transactie was geweigerd, Dit kan gebeuren als sommige munten in je portemonnee al gebruikt zijn, door het gebruik van een kopie van wallet.dat en de munten in de kopie zijn niet gemarkeerd als gebruikt.</translation>
</message>
<message>
<location line="+247"/>
<source>WARNING: Invalid IadixCoin address</source>
<translation>WAARSCHUWING: Ongeldig Iadixcoin adres</translation>
</message>
<message>
<location line="+13"/>
<source>(no label)</source>
<translation>(geen label)</translation>
</message>
<message>
<location line="+4"/>
<source>WARNING: unknown change address</source>
<translation>WAARSCHUWING: Onbekend adres</translation>
</message>
</context>
<context>
<name>SendCoinsEntry</name>
<message>
<location filename="../forms/sendcoinsentry.ui" line="+14"/>
<source>Form</source>
<translation>Vorm</translation>
</message>
<message>
<location line="+15"/>
<source>A&mount:</source>
<translation>Bedra&g:</translation>
</message>
<message>
<location line="+13"/>
<source>Pay &To:</source>
<translation>Betaal &Aan:</translation>
</message>
<message>
<location line="+34"/>
<source>The address to send the payment to (e.g. <API key>)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+60"/>
<location filename="../sendcoinsentry.cpp" line="+26"/>
<source>Enter a label for this address to add it to your address book</source>
<translation>Vul een label in voor dit adres om het toe te voegen aan uw adresboek</translation>
</message>
<message>
<location line="-78"/>
<source>&Label:</source>
<translation>&Label:</translation>
</message>
<message>
<location line="+28"/>
<source>Choose address from address book</source>
<translation>Kies adres uit adresboek</translation>
</message>
<message>
<location line="+10"/>
<source>Alt+A</source>
<translation>Alt+A</translation>
</message>
<message>
<location line="+7"/>
<source>Paste address from clipboard</source>
<translation>Plak adres vanuit klembord</translation>
</message>
<message>
<location line="+10"/>
<source>Alt+P</source>
<translation>Alt+P</translation>
</message>
<message>
<location line="+7"/>
<source>Remove this recipient</source>
<translation>Verwijder deze ontvanger</translation>
</message>
<message>
<location filename="../sendcoinsentry.cpp" line="+1"/>
<source>Enter a IadixCoin address (e.g. <API key>)</source>
<translation>Voeg een Iadixcoin adres in (bijv. <API key>)</translation>
</message>
</context>
<context>
<name><API key></name>
<message>
<location filename="../forms/<API key>.ui" line="+14"/>
<source>Signatures - Sign / Verify a Message</source>
<translation>Handtekeningen - Onderteken een bericht / Verifiëer een handtekening</translation>
</message>
<message>
<location line="+13"/>
<location line="+124"/>
<source>&Sign Message</source>
<translation>O&nderteken Bericht</translation>
</message>
<message>
<location line="-118"/>
<source>You can sign messages with your addresses to prove you own them. Be careful not to sign anything vague, as phishing attacks may try to trick you into signing your identity over to them. Only sign fully-detailed statements you agree to.</source>
<translation>U kunt berichten ondertekenen met een van uw adressen om te bewijzen dat u dit adres bezit. Pas op dat u geen onduidelijke dingen ondertekent, want phishingaanvallen zouden u kunnen misleiden om zo uw identiteit te stelen. Onderteken alleen berichten waarmee u het volledig eens bent.</translation>
</message>
<message>
<location line="+18"/>
<source>The address to sign the message with (e.g. <API key>)</source>
<translation>Het adres om het bericht te ondertekenen (bijv. <API key>) </translation>
</message>
<message>
<location line="+10"/>
<location line="+203"/>
<source>Choose an address from the address book</source>
<translation>Kies een adres uit het adresboek</translation>
</message>
<message>
<location line="-193"/>
<location line="+203"/>
<source>Alt+A</source>
<translation>Alt+A</translation>
</message>
<message>
<location line="-193"/>
<source>Paste address from clipboard</source>
<translation>Plak adres vanuit klembord</translation>
</message>
<message>
<location line="+10"/>
<source>Alt+P</source>
<translation>Alt+P</translation>
</message>
<message>
<location line="+12"/>
<source>Enter the message you want to sign here</source>
<translation>Typ hier het bericht dat u wilt ondertekenen</translation>
</message>
<message>
<location line="+24"/>
<source>Copy the current signature to the system clipboard</source>
<translation>Kopieer de huidige handtekening naar het systeemklembord</translation>
</message>
<message>
<location line="+21"/>
<source>Sign the message to prove you own this IadixCoin address</source>
<translation>Teken een bericht om te bewijzen dat je een IadixCoin adres bezit.</translation>
</message>
<message>
<location line="+17"/>
<source>Reset all sign message fields</source>
<translation>Verwijder alles in de invulvelden</translation>
</message>
<message>
<location line="+3"/>
<location line="+146"/>
<source>Clear &All</source>
<translation>Verwijder &Alles</translation>
</message>
<message>
<location line="-87"/>
<location line="+70"/>
<source>&Verify Message</source>
<translation>&Verifiëer Bericht</translation>
</message>
<message>
<location line="-64"/>
<source>Enter the signing address, message (ensure you copy line breaks, spaces, tabs, etc. exactly) and signature below to verify the message. Be careful not to read more into the signature than what is in the signed message itself, to avoid being tricked by a man-in-the-middle attack.</source>
<translation>Voer het ondertekenende adres, bericht en handtekening hieronder in (let erop dat u nieuwe regels, spaties en tabs juist overneemt) om de handtekening te verifiëren. Let erop dat u niet meer uit het bericht interpreteert dan er daadwerkelijk staat, om te voorkomen dat u wordt misleid in een <API key>.</translation>
</message>
<message>
<location line="+21"/>
<source>The address the message was signed with (e.g. <API key>)</source>
<translation>Het adres van het bericht is ondertekend met (bijv. <API key>)</translation>
</message>
<message>
<location line="+40"/>
<source>Verify the message to ensure it was signed with the specified IadixCoin address</source>
<translation>Verifieer een bericht om zeker te zijn dat deze is ondertekend met een specifiek IadixCoin adres</translation>
</message>
<message>
<location line="+17"/>
<source>Reset all verify message fields</source>
<translation>Verwijder alles in de invulvelden</translation>
</message>
<message>
<location filename="../<API key>.cpp" line="+27"/>
<location line="+3"/>
<source>Enter a IadixCoin address (e.g. <API key>)</source>
<translation>Voeg een Iadixcoin adres in (bijv. <API key>)</translation>
</message>
<message>
<location line="-2"/>
<source>Click "Sign Message" to generate signature</source>
<translation>Klik "Onderteken Bericht" om de handtekening te genereren</translation>
</message>
<message>
<location line="+3"/>
<source>Enter IadixCoin signature</source>
<translation>Voer IadixCoin handtekening in</translation>
</message>
<message>
<location line="+85"/>
<location line="+81"/>
<source>The entered address is invalid.</source>
<translation>Het opgegeven adres is ongeldig.</translation>
</message>
<message>
<location line="-81"/>
<location line="+8"/>
<location line="+73"/>
<location line="+8"/>
<source>Please check the address and try again.</source>
<translation>Controleer s.v.p. het adres en probeer het opnieuw.</translation>
</message>
<message>
<location line="-81"/>
<location line="+81"/>
<source>The entered address does not refer to a key.</source>
<translation>Het opgegeven adres verwijst niet naar een sleutel.</translation>
</message>
<message>
<location line="-73"/>
<source>Wallet unlock was cancelled.</source>
<translation><API key> is geannuleerd</translation>
</message>
<message>
<location line="+8"/>
<source>Private key for the entered address is not available.</source>
<translation>Geheime sleutel voor het ingevoerde adres is niet beschikbaar.</translation>
</message>
<message>
<location line="+12"/>
<source>Message signing failed.</source>
<translation>Ondertekenen van het bericht is mislukt.</translation>
</message>
<message>
<location line="+5"/>
<source>Message signed.</source>
<translation>Bericht ondertekend.</translation>
</message>
<message>
<location line="+59"/>
<source>The signature could not be decoded.</source>
<translation>De handtekening kon niet worden gedecodeerd.</translation>
</message>
<message>
<location line="+0"/>
<location line="+13"/>
<source>Please check the signature and try again.</source>
<translation>Controleer s.v.p. de handtekening en probeer het opnieuw.</translation>
</message>
<message>
<location line="+0"/>
<source>The signature did not match the message digest.</source>
<translation>De handtekening hoort niet bij het bericht.</translation>
</message>
<message>
<location line="+7"/>
<source>Message verification failed.</source>
<translation>Berichtverificatie mislukt.</translation>
</message>
<message>
<location line="+5"/>
<source>Message verified.</source>
<translation>Bericht correct geverifiëerd.</translation>
</message>
</context>
<context>
<name>TrafficGraphWidget</name>
<message>
<location filename="../trafficgraphwidget.cpp" line="+75"/>
<source>KB/s</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>TransactionDesc</name>
<message>
<location filename="../transactiondesc.cpp" line="+25"/>
<source>Open until %1</source>
<translation>Openen totdat %1</translation>
</message>
<message>
<location line="+6"/>
<source>conflicted</source>
<translation>conflicted</translation>
</message>
<message>
<location line="+2"/>
<source>%1/offline</source>
<translation>%1/offline</translation>
</message>
<message>
<location line="+2"/>
<source>%1/unconfirmed</source>
<translation>%1/onbevestigd</translation>
</message>
<message>
<location line="+2"/>
<source>%1 confirmations</source>
<translation>%1 bevestigingen</translation>
</message>
<message>
<location line="+17"/>
<source>Status</source>
<translation>Status</translation>
</message>
<message numerus="yes">
<location line="+7"/>
<source>, broadcast through %n node(s)</source>
<translation><numerusform>, uitgezonden naar %n node</numerusform><numerusform>, uitgezonden naar %n nodes</numerusform></translation>
</message>
<message>
<location line="+4"/>
<source>Date</source>
<translation>Datum</translation>
</message>
<message>
<location line="+7"/>
<source>Source</source>
<translation>Bron</translation>
</message>
<message>
<location line="+0"/>
<source>Generated</source>
<translation>Gegenereerd</translation>
</message>
<message>
<location line="+5"/>
<location line="+13"/>
<source>From</source>
<translation>Van</translation>
</message>
<message>
<location line="+1"/>
<location line="+19"/>
<location line="+58"/>
<source>To</source>
<translation>Aan</translation>
</message>
<message>
<location line="-74"/>
<location line="+2"/>
<source>own address</source>
<translation>eigen adres</translation>
</message>
<message>
<location line="-2"/>
<source>label</source>
<translation>label</translation>
</message>
<message>
<location line="+34"/>
<location line="+12"/>
<location line="+45"/>
<location line="+17"/>
<location line="+30"/>
<source>Credit</source>
<translation>Credit</translation>
</message>
<message numerus="yes">
<location line="-102"/>
<source>matures in %n more block(s)</source>
<translation><numerusform>komt tot wasdom na %n nieuw blok</numerusform><numerusform>komt tot wasdom na %n nieuwe blokken</numerusform></translation>
</message>
<message>
<location line="+2"/>
<source>not accepted</source>
<translation>niet geaccepteerd</translation>
</message>
<message>
<location line="+44"/>
<location line="+8"/>
<location line="+15"/>
<location line="+30"/>
<source>Debit</source>
<translation>Debet</translation>
</message>
<message>
<location line="-39"/>
<source>Transaction fee</source>
<translation>Transactiekosten</translation>
</message>
<message>
<location line="+16"/>
<source>Net amount</source>
<translation>Netto bedrag</translation>
</message>
<message>
<location line="+6"/>
<source>Message</source>
<translation>Bericht</translation>
</message>
<message>
<location line="+2"/>
<source>Comment</source>
<translation>Opmerking</translation>
</message>
<message>
<location line="+2"/>
<source>Transaction ID</source>
<translation>Transactie-ID:</translation>
</message>
<message>
<location line="+3"/>
<source>Generated coins must mature 510 blocks before they can be spent. When you generated this block, it was broadcast to the network to be added to the block chain. If it fails to get into the chain, its state will change to "not accepted" and it won't be spendable. This may occasionally happen if another node generates a block within a few seconds of yours.</source>
<translation>Gegenereerd munten moeten 510 blokken maturen voordat ze kunnen worden besteed. Wanneer je een blok genereerd, het naar het netwerk is verzonden en toegevoegd aan de blokketen, zal de status veranderen naar "niet geaccepteerd"and kan het niet uitgegeven worden. Dit kan soms gebeuren als een ander knooppunt genereert een blok binnen een paar seconden na jou.</translation>
</message>
<message>
<location line="+7"/>
<source>Debug information</source>
<translation>Debug-informatie</translation>
</message>
<message>
<location line="+8"/>
<source>Transaction</source>
<translation>Transactie</translation>
</message>
<message>
<location line="+5"/>
<source>Inputs</source>
<translation>Inputs</translation>
</message>
<message>
<location line="+21"/>
<source>Amount</source>
<translation>Bedrag</translation>
</message>
<message>
<location line="+1"/>
<source>true</source>
<translation>waar</translation>
</message>
<message>
<location line="+0"/>
<source>false</source>
<translation>onwaar</translation>
</message>
<message>
<location line="-202"/>
<source>, has not been successfully broadcast yet</source>
<translation>, is nog niet met succes uitgezonden</translation>
</message>
<message numerus="yes">
<location line="-36"/>
<source>Open for %n more block(s)</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation>
</message>
<message>
<location line="+67"/>
<source>unknown</source>
<translation>onbekend</translation>
</message>
</context>
<context>
<name><API key></name>
<message>
<location filename="../forms/<API key>.ui" line="+14"/>
<source>Transaction details</source>
<translation>Transactiedetails</translation>
</message>
<message>
<location line="+6"/>
<source>This pane shows a detailed description of the transaction</source>
<translation>Dit venster laat een uitgebreide beschrijving van de transactie zien</translation>
</message>
</context>
<context>
<name><API key></name>
<message>
<location filename="../<API key>.cpp" line="+231"/>
<source>Date</source>
<translation>Datum</translation>
</message>
<message>
<location line="+0"/>
<source>Type</source>
<translation>Type</translation>
</message>
<message>
<location line="+0"/>
<source>Address</source>
<translation>Adres</translation>
</message>
<message>
<location line="+0"/>
<source>Amount</source>
<translation>Bedrag</translation>
</message>
<message>
<location line="+52"/>
<source>Open until %1</source>
<translation>Open tot %1</translation>
</message>
<message>
<location line="+12"/>
<source>Confirmed (%1 confirmations)</source>
<translation>Bevestigd (%1 bevestigingen)</translation>
</message>
<message numerus="yes">
<location line="-15"/>
<source>Open for %n more block(s)</source>
<translation><numerusform>Open voor nog %n blok</numerusform><numerusform>Open voor nog %n blokken</numerusform></translation>
</message>
<message>
<location line="+6"/>
<source>Offline</source>
<translation>Offline</translation>
</message>
<message>
<location line="+3"/>
<source>Unconfirmed</source>
<translation>Onbevestigd:</translation>
</message>
<message>
<location line="+3"/>
<source>Confirming (%1 of %2 recommended confirmations)</source>
<translation>Bevestigen.. (%1 van de %2 bevestigingen)</translation>
</message>
<message>
<location line="+6"/>
<source>Conflicted</source>
<translation>Conflicted</translation>
</message>
<message>
<location line="+3"/>
<source>Immature (%1 confirmations, will be available after %2)</source>
<translation>Immature (%1 bevestiging, word beschikbaar na %2)</translation>
</message>
<message>
<location line="+3"/>
<source>This block was not received by any other nodes and will probably not be accepted!</source>
<translation>Dit blok is niet ontvangen bij andere nodes en zal waarschijnlijk niet worden geaccepteerd!</translation>
</message>
<message>
<location line="+3"/>
<source>Generated but not accepted</source>
<translation>Gegenereerd maar niet geaccepteerd</translation>
</message>
<message>
<location line="+42"/>
<source>Received with</source>
<translation>Ontvangen met</translation>
</message>
<message>
<location line="+2"/>
<source>Received from</source>
<translation>Ontvangen van</translation>
</message>
<message>
<location line="+3"/>
<source>Sent to</source>
<translation>Verzonden aan</translation>
</message>
<message>
<location line="+2"/>
<source>Payment to yourself</source>
<translation>Betaling aan uzelf</translation>
</message>
<message>
<location line="+2"/>
<source>Mined</source>
<translation>Gedolven</translation>
</message>
<message>
<location line="+38"/>
<source>(n/a)</source>
<translation>(nvt)</translation>
</message>
<message>
<location line="+194"/>
<source>Transaction status. Hover over this field to show number of confirmations.</source>
<translation>Transactiestatus. Houd de muiscursor boven dit veld om het aantal bevestigingen te laten zien.</translation>
</message>
<message>
<location line="+2"/>
<source>Date and time that the transaction was received.</source>
<translation>Datum en tijd waarop deze transactie is ontvangen.</translation>
</message>
<message>
<location line="+2"/>
<source>Type of transaction.</source>
<translation>Type transactie.</translation>
</message>
<message>
<location line="+2"/>
<source>Destination address of transaction.</source>
<translation>Ontvangend adres van transactie.</translation>
</message>
<message>
<location line="+2"/>
<source>Amount removed from or added to balance.</source>
<translation>Bedrag verwijderd van of toegevoegd aan saldo</translation>
</message>
</context>
<context>
<name>TransactionView</name>
<message>
<location filename="../transactionview.cpp" line="+54"/>
<location line="+17"/>
<source>All</source>
<translation>Alles</translation>
</message>
<message>
<location line="-16"/>
<source>Today</source>
<translation>Vandaag</translation>
</message>
<message>
<location line="+1"/>
<source>This week</source>
<translation>Deze week</translation>
</message>
<message>
<location line="+1"/>
<source>This month</source>
<translation>Deze maand</translation>
</message>
<message>
<location line="+1"/>
<source>Last month</source>
<translation>Vorige maand</translation>
</message>
<message>
<location line="+1"/>
<source>This year</source>
<translation>Dit jaar</translation>
</message>
<message>
<location line="+1"/>
<source>Range...</source>
<translation>Bereik...</translation>
</message>
<message>
<location line="+12"/>
<source>Received with</source>
<translation>Ontvangen met</translation>
</message>
<message>
<location line="+2"/>
<source>Sent to</source>
<translation>Verzonden aan</translation>
</message>
<message>
<location line="+2"/>
<source>To yourself</source>
<translation>Aan uzelf</translation>
</message>
<message>
<location line="+1"/>
<source>Mined</source>
<translation>Gedolven</translation>
</message>
<message>
<location line="+1"/>
<source>Other</source>
<translation>Anders</translation>
</message>
<message>
<location line="+7"/>
<source>Enter address or label to search</source>
<translation>Vul adres of label in om te zoeken</translation>
</message>
<message>
<location line="+7"/>
<source>Min amount</source>
<translation>Min. bedrag</translation>
</message>
<message>
<location line="+34"/>
<source>Copy address</source>
<translation>Kopieer adres</translation>
</message>
<message>
<location line="+1"/>
<source>Copy label</source>
<translation>Kopieer label</translation>
</message>
<message>
<location line="+1"/>
<source>Copy amount</source>
<translation>Kopieer bedrag</translation>
</message>
<message>
<location line="+1"/>
<source>Copy transaction ID</source>
<translation>Kopieer transactie-ID</translation>
</message>
<message>
<location line="+1"/>
<source>Edit label</source>
<translation>Bewerk label</translation>
</message>
<message>
<location line="+1"/>
<source>Show transaction details</source>
<translation>Toon transactiedetails</translation>
</message>
<message>
<location line="+138"/>
<source>Export Transaction Data</source>
<translation>Exporteer Transactie Data</translation>
</message>
<message>
<location line="+1"/>
<source>Comma separated file (*.csv)</source>
<translation>Kommagescheiden bestand (*.csv)</translation>
</message>
<message>
<location line="+8"/>
<source>Confirmed</source>
<translation>Bevestigd</translation>
</message>
<message>
<location line="+1"/>
<source>Date</source>
<translation>Datum</translation>
</message>
<message>
<location line="+1"/>
<source>Type</source>
<translation>Type</translation>
</message>
<message>
<location line="+1"/>
<source>Label</source>
<translation>Label</translation>
</message>
<message>
<location line="+1"/>
<source>Address</source>
<translation>Adres</translation>
</message>
<message>
<location line="+1"/>
<source>Amount</source>
<translation>Bedrag</translation>
</message>
<message>
<location line="+1"/>
<source>ID</source>
<translation>ID</translation>
</message>
<message>
<location line="+4"/>
<source>Error exporting</source>
<translation>Fout bij exporteren</translation>
</message>
<message>
<location line="+0"/>
<source>Could not write to file %1.</source>
<translation>Kan niet schrijven naar bestand %1</translation>
</message>
<message>
<location line="+100"/>
<source>Range:</source>
<translation>Bereik:</translation>
</message>
<message>
<location line="+8"/>
<source>to</source>
<translation>naar</translation>
</message>
</context>
<context>
<name>WalletModel</name>
<message>
<location filename="../walletmodel.cpp" line="+212"/>
<source>Sending...</source>
<translation>Versturen...</translation>
</message>
</context>
<context>
<name>bitcoin-core</name>
<message>
<location filename="../bitcoinstrings.cpp" line="+171"/>
<source>IadixCoin version</source>
<translation>IadixCoin versie</translation>
</message>
<message>
<location line="+1"/>
<source>Usage:</source>
<translation>Gebruik:</translation>
</message>
<message>
<location line="+1"/>
<source>Send command to -server or iadixcoind</source>
<translation>Verstuur commando naar -server of iadixcoind</translation>
</message>
<message>
<location line="+1"/>
<source>List commands</source>
<translation>Lijst van commando's</translation>
</message>
<message>
<location line="+1"/>
<source>Get help for a command</source>
<translation>Toon hulp voor een commando</translation>
</message>
<message>
<location line="-145"/>
<source>Options:</source>
<translation>Opties:</translation>
</message>
<message>
<location line="+2"/>
<source>Specify configuration file (default: iadixcoin.conf)</source>
<translation>Selecteer configuratie bestand (standaard: iadixcoin.conf)</translation>
</message>
<message>
<location line="+1"/>
<source>Specify pid file (default: iadixcoind.pid)</source>
<translation>Selecteer pid bestand (standaard: iadixcoin.conf)</translation>
</message>
<message>
<location line="+2"/>
<source>Specify wallet file (within data directory)</source>
<translation>Specificeer het portemonnee bestand (vanuit de gegevensmap)</translation>
</message>
<message>
<location line="-1"/>
<source>Specify data directory</source>
<translation>Stel datamap in</translation>
</message>
<message>
<location line="-25"/>
<source>%s, you must set a rpcpassword in the configuration file:
%s
It is recommended you use the following random password:
rpcuser=iadixcoinrpc
rpcpassword=%s
(you do not need to remember this password)
The username and password MUST NOT be the same.
If the file does not exist, create it with owner-readable-only file permissions.
It is also recommended to set alertnotify so you are notified of problems;
for example: alertnotify=echo %%s | mail -s "IadixCoin Alert" admin@foo.com
</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+27"/>
<source>Set database cache size in megabytes (default: 25)</source>
<translation>Stel <API key> in in megabytes (standaard: 25)</translation>
</message>
<message>
<location line="+1"/>
<source>Set database disk log size in megabytes (default: 100)</source>
<translation>Stel database cache grootte in in megabytes (standaard: 100)</translation>
</message>
<message>
<location line="+5"/>
<source>Listen for connections on <port> (default: 15714 or testnet: 25714)</source>
<translation>Luister voor verbindingen op <poort> (standaard: 15714 of testnet: 25714)</translation>
</message>
<message>
<location line="+1"/>
<source>Maintain at most <n> connections to peers (default: 125)</source>
<translation>Onderhoud maximaal <n> verbindingen naar peers (standaard: 125)</translation>
</message>
<message>
<location line="+3"/>
<source>Connect to a node to retrieve peer addresses, and disconnect</source>
<translation>Verbind naar een node om adressen van anderen op te halen, en verbreek vervolgens de verbinding</translation>
</message>
<message>
<location line="+1"/>
<source>Specify your own public address</source>
<translation>Specificeer uw eigen publieke adres</translation>
</message>
<message>
<location line="+4"/>
<source>Bind to given address. Use [host]:port notation for IPv6</source>
<translation>Koppel aan gegeven adres. Gebruik [host]:poort notatie voor IPv6</translation>
</message>
<message>
<location line="+1"/>
<source>Query for peer addresses via DNS lookup, if low on addresses (default: 1 unless -connect)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Always query for peer addresses via DNS lookup (default: 0)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+4"/>
<source>Threshold for disconnecting misbehaving peers (default: 100)</source>
<translation>Drempel om verbinding te verbreken naar zich misdragende peers (standaard: 100)</translation>
</message>
<message>
<location line="+1"/>
<source>Number of seconds to keep misbehaving peers from reconnecting (default: 86400)</source>
<translation>Aantal seconden dat zich misdragende peers niet opnieuw mogen verbinden (standaard: 86400)</translation>
</message>
<message>
<location line="-35"/>
<source>An error occurred while setting up the RPC port %u for listening on IPv4: %s</source>
<translation>Er is een fout opgetreden tijdens het instellen van de inkomende RPC-poort %u op IPv4: %s</translation>
</message>
<message>
<location line="+62"/>
<source>Listen for JSON-RPC connections on <port> (default: 15715 or testnet: 25715)</source>
<translation>Wacht op JSON-RPC-connecties op <poort> (standaard: 15715 of testnet: 25715) </translation>
</message>
<message>
<location line="-16"/>
<source>Accept command line and JSON-RPC commands</source>
<translation>Aanvaard commandoregel- en JSON-RPC-commando's</translation>
</message>
<message>
<location line="+1"/>
<source>Run in the background as a daemon and accept commands</source>
<translation>Draai in de achtergrond als daemon en aanvaard commando's</translation>
</message>
<message>
<location line="+1"/>
<source>Use the test network</source>
<translation>Gebruik het testnetwerk</translation>
</message>
<message>
<location line="-23"/>
<source>Accept connections from outside (default: 1 if no -proxy or -connect)</source>
<translation>Accepteer verbindingen van buitenaf (standaard: 1 als geen -proxy of -connect is opgegeven)</translation>
</message>
<message>
<location line="-28"/>
<source>An error occurred while setting up the RPC port %u for listening on IPv6, falling back to IPv4: %s</source>
<translation>Er is een fout opgetreden tijdens het instellen van de inkomende RPC-poort %u op IPv6, terugval naar IPv4: %s</translation>
</message>
<message>
<location line="+93"/>
<source>Set maximum size of high-priority/low-fee transactions in bytes (default: 27000)</source>
<translation>Stel maximale grootte van high-priority/low-fee transacties in bytes (standaard: 27000)</translation>
</message>
<message>
<location line="+15"/>
<source>Warning: -paytxfee is set very high! This is the transaction fee you will pay if you send a transaction.</source>
<translation>Waarschuwing: -paytxfee is zeer hoog ingesteld. Dit zijn de transactiekosten die u betaalt bij het versturen van een transactie.</translation>
</message>
<message>
<location line="-103"/>
<source>Warning: Please check that your computer's date and time are correct! If your clock is wrong IadixCoin will not work properly.</source>
<translation>Waarschuwing: Controleer of de datum en tijd van de computer juist zijn! Als uw klok verkeerd is IadixCoin zal niet goed werken.</translation>
</message>
<message>
<location line="+130"/>
<source>Warning: error reading wallet.dat! All keys read correctly, but transaction data or address book entries might be missing or incorrect.</source>
<translation>Waarschuwing: Fout bij het lezen van wallet.dat! Alle sleutels zijn in goede orde uitgelezen, maar transactiedata of adresboeklemma's zouden kunnen ontbreken of fouten bevatten.</translation>
</message>
<message>
<location line="-16"/>
<source>Warning: wallet.dat corrupt, data salvaged! Original wallet.dat saved as wallet.{timestamp}.bak in %s; if your balance or transactions are incorrect you should restore from a backup.</source>
<translation>Waarschuwing: wallet.dat is corrupt, data is veiliggesteld! Originele wallet.dat is opgeslagen als wallet.{tijdstip}.bak in %s; als uw balans of transacties incorrect zijn dient u een backup terug te zetten.</translation>
</message>
<message>
<location line="-34"/>
<source>Attempt to recover private keys from a corrupt wallet.dat</source>
<translation>Poog de geheime sleutels uit een corrupt wallet.dat bestand terug te halen</translation>
</message>
<message>
<location line="+5"/>
<source>Block creation options:</source>
<translation>Blokcreatie-opties:</translation>
</message>
<message>
<location line="-67"/>
<source>Connect only to the specified node(s)</source>
<translation>Verbind alleen naar de gespecificeerde node(s)</translation>
</message>
<message>
<location line="+4"/>
<source>Discover own IP address (default: 1 when listening and no -externalip)</source>
<translation>Ontdek eigen IP-adres (standaard: 1 als er wordt geluisterd en geen -externalip is opgegeven)</translation>
</message>
<message>
<location line="+101"/>
<source>Failed to listen on any port. Use -listen=0 if you want this.</source>
<translation>Mislukt om op welke poort dan ook te luisteren. Gebruik -listen=0 as u dit wilt.</translation>
</message>
<message>
<location line="-2"/>
<source>Invalid -tor address: '%s'</source>
<translation>Ongeldig-tor adres: '%s'</translation>
</message>
<message>
<location line="+4"/>
<source>Invalid amount for -reservebalance=<amount></source>
<translation>Ongeldig bedrag voor -reservebalance = <bedrag></translation>
</message>
<message>
<location line="-89"/>
<source>Maximum per-connection receive buffer, <n>*1000 bytes (default: 5000)</source>
<translation>Maximum per-connectie ontvangstbuffer, <n>*1000 bytes (standaard: 5000)</translation>
</message>
<message>
<location line="+1"/>
<source>Maximum per-connection send buffer, <n>*1000 bytes (default: 1000)</source>
<translation>Maximum per-connectie zendbuffer, <n>*1000 bytes (standaard: 1000)</translation>
</message>
<message>
<location line="-16"/>
<source>Only connect to nodes in network <net> (IPv4, IPv6 or Tor)</source>
<translation>Verbind alleen naar nodes in netwerk <net> (IPv4, IPv6 of Tor)</translation>
</message>
<message>
<location line="+30"/>
<source>Prepend debug output with timestamp</source>
<translation>Voeg een tijdstempel toe aan debug output</translation>
</message>
<message>
<location line="+40"/>
<source>SSL options: (see the Bitcoin Wiki for SSL setup instructions)</source>
<translation>SSL-opties: (zie de Bitcoin wiki voor SSL-instructies)</translation>
</message>
<message>
<location line="-38"/>
<source>Send trace/debug info to console instead of debug.log file</source>
<translation>Stuur trace/debug-info naar de console in plaats van het debug.log bestand</translation>
</message>
<message>
<location line="+34"/>
<source>Set maximum block size in bytes (default: 250000)</source>
<translation>Stel maximale block grootte in bytes in (standaard: 250000)</translation>
</message>
<message>
<location line="-1"/>
<source>Set minimum block size in bytes (default: 0)</source>
<translation>Stel minimum blokgrootte in in bytes (standaard: 0)</translation>
</message>
<message>
<location line="-34"/>
<source>Shrink debug.log file on client startup (default: 1 when no -debug)</source>
<translation>Verklein debug.log-bestand bij het opstarten van de client (standaard: 1 als geen -debug)</translation>
</message>
<message>
<location line="-41"/>
<source>Specify connection timeout in milliseconds (default: 5000)</source>
<translation>Specificeer de time-outtijd in milliseconden (standaard: 5000)</translation>
</message>
<message>
<location line="+28"/>
<source>Use UPnP to map the listening port (default: 0)</source>
<translation>Gebruik UPnP om de luisterende poort te mappen (standaard: 0)</translation>
</message>
<message>
<location line="-1"/>
<source>Use UPnP to map the listening port (default: 1 when listening)</source>
<translation>Gebruik UPnP om de luisterende poort te mappen (standaard: 1 als er wordt geluisterd)</translation>
</message>
<message>
<location line="-25"/>
<source>Use proxy to reach tor hidden services (default: same as -proxy)</source>
<translation>Gebruik proxy tor verborgen diensten (standaard: zelfde als -proxy)</translation>
</message>
<message>
<location line="+45"/>
<source>Username for JSON-RPC connections</source>
<translation>Gebruikersnaam voor <API key></translation>
</message>
<message>
<location line="+54"/>
<source>Verifying database integrity...</source>
<translation>Database integriteit wordt geverifieërd</translation>
</message>
<message>
<location line="+42"/>
<source>Error: Wallet locked, unable to create transaction!</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Error: This transaction requires a transaction fee of at least %s because of its amount, complexity, or use of recently received funds!</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Error: Transaction creation failed!</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Error: The transaction was rejected! This might happen if some of the coins in your wallet were already spent, such as if you used a copy of wallet.dat and coins were spent in the copy but not marked as spent here.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Warning</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Information</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Warning: This version is obsolete, upgrade required!</source>
<translation>Waarschuwing: Deze versie is verouderd, een upgrade is vereist!</translation>
</message>
<message>
<location line="-52"/>
<source>wallet.dat corrupt, salvage failed</source>
<translation>wallet.dat corrupt, veiligstellen mislukt</translation>
</message>
<message>
<location line="-59"/>
<source>Password for JSON-RPC connections</source>
<translation>Wachtwoord voor <API key></translation>
</message>
<message>
<location line="-47"/>
<source>Connect through SOCKS5 proxy</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+17"/>
<source>Sync time with other nodes. Disable if time on your system is precise e.g. syncing with NTP (default: 1)</source>
<translation>Synchroniseer tijd met andere connecties. Uitschakelen als de tijd op uw systeem nauwkeurig is bijv. synchroniseren met NTP (standaard: 1)</translation>
</message>
<message>
<location line="+12"/>
<source>When creating transactions, ignore inputs with value less than this (default: 0.01)</source>
<translation>Bij het maken van transacties, negeer ingangen met waarde minder dan dit (standaard: 0,01)</translation>
</message>
<message>
<location line="+6"/>
<source>Output debugging information (default: 0, supplying <category> is optional)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>If <category> is not supplied, output all debugging information.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source><category> can be:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+4"/>
<source>Enter regression test mode, which uses a special chain in which blocks can be solved instantly. This is intended for regression testing tools and app development.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+8"/>
<source>Allow JSON-RPC connections from specified IP address</source>
<translation>Sta JSON-RPC verbindingen van opgegeven IP-adres toe</translation>
</message>
<message>
<location line="+1"/>
<source>Send commands to node running on <ip> (default: 127.0.0.1)</source>
<translation>Verstuur commando's naar proces dat op <ip> draait (standaard: 127.0.0.1)</translation>
</message>
<message>
<location line="+1"/>
<source>Wait for RPC server to start</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Set the number of threads to service RPC calls (default: 4)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Execute command when the best block changes (%s in cmd is replaced by block hash)</source>
<translation>Voer commando uit zodra het beste blok verandert (%s in cmd wordt vervangen door blockhash)</translation>
</message>
<message>
<location line="+3"/>
<source>Execute command when a wallet transaction changes (%s in cmd is replaced by TxID)</source>
<translation>Voer opdracht uit zodra een <API key> verandert (%s in cmd wordt vervangen door TxID)</translation>
</message>
<message>
<location line="+3"/>
<source>Require a confirmations for change (default: 0)</source>
<translation>Vereist een bevestiging voor verandering (standaard: 0)</translation>
</message>
<message>
<location line="+2"/>
<source>Execute command when a relevant alert is received (%s in cmd is replaced by message)</source>
<translation>Voer opdracht uit zodra een relevante waarschuwing wordt ontvangen (%s in cmd wordt vervangen door bericht)</translation>
</message>
<message>
<location line="+3"/>
<source>Upgrade wallet to latest format</source>
<translation>Vernieuw portemonnee naar nieuwste versie</translation>
</message>
<message>
<location line="+1"/>
<source>Set key pool size to <n> (default: 100)</source>
<translation>Stel sleutelpoelgrootte in op <n> (standaard: 100)</translation>
</message>
<message>
<location line="+1"/>
<source>Rescan the block chain for missing wallet transactions</source>
<translation>Doorzoek de blokketen op ontbrekende <API key></translation>
</message>
<message>
<location line="+3"/>
<source>How thorough the block verification is (0-6, default: 1)</source>
<translation>Hoe grondig het blokverificatie is (0-6, standaard: 1)</translation>
</message>
<message>
<location line="+1"/>
<source>Imports blocks from external blk000?.dat file</source>
<translation>Importeer blokken van extern blk000?.dat bestand</translation>
</message>
<message>
<location line="+1"/>
<source>Keep at most <n> MiB of unconnectable blocks in memory (default: %u)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+8"/>
<source>Use OpenSSL (https) for JSON-RPC connections</source>
<translation>Gebruik OpenSSL (https) voor <API key></translation>
</message>
<message>
<location line="+1"/>
<source>Server certificate file (default: server.cert)</source>
<translation>Certificaat-bestand voor server (standaard: server.cert)</translation>
</message>
<message>
<location line="+1"/>
<source>Server private key (default: server.pem)</source>
<translation>Geheime sleutel voor server (standaard: server.pem)</translation>
</message>
<message>
<location line="+5"/>
<source>Error: Unsupported argument -socks found. Setting SOCKS version isn't possible anymore, only SOCKS5 proxies are supported.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+8"/>
<source>Initialization sanity check failed. IadixCoin is shutting down.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+20"/>
<source>Error loading block database</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+28"/>
<source>Error: Wallet unlocked for staking only, unable to create transaction.</source>
<translation>Fout: Portemonnee ontgrendeld voor alleen staking, niet in staat om de transactie te maken.</translation>
</message>
<message>
<location line="+16"/>
<source>Error: Disk space is low!</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>This is a pre-release test build - use at your own risk - do not use for mining or merchant applications</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-168"/>
<source>This help message</source>
<translation>Dit helpbericht</translation>
</message>
<message>
<location line="+104"/>
<source>Wallet %s resides outside data directory %s.</source>
<translation>Portemonnee %s bevindt zich buiten de datamap %s.</translation>
</message>
<message>
<location line="+35"/>
<source>Unable to bind to %s on this computer (bind returned error %d, %s)</source>
<translation>Niet in staat om aan %s te binden op deze computer (bind gaf error %d, %s)</translation>
</message>
<message>
<location line="-129"/>
<source>Allow DNS lookups for -addnode, -seednode and -connect</source>
<translation>Sta DNS-naslag toe voor -addnode, -seednode en -connect</translation>
</message>
<message>
<location line="+125"/>
<source>Loading addresses...</source>
<translation>Adressen aan het laden...</translation>
</message>
<message>
<location line="-10"/>
<source>Error loading wallet.dat: Wallet corrupted</source>
<translation>Fout bij laden wallet.dat: Portemonnee corrupt</translation>
</message>
<message>
<location line="+4"/>
<source>Error loading wallet.dat: Wallet requires newer version of IadixCoin</source>
<translation>Fout bij laden van wallet.dat: Portemonnee vereist een nieuwere versie van IadixCoin</translation>
</message>
<message>
<location line="+1"/>
<source>Wallet needed to be rewritten: restart IadixCoin to complete</source>
<translation>Portemonnee moet herschreven worden: herstart IadixCoin om te voltooien</translation>
</message>
<message>
<location line="+1"/>
<source>Error loading wallet.dat</source>
<translation>Fout bij laden wallet.dat</translation>
</message>
<message>
<location line="-15"/>
<source>Invalid -proxy address: '%s'</source>
<translation>Ongeldig -proxy adres: '%s'</translation>
</message>
<message>
<location line="-1"/>
<source>Unknown network specified in -onlynet: '%s'</source>
<translation>Onbekend netwerk gespecificeerd in -onlynet: '%s'</translation>
</message>
<message>
<location line="+3"/>
<source>Cannot resolve -bind address: '%s'</source>
<translation>Kan -bind adres niet herleiden: '%s'</translation>
</message>
<message>
<location line="+2"/>
<source>Cannot resolve -externalip address: '%s'</source>
<translation>Kan -externlip adres niet herleiden: '%s'</translation>
</message>
<message>
<location line="-22"/>
<source>Invalid amount for -paytxfee=<amount>: '%s'</source>
<translation>Ongeldig bedrag voor -paytxfee=<bedrag>: '%s'</translation>
</message>
<message>
<location line="+58"/>
<source>Sending...</source>
<translation>Versturen...</translation>
</message>
<message>
<location line="+5"/>
<source>Invalid amount</source>
<translation>Ongeldig bedrag</translation>
</message>
<message>
<location line="+1"/>
<source>Insufficient funds</source>
<translation>Ontoereikend saldo</translation>
</message>
<message>
<location line="-40"/>
<source>Loading block index...</source>
<translation>Blokindex aan het laden...</translation>
</message>
<message>
<location line="-109"/>
<source>Add a node to connect to and attempt to keep the connection open</source>
<translation>Voeg een node om naar te verbinden toe en probeer de verbinding open te houden</translation>
</message>
<message>
<location line="+124"/>
<source>Unable to bind to %s on this computer. IadixCoin is probably already running.</source>
<translation>Niet mogelijk om %s op deze computer. IadixCoin is waarschijnlijk al geopened.</translation>
</message>
<message>
<location line="-101"/>
<source>Fee per KB to add to transactions you send</source>
<translation>Vergoeding per KB toe te voegen aan de transacties die u verzendt</translation>
</message>
<message>
<location line="+33"/>
<source>Minimize weight consumption (experimental) (default: 0)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+8"/>
<source>How many blocks to check at startup (default: 500, 0 = all)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+14"/>
<source>Acceptable ciphers (default: TLSv1.2+HIGH:TLSv1+HIGH:!SSLv2:!aNULL:!eNULL:!3DES:@STRENGTH)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Warning: Deprecated argument -debugnet ignored, use -debug=net</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+8"/>
<source>Invalid amount for -mininput=<amount>: '%s'</source>
<translation>Ongeldig bedrag voor -mininput = <bedrag>: '%s'</translation>
</message>
<message>
<location line="+3"/>
<source>Cannot obtain a lock on data directory %s. IadixCoin is probably already running.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+4"/>
<source>Error initializing wallet database environment %s!</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+15"/>
<source>Loading wallet...</source>
<translation>Portemonnee aan het laden...</translation>
</message>
<message>
<location line="+8"/>
<source>Cannot downgrade wallet</source>
<translation>Kan portemonnee niet downgraden</translation>
</message>
<message>
<location line="+1"/>
<source>Cannot write default address</source>
<translation>Kan standaardadres niet schrijven</translation>
</message>
<message>
<location line="+1"/>
<source>Rescanning...</source>
<translation>Blokketen aan het doorzoeken...</translation>
</message>
<message>
<location line="+2"/>
<source>Done loading</source>
<translation>Klaar met laden</translation>
</message>
<message>
<location line="-159"/>
<source>To use the %s option</source>
<translation>Om de %s optie te gebruiken</translation>
</message>
<message>
<location line="+186"/>
<source>Error</source>
<translation>Fout</translation>
</message>
<message>
<location line="-18"/>
<source>You must set rpcpassword=<password> in the configuration file:
%s
If the file does not exist, create it with owner-readable-only file permissions.</source>
<translation>U dient rpcpassword=<wachtwoord> in te stellen in het configuratiebestand:
%s
Als het bestand niet bestaat, maak het dan aan, met een alleen-lezen permissie.</translation>
</message>
</context>
</TS>
|
package org.mdo.storyline.character.config;
import com.codahale.metrics.MetricRegistry;
import com.codahale.metrics.servlet.InstrumentedFilter;
import com.codahale.metrics.servlets.MetricsServlet;
import org.mdo.storyline.character.web.filter.<API key>;
import org.mdo.storyline.character.web.filter.<API key>;
import org.mdo.storyline.character.web.filter.gzip.GZipServletFilter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.context.embedded.<API key>;
import org.springframework.boot.context.embedded.<API key>;
import org.springframework.boot.context.embedded.MimeMappings;
import org.springframework.boot.context.embedded.<API key>;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.Environment;
import javax.inject.Inject;
import javax.servlet.*;
import java.util.Arrays;
import java.util.EnumSet;
import java.util.HashMap;
import java.util.Map;
/**
* Configuration of web application with Servlet 3.0 APIs.
*/
@Configuration
@AutoConfigureAfter(CacheConfiguration.class)
public class WebConfigurer implements <API key>, <API key> {
private final Logger log = LoggerFactory.getLogger(WebConfigurer.class);
@Inject
private Environment env;
@Inject
private MetricRegistry metricRegistry;
@Override
public void onStartup(ServletContext servletContext) throws ServletException {
log.info("Web application configuration, using profiles: {}", Arrays.toString(env.getActiveProfiles()));
EnumSet<DispatcherType> disps = EnumSet.of(DispatcherType.REQUEST, DispatcherType.FORWARD, DispatcherType.ASYNC);
initMetrics(servletContext, disps);
if (env.acceptsProfiles(Constants.<API key>)) {
<API key>(servletContext, disps);
<API key>(servletContext, disps);
}
initGzipFilter(servletContext, disps);
log.info("Web application fully configured");
}
/**
* Set up Mime types.
*/
@Override
public void customize(<API key> container) {
MimeMappings mappings = new MimeMappings(MimeMappings.DEFAULT);
mappings.add("html", "text/html;charset=utf-8");
mappings.add("json", "text/html;charset=utf-8");
container.setMimeMappings(mappings);
}
/**
* Initializes the GZip filter.
*/
private void initGzipFilter(ServletContext servletContext, EnumSet<DispatcherType> disps) {
log.debug("Registering GZip Filter");
FilterRegistration.Dynamic compressingFilter = servletContext.addFilter("gzipFilter", new GZipServletFilter());
Map<String, String> parameters = new HashMap<>();
compressingFilter.setInitParameters(parameters);
compressingFilter.<API key>(disps, true, "*.css");
compressingFilter.<API key>(disps, true, "*.json");
compressingFilter.<API key>(disps, true, "*.html");
compressingFilter.<API key>(disps, true, "*.js");
/**
* Initializes the static resources production Filter.
*/
private void <API key>(ServletContext servletContext,
EnumSet<DispatcherType> disps) {
log.debug("Registering static resources production Filter");
FilterRegistration.Dynamic <API key> =
servletContext.addFilter("<API key>",
new <API key>());
<API key>.<API key>(disps, true, "/");
<API key>.<API key>(disps, true, "/index.html");
/**
* Initializes the cachig HTTP Headers Filter.
*/
private void <API key>(ServletContext servletContext,
EnumSet<DispatcherType> disps) {
log.debug("Registering Caching HTTP Headers Filter");
FilterRegistration.Dynamic <API key> =
servletContext.addFilter("<API key>",
new <API key>());
/**
* Initializes Metrics.
*/
private void initMetrics(ServletContext servletContext, EnumSet<DispatcherType> disps) {
log.debug("Initializing Metrics registries");
servletContext.setAttribute(InstrumentedFilter.REGISTRY_ATTRIBUTE,
metricRegistry);
servletContext.setAttribute(MetricsServlet.METRICS_REGISTRY,
metricRegistry);
log.debug("Registering Metrics Filter");
FilterRegistration.Dynamic metricsFilter = servletContext.addFilter("webappMetricsFilter",
new InstrumentedFilter());
|
;(function(){
'use strict';
angular.module('TTT')
.config(function($routeProvider){
$routeProvider
.when('/emu',{
templateUrl: 'views/emu.html',
controller: 'emuController',
controllerAs: 'emu'
});
});
})();
|
/**google fonts **/
@import url(https://fonts.googleapis.com/css?family=Montserrat:400,700);
@import url(https://fonts.googleapis.com/css?family=Josefin+Sans:400,700);
@import url(https://fonts.googleapis.com/css?family=Open+Sans:400,300,300italic,400italic,600);
/**variables for one page template**/
html, body {
height: 100%;
}
body {
font-family: "Roboto", sans-serif;
line-height: 26px;
color: #4D4D4D;
font-weight: 400;
font-size: 13px;
-<API key>: antialiased;
-<API key>: 100%;
-ms-text-size-adjust: 100%;
/* overflow-x: hidden;*/
}
h1, h2, h3, h4, h5, h6 {
margin-top: 0px;
font-family: "Montserrat", sans-serif;
}
a {
text-decoration: none;
-moz-transition: 0.3s;
-o-transition: 0.3s;
-webkit-transition: 0.3s;
transition: 0.3s;
color: #32c5d2;
}
a:hover, a:focus, button:focus, .btn, button {
border: 0px;
outline: 0 !important;
text-decoration: none;
color: #aeaeae;
}
.margin-b-10 {
margin-bottom: 10px;
}
.margin-b-20 {
margin-bottom: 20px;
}
.margin-b-30 {
margin-bottom: 20px;
}
.space-20 {
height: 20px;
width: 100%;
}
.space-30 {
height: 30px;
width: 100%;
}
.space-40 {
height: 40px;
width: 100%;
}
.space-50 {
height: 50px;
width: 100%;
}
.colored-text {
color: #32c5d2;
}
.btn {
font-family: "Montserrat", sans-serif;
text-transform: uppercase;
font-weight: 400;
-<API key>: 0px;
-moz-border-radius: 0px;
-ms-border-radius: 0px;
border-radius: 0px;
font-size: 13px;
-moz-transition: all 0.4s;
-o-transition: all 0.4s;
-webkit-transition: all 0.4s;
transition: all 0.4s;
}
.btn i {
margin-left: 6px;
}
.btn-lg {
font-size: 14px;
padding: 12px 25px;
}
.btn-radius {
-<API key>: 30px;
-moz-border-radius: 30px;
-ms-border-radius: 30px;
border-radius: 30px;
}
.btn-primary {
background-color: #32c5d2;
color: #fff;
}
.btn-primary:hover, .btn-primary:focus {
background-color: #333;
color: #fff;
}
.btn-white-border {
background-color: transparent;
border: 2px solid #fff;
color: #fff;
}
.btn-white-border:hover, .btn-white-border:focus {
color: #333;
background-color: #fff;
border: 2px solid #fff;
}
.btn-default {
border: 1px solid #eee;
color: #777;
}
.btn-default:hover, .btn-default:focus {
background-color: #333;
color: #fff;
border: 1px solid #333;
}
/**center title**/
.center-title {
padding-bottom: 40px;
text-align: center;
}
.center-title h3 {
text-transform: uppercase;
font-weight: 700;
color: #000;
font-size: 36px;
line-height: 40px;
letter-spacing: -1px;
}
.center-title p {
font-family: "Josefin Sans", sans-serif;
font-weight: 700;
text-transform: uppercase;
margin-bottom: 0px;
}
.center-title .center-line {
width: 40px;
height: 3px;
display: block;
background-color: #32c5d2;
margin: 0 auto;
margin-bottom: 5px;
}
/*progress bar*/
h3.heading-progress {
font-size: 12px;
font-weight: 400;
margin-bottom: 6px;
margin-top: 10px;
text-transform: uppercase;
color: #777;
}
.progress {
height: 5px;
line-height: 5px;
-webkit-box-shadow: none;
-moz-box-shadow: none;
-ms-box-shadow: none;
box-shadow: none;
background: #E9E9E9;
-<API key>: 0;
-moz-border-radius: 0;
-ms-border-radius: 0;
border-radius: 0;
}
.progress-bar {
line-height: 5px;
background: #32c5d2;
-webkit-box-shadow: none;
-moz-box-shadow: none;
-ms-box-shadow: none;
box-shadow: none;
}
.navbar-default {
background-color: #fff;
border: 0px;
border-bottom: 2px solid #f5f5f5;
padding: 10px 0;
z-index: 9999 !important;
margin-bottom: 0px;
width: 100%;
-moz-transition: all 0.4s;
-o-transition: all 0.4s;
-webkit-transition: all 0.4s;
transition: all 0.4s;
}
.navbar-default .navbar-nav > li > a {
color: #333;
font-family: "Montserrat", sans-serif;
text-transform: uppercase;
font-weight: 600;
font-size: 13px;
}
.navbar-default .navbar-nav > .open > a, .navbar-default .navbar-nav > .open > a:focus, .navbar-default .navbar-nav > .open > a:hover {
color: #32c5d2;
background-color: transparent;
}
.navbar-default .navbar-nav > .active > a, .navbar-default .navbar-nav > .active > a:focus, .navbar-default .navbar-nav > .active > a:hover {
color: #32c5d2;
background-color: transparent;
}
/***dropdown***/
.nav > li > span {
position: relative;
display: block;
padding: 10px 15px;
cursor: pointer;
color: #333;
font-family: "Montserrat", sans-serif;
text-transform: uppercase;
font-weight: 600;
margin-top: -3px;
font-size: 13px;
}
.nav > li > span:hover {
color: #32c5d2;
}
@media (min-width: 768px) {
.navbar-nav > li > span {
padding-top: 15px;
padding-bottom: 15px;
}
.nav > li > a, .nav > li > span {
padding-left: 10px;
padding-right: 10px;
}
}
.navbar-right {
margin-right: 40px;
}
.side-panel.navbar-toggle {
display: block;
color: #333;
border: 0px;
padding: 0px;
position: relative;
margin-top: -40px;
}
.side-panel.navbar-toggle:hover {
background-color: transparent;
}
.side-panel-inner {
padding: 20px 25px;
}
@media (max-width: 767px) {
.side-panel.navbar-toggle {
right: 40px;
position: absolute;
top: 63px;
font-size: 20px;
}
.navbar-default .navbar-toggle {
border: 0px;
}
}
.navbar-default .side-panel.navbar-toggle:focus, .navbar-default .navbar-toggle:hover {
background-color: transparent;
}
.navmenu-default, .navbar-default .navbar-offcanvas {
background-color: #f5f5f5;
border: 0px;
}
.fullwidthbanner .title {
color: #fff;
font-size: 70px;
font-family: "Montserrat", sans-serif;
font-weight: 700;
text-transform: uppercase;
}
.fullwidthbanner .subtitle {
color: #fff;
}
.fullwidthbanner .btn-white-border {
color: #fff;
font-size: 14px;
padding: 12px 30px;
}
.fullwidthbanner .btn-white-border:hover {
color: #333;
border: 2px solid #fff;
}
#about {
padding-top: 100px;
padding-bottom: 50px;
background-color: #ffff;
}
.about-quote p {
margin: 0px;
}
.about-quote em {
display: block;
margin: 20px 0;
margin-top: 10px;
color: #32c5d2;
}
.person-col {
overflow: hidden;
position: relative;
}
.person-col img {
width: 100%;
}
.person-col .person-overlay {
position: absolute;
left: 0;
right: 0;
bottom: 0;
top: 100%;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.8);
padding: 30px;
-moz-transition: all 0.4s;
-o-transition: all 0.4s;
-webkit-transition: all 0.4s;
transition: all 0.4s;
}
.person-col .person-overlay h3 {
color: #fff;
margin-bottom: 5px;
text-transform: capitalize;
}
.person-col .person-overlay p {
color: #fff;
}
.person-col:hover .person-overlay {
top: 0;
}
.numbers {
background: url(../img/showcase-5.jpg) no-repeat;
<API key>: fixed;
background-size: cover;
padding-top: 100px;
padding-bottom: 70px;
position: relative;
overflow: hidden;
width: 100%;
background-position: 0 50%;
}
.numbers h1 {
color: #fff;
margin: 15px 0;
}
.numbers i {
color: #fff;
font-size: 20px;
}
.numbers p {
color: #fff;
margin: 0px;
font-family: "Josefin Sans", sans-serif;
text-transform: uppercase;
font-weight: 400;
}
#services {
padding-top: 100px;
padding-bottom: 50px;
background-color: #f5f5f5;
}
.special-feature .section-title hr {
border-color: #333;
}
.special-feature i {
font-size: 65px;
line-height: 75px;
color: #32c5d2;
}
.special-feature h4 {
font-size: 16px;
margin-top: 25px;
position: relative;
text-transform: uppercase;
font-weight: 700;
color: #777;
}
.special-feature .mask-top {
width: 100%;
background-color: #fff;
padding: 55px 0;
position: absolute;
top: 0px;
-moz-transition: all 0.3s ease-out 0s;
-o-transition: all 0.3s ease-out 0s;
-webkit-transition: all 0.3s ease-out 0s;
transition: all 0.3s ease-out 0s;
}
.special-feature .mask-top h4:before {
top: -18px;
content: "";
display: block;
height: 2px;
left: 0;
right: 0;
margin: -2px auto;
position: absolute;
width: 40px;
}
.special-feature .s-feature-box:hover .mask-top {
top: -200px;
-moz-transition: all 0.3s ease-out 0s;
-o-transition: all 0.3s ease-out 0s;
-webkit-transition: all 0.3s ease-out 0s;
transition: all 0.3s ease-out 0s;
}
.special-feature .s-feature-box {
overflow: hidden;
position: relative;
height: 280px;
background-color: #fff;
margin-bottom: 20px;
cursor: pointer;
}
.special-feature .mask-bottom {
color: #333333;
padding: 20px 15px 20px 15px;
background-color: #fff;
width: 100%;
position: absolute;
bottom: -300px;
height: 100%;
-moz-transition: all 0.3s ease-out 0s;
-o-transition: all 0.3s ease-out 0s;
-webkit-transition: all 0.3s ease-out 0s;
transition: all 0.3s ease-out 0s;
}
.special-feature .mask-bottom p {
padding: 0px 5px;
font-size: 13px;
}
.special-feature .mask-bottom h4 {
margin: 15px 0px 17px;
}
.special-feature .s-feature-box:hover .mask-bottom {
bottom: 0;
-moz-transition: all 0.3s ease-out 0s;
-o-transition: all 0.3s ease-out 0s;
-webkit-transition: all 0.3s ease-out 0s;
transition: all 0.3s ease-out 0s;
}
.special-feature .mask-bottom i {
font-size: 38px;
line-height: 50px;
}
/**social icons default size**/
.social-icon {
margin: 0 5px 5px 0;
width: 40px;
height: 40px;
font-size: 20px;
line-height: 40px !important;
color: #555;
text-shadow: none;
border-radius: 3px;
overflow: hidden;
display: inline-block;
text-align: center;
border: 1px solid #AAA;
}
.social-icon:hover {
border-color: transparent;
}
.social-icon i {
display: block;
-moz-transition: all 0.3s ease;
-o-transition: all 0.3s ease;
-webkit-transition: all 0.3s ease;
transition: all 0.3s ease;
line-height: 40px;
position: relative;
}
.social-icon i:last-child {
color: #FFF !important;
}
.social-icon:hover i:first-child {
margin-top: -40px;
}
/***social icons lg (big)***/
.social-icon-lg {
margin: 0 5px 5px 0;
width: 60px;
height: 60px;
font-size: 30px;
line-height: 60px !important;
color: #555;
text-shadow: none;
border-radius: 3px;
overflow: hidden;
display: inline-block;
text-align: center;
border: 1px solid #AAA;
}
.social-icon-lg:hover {
border-color: transparent;
}
.social-icon-lg i {
display: block;
-moz-transition: all 0.3s ease;
-o-transition: all 0.3s ease;
-webkit-transition: all 0.3s ease;
transition: all 0.3s ease;
line-height: 60px;
position: relative;
}
.social-icon-lg i:last-child {
color: #FFF !important;
}
.social-icon-lg:hover i:first-child {
margin-top: -60px;
}
/***social icons small***/
.social-icon-sm {
margin: 0 5px 5px 0;
width: 30px;
height: 30px;
font-size: 18px;
line-height: 30px !important;
color: #555;
text-shadow: none;
border-radius: 3px;
overflow: hidden;
display: inline-block;
text-align: center;
border: 1px solid #AAA;
}
.social-icon-sm:hover {
border-color: transparent;
}
.social-icon-sm i {
display: block;
-moz-transition: all 0.3s ease;
-o-transition: all 0.3s ease;
-webkit-transition: all 0.3s ease;
transition: all 0.3s ease;
line-height: 30px;
position: relative;
}
.social-icon-sm i:last-child {
color: #FFF !important;
}
.social-icon-sm:hover i:first-child {
margin-top: -30px;
}
si-border {
border: 1px solid #AAA !important;
}
.si-border-round {
-<API key>: 50%;
-moz-border-radius: 50%;
-ms-border-radius: 50%;
border-radius: 50%;
}
.si-dark-round {
-<API key>: 50%;
-moz-border-radius: 50%;
-ms-border-radius: 50%;
border-radius: 50%;
}
.si-gray-round {
-<API key>: 50%;
-moz-border-radius: 50%;
-ms-border-radius: 50%;
border-radius: 50%;
}
.si-gray {
background: #f3f3f3;
border: 0px;
}
.si-dark {
background-color: #333;
border: 0px !important;
color: #fff !important;
}
/**icons hover colored**/
.si-colored-facebook, .si-facebook:hover {
background-color: #3B5998 !important;
}
.si-colored-twitter, .si-twitter:hover {
background-color: #00ACEE !important;
}
.<API key>, .si-g-plus:hover {
background-color: #DD4B39 !important;
}
.si-colored-skype, .si-skype:hover {
background-color: #00AFF0 !important;
}
.si-linkedin:hover, .si-colored-linkedin {
background-color: #0E76A8 !important;
}
.si-pin:hover, .<API key> {
background-color: #C8232C !important;
}
.si-rss:hover, .si-colored-rss {
background-color: #EE802F !important;
}
.si-pinterest:hover, .<API key> {
background-color: #C8232C !important;
}
.si-tumblr:hover, .si-colored-tumblr {
background-color: #34526F !important;
}
.si-vimeo:hover, .si-colored-vimeo {
background-color: #86C9EF !important;
}
.si-digg:hover, .si-colored-digg {
background-color: #191919 !important;
}
.si-instagram:hover, .<API key> {
background-color: #3F729B !important;
}
.si-flickr:hover, .si-colored-flickr {
background-color: #FF0084 !important;
}
.si-paypal:hover, .si-colored-paypal {
background-color: #00588B !important;
}
.si-yahoo:hover, .si-colored-yahoo {
background-color: #720E9E !important;
}
.si-android:hover, .si-colored-andriod {
background-color: #A4C639 !important;
}
.si-appstore:hover, .si-colored-apple {
background-color: #000 !important;
}
.si-dropbox:hover {
background-color: #3D9AE8 !important;
}
.si-dribbble:hover, .si-colored-dribbble {
background-color: #EA4C89 !important;
}
.si-soundcloud:hover, .<API key> {
background-color: #F70 !important;
}
.si-xing:hover, .si-colored-xing {
background-color: #126567 !important;
}
.si-phone:hover, .si-colored-phone {
background-color: #444 !important;
}
.si-behance:hover, .si-colored-behance {
background-color: #053eff !important;
}
.si-github:hover, .si-colored-github {
background-color: #171515 !important;
}
.si-stumbleupon:hover, .<API key> {
background-color: #F74425 !important;
}
.si-email:hover, .si-colored-email {
background-color: #6567A5 !important;
}
.si-wordpress:hover, .<API key> {
background-color: #1E8CBE !important;
}
#work {
padding-top: 100px;
padding-bottom: 70px;
}
.cbp-popup-wrap {
z-index: 9999;
}
.<API key> {
font-family: "Montserrat", sans-serif;
text-transform: uppercase;
}
.<API key> {
font-family: "Roboto", sans-serif;
}
.<API key>, .<API key> {
font-family: "Montserrat", sans-serif;
text-transform: uppercase;
background-color: #32c5d2;
font-weight: 400;
-moz-transition: all 0.3s;
-o-transition: all 0.3s;
-webkit-transition: all 0.3s;
transition: all 0.3s;
}
.<API key>:hover, .<API key>:hover {
background-color: #333;
}
.<API key> .<API key> {
background-color: #333;
}
.<API key> {
background-color: #32c5d2;
text-transform: uppercase;
-<API key>: 4px;
-moz-border-radius: 4px;
-ms-border-radius: 4px;
border-radius: 4px;
font-family: "Montserrat", sans-serif;
}
.<API key> span, .<API key> span {
font-family: "Montserrat", sans-serif;
}
.<API key> > li, .<API key> > div {
font-family: "Roboto", sans-serif;
}
.<API key> {
font-family: "Roboto", sans-serif;
}
.<API key> .cbp-filter-item {
font-family: "Roboto", sans-serif;
}
.cbp-l-project-title {
font-family: "Montserrat", sans-serif;
}
.<API key> {
font-family: "Roboto", sans-serif;
}
/***
Contact section
**/
#contact {
padding-top: 100px;
padding-bottom: 70px;
}
#contact h3 {
margin-bottom: 25px;
}
.contact-form label {
font-family: "Josefin Sans", sans-serif;
color: #666;
text-transform: uppercase;
}
.contact-form .form-control {
-<API key>: 0px;
-moz-border-radius: 0px;
-ms-border-radius: 0px;
border-radius: 0px;
min-height: 45px;
border: 2px solid #f4f4f4;
-webkit-box-shadow: none;
-moz-box-shadow: none;
-ms-box-shadow: none;
box-shadow: none;
font-weight: 400;
font-size: 13px;
}
.contact-form .help-block {
margin: 0px;
}
.contact-form .help-block ul {
list-style: none;
margin: 0px;
padding: 0px;
}
.contact-form .help-block ul li {
display: block;
margin-top: 10px;
padding: 2px 10px;
font-size: 12px;
font-weight: 400;
border-left: 1px solid red;
color: red;
line-height: 10px;
}
.contact-info .media {
margin-bottom: 30px;
}
.contact-info .media-heading {
text-transform: uppercase;
font-size: 13px;
font-weight: 400;
}
.contact-info i {
width: 50px;
height: 50px;
line-height: 50px;
display: block;
text-align: center;
-<API key>: 50%;
-moz-border-radius: 50%;
-ms-border-radius: 50%;
border-radius: 50%;
background-color: #32c5d2;
font-size: 20px;
color: #fff;
margin-right: 15px;
}
.footer {
padding: 40px 0;
padding-bottom: 20px;
background-color: #eee;
border-top: 5px solid #f5f5f5;
}
.footer h3 {
text-transform: uppercase;
font-weight: 700;
font-size: 16px;
color: #333;
margin-bottom: 25px;
}
.footer .latest-f-news li a {
color: #777;
}
.footer .latest-f-news li a:hover {
color: #32c5d2;
}
.footer .footer-btm {
color: #777;
padding-top: 20px;
border-top: 1px solid rgba(0, 0, 0, 0.1);
margin-top: 40px;
}
.assan-newsletter input[type="text"] {
height: 40px;
-webkit-box-shadow: none;
-moz-box-shadow: none;
-ms-box-shadow: none;
box-shadow: none;
-<API key>: 0px;
-moz-border-radius: 0px;
-ms-border-radius: 0px;
border-radius: 0px;
font-size: 12px;
font-weight: 400;
}
.assan-newsletter input[type="submit"] {
float: right;
margin-top: 8px;
}
/***testimonials**/
.testimonials {
padding: 80px 0;
background-color: #eee;
overflow: hidden;
}
.testimonials .testi-slide img {
margin-bottom: 20px;
-<API key>: 50%;
-moz-border-radius: 50%;
-ms-border-radius: 50%;
border-radius: 50%;
}
.testimonials .testi-slide h4 {
font-family: "Roboto", sans-serif;
font-size: 15px;
color: #32c5d2;
}
.testimonials .testi-slide .flex-control-paging li a {
-<API key>: 0px;
-moz-border-radius: 0px;
-ms-border-radius: 0px;
border-radius: 0px;
}
.testimonials .testi-slide .flex-control-paging li a.flex-active {
background: #32c5d2;
}
.pricing-tables {
padding: 70px 0;
padding-bottom: 40px;
}
/**pricing simple **/
.pricing-simple {
border: 1px solid #D0D6DF;
margin-bottom: 30px;
}
.pricing-simple h4 {
border-bottom: 1px solid #D0D6DF;
margin: 0px;
color: #666;
padding: 20px;
font-size: 20px;
text-align: center;
font-weight: 600;
text-transform: capitalize;
}
.pricing-simple h3 {
margin: 0px;
padding: 30px 20px;
border-bottom: 1px solid #D0D6DF;
font-size: 50px;
font-weight: 300;
text-align: center;
background-color: #f4f4f4;
}
.pricing-simple h3 sup, .pricing-simple h3 sub {
font-size: 13px;
color: #D0D6DF;
font-weight: 400;
}
.pricing-simple h3 sup {
vertical-align: top;
left: 10px;
}
.pricing-simple h3 sub {
vertical-align: bottom;
}
.pricing-simple ul {
padding-top: 30px;
}
.pricing-simple ul li {
padding: 6px 20px;
border-bottom: 1px solid #f5f5f5;
color: #aeaeae;
}
.pricing-simple ul li:last-child {
border-bottom: 0px;
}
.pricing-simple ul li i {
color: #32c5d2;
margin-right: 10px;
}
.pricing-simple .bottom {
padding: 20px 10px;
text-align: center;
}
.pricing-simple p {
color: #aeaeae;
padding: 15px 20px;
text-align: center;
padding-bottom: 0px;
}
.pricing-simple .circle {
width: 150px;
height: 150px;
padding: 0px 0 0;
margin: 30px auto;
margin-bottom: 0px;
display: table;
-webkit-box-shadow: 0px 0px 3px rgba(0, 0, 0, 0.5);
-moz-box-shadow: 0px 0px 3px rgba(0, 0, 0, 0.5);
-ms-box-shadow: 0px 0px 3px rgba(0, 0, 0, 0.5);
box-shadow: 0px 0px 3px rgba(0, 0, 0, 0.5);
border: 5px solid #fff;
-<API key>: 50%;
-moz-border-radius: 50%;
-ms-border-radius: 50%;
border-radius: 50%;
background-color: #f4f4f4;
}
.pricing-simple .circle .price {
text-align: center;
font-size: 30px;
display: table-cell;
vertical-align: middle;
}
.pricing-simple .circle .price sub, .pricing-simple .circle .price sup {
font-size: 13px;
color: #777;
}
.pricing-simple .circle .price sup {
vertical-align: top;
}
.pricing-simple .circle .price sub {
vertical-align: bottom;
}
.popular {
position: relative;
overflow: hidden;
}
.popular .ribbon {
position: absolute;
left: -55px;
bottom: 5px;
font-size: 11px;
text-align: center;
width: 150px;
color: #fff;
text-transform: capitalize;
padding: 1px 12px;
display: block;
-webkit-box-shadow: 1px 2px 2px rgba(0, 0, 0, 0.2);
-moz-box-shadow: 1px 2px 2px rgba(0, 0, 0, 0.2);
-ms-box-shadow: 1px 2px 2px rgba(0, 0, 0, 0.2);
box-shadow: 1px 2px 2px rgba(0, 0, 0, 0.2);
background-color: #32c5d2;
-moz-transform: rotate(45deg);
-o-transform: rotate(45deg);
-ms-transform: rotate(45deg);
-webkit-transform: rotate(45deg);
transform: rotate(45deg);
}
.no-space-pricing {
margin: 0px;
}
/**dark pricing tables**/
.pricing-simple.dark-pricing {
border: 1px solid rgba(0, 0, 0, 0.1);
background-color: #333;
}
.pricing-simple.dark-pricing h4 {
border-color: rgba(255, 255, 255, 0.1);
color: #fff;
}
.pricing-simple.dark-pricing .circle {
background-color: #444;
border-color: #333;
}
.pricing-simple.dark-pricing .circle .price {
color: #fff;
}
.pricing-simple.dark-pricing ul li {
border-bottom-color: rgba(255, 255, 255, 0.1);
}
.blog {
padding-top: 100px;
padding-bottom: 70px;
background-color: #f4f4f4;
}
.blog .item {
background-color: #fff;
padding: 15px;
margin: 0px 15px;
text-align: center;
}
.news-col img {
width: 100%;
margin-bottom: 15px;
}
.news-col h3 {
font-size: 15px;
font-weight: 400;
}
.news-col h3 a {
color: #000;
text-transform: uppercase;
}
.news-col h3 a:hover {
color: #32c5d2;
}
.news-col ul li {
font-size: 12px;
}
.news-col ul li i {
margin-right: 5px;
}
.news-col p {
margin-bottom: 20px;
}
.owl-theme .owl-controls .owl-buttons div {
padding: 0px;
-<API key>: 0px;
-moz-border-radius: 0px;
-ms-border-radius: 0px;
border-radius: 0px;
background-color: transparent;
font-size: 30px;
color: #32c5d2;
}
/**back to top**/
#back-to-top a {
display: block;
z-index: 500;
width: 40px;
height: 40px;
text-align: center;
font-size: 22px;
position: fixed;
bottom: -40px;
right: 20px;
color: #fff;
line-height: 35px;
-<API key>: 50%;
-moz-border-radius: 50%;
-ms-border-radius: 50%;
border-radius: 50%;
background-color: #32c5d2;
}
#back-to-top.show a {
bottom: 20px;
}
/**process***/
.process {
background: url(../img/showcase-4.jpg) no-repeat;
background-size: cover;
background-repeat: no-repeat;
<API key>: fixed;
padding-top: 150px;
padding-bottom: 120px;
}
.process .process-col {
margin-bottom: 30px;
text-align: center;
}
.process .center-title p, .process .center-title h3 {
color: #fff;
}
.process .center-line {
background-color: #fff;
}
.process i {
display: block;
margin: 0 auto;
width: 100px;
height: 100px;
line-height: 100px;
text-align: center;
font-size: 50px;
color: #fff;
-<API key>: 50%;
-moz-border-radius: 50%;
-ms-border-radius: 50%;
border-radius: 50%;
border: 1px dashed #fff;
}
.process h4 {
font-weight: 400;
color: #fff;
text-transform: uppercase;
margin-bottom: 0px;
margin-top: 15px;
}
/**cta**/
.call-to-action {
background: url(../img/showcase-4.jpg) no-repeat;
background-size: cover;
background-repeat: no-repeat;
<API key>: fixed;
padding-top: 150px;
padding-bottom: 150px;
}
.call-to-action h1 {
color: #fff;
text-transform: uppercase;
}
.call-to-action .subtitle {
color: #fff;
font-size: 18px;
margin-bottom: 20px;
font-family: "Josefin Sans", sans-serif;
}
/***self hosted video css***/
/**video css new**/
.video-section {
width: 100%;
height: 100%;
position: relative;
display: table;
overflow: hidden;
}
.video-section .overlay {
background-color: rgba(0, 0, 0, 0.6);
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
z-index: 1;
}
.video-section .<API key> {
left: 0;
}
.video-section .video-overlay {
position: relative;
top: 0;
left: 0;
width: 100%;
height: 100%;
display: table-cell;
vertical-align: middle;
text-align: center;
z-index: 2;
}
.video-section .video-overlay h1 {
font-weight: 700;
color: #fff;
font-size: 70px;
line-height: 70px;
margin-bottom: 0px;
text-transform: capitalize;
}
.video-section .video-overlay p {
color: #fff;
margin-bottom: 25px;
margin-top: 20px;
}
@media (max-width: 767px) {
.process, .numbers, .call-to-action {
<API key>: scroll !important;
background-size: cover !important;
background-position: center center !important;
}
}
|
<!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.9.1"/>
<title>V8 API Reference Guide for node.js v0.1.4: Member List</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
$(document).ready(function() { init_search(); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td style="padding-left: 0.5em;">
<div id="projectname">V8 API Reference Guide for node.js v0.1.4
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.9.1 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main Page</span></a></li>
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
<li class="current"><a href="annotated.html"><span>Classes</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
<li><a href="examples.html"><span>Examples</span></a></li>
<li>
<div id="MSearchBox" class="MSearchBoxInactive">
<span class="left">
<img id="MSearchSelect" src="search/mag_sel.png"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
alt=""/>
<input type="text" id="MSearchField" value="Search" accesskey="S"
onfocus="searchBox.OnSearchFieldFocus(true)"
onblur="searchBox.OnSearchFieldFocus(false)"
onkeyup="searchBox.OnSearchFieldChange(event)"/>
</span><span class="right">
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
</span>
</div>
</li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="annotated.html"><span>Class List</span></a></li>
<li><a href="classes.html"><span>Class Index</span></a></li>
<li><a href="hierarchy.html"><span>Class Hierarchy</span></a></li>
<li><a href="functions.html"><span>Class Members</span></a></li>
</ul>
</div>
<!-- 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 id="nav-path" class="navpath">
<ul>
<li class="navelem"><a class="el" href="namespacev8.html">v8</a></li><li class="navelem"><a class="el" href="classv8_1_1_string.html">String</a></li><li class="navelem"><a class="el" href="<API key>.html"><API key></a></li> </ul>
</div>
</div><!-- top -->
<div class="header">
<div class="headertitle">
<div class="title">v8::String::<API key> Member List</div> </div>
</div><!--header
<div class="contents">
<p>This is the complete list of members for <a class="el" href="<API key>.html">v8::String::<API key></a>, including all inherited members.</p>
<table class="directory">
<tr class="even"><td class="entry"><a class="el" href="<API key>.html#<API key>">data</a>() const =0</td><td class="entry"><a class="el" href="<API key>.html">v8::String::<API key></a></td><td class="entry"><span class="mlabel">pure virtual</span></td></tr>
<tr bgcolor="#f0f0f0"><td class="entry"><b><API key></b>() (defined in <a class="el" href="<API key>.html">v8::String::<API key></a>)</td><td class="entry"><a class="el" href="<API key>.html">v8::String::<API key></a></td><td class="entry"><span class="mlabel">inline</span><span class="mlabel">protected</span></td></tr>
<tr class="even"><td class="entry"><a class="el" href="<API key>.html#<API key>">length</a>() const =0</td><td class="entry"><a class="el" href="<API key>.html">v8::String::<API key></a></td><td class="entry"><span class="mlabel">pure virtual</span></td></tr>
<tr><td class="entry"><a class="el" href="<API key>.html#<API key>">~<API key></a>()</td><td class="entry"><a class="el" href="<API key>.html">v8::String::<API key></a></td><td class="entry"><span class="mlabel">inline</span><span class="mlabel">virtual</span></td></tr>
</table></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Tue Aug 11 2015 23:44:35 for V8 API Reference Guide for node.js v0.1.4 by &
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.9.1
</small></address>
</body>
</html>
|
// <API key>.h
// WangYiNEWS
#import <UIKit/UIKit.h>
@interface <API key> : <API key>
@end
|
<?php
namespace EloquentJs\ScriptGenerator\Model;
class Metadata
{
/**
* @var string
*/
public $name;
/**
* @var string
*/
public $endpoint;
/**
* @var array
*/
public $dates;
/**
* @var array
*/
public $scopes;
/**
* @var array
*/
public $relations;
/**
* @param string $name
* @param string $endpoint
* @param array $dates
* @param array $scopes
*/
public function __construct($name, $endpoint, array $dates = [], array $scopes = [], array $relations = [])
{
$this->name = $name;
$this->endpoint = $endpoint;
$this->dates = $dates;
$this->scopes = $scopes;
$this->relations = $relations;
}
}
|
body {
background: #f9f6f1;
font: 13px/1.7em 'Open Sans';
}
p {
font: 13px/1.7em 'Open Sans';
}
input,
button,
select,
textarea {
font-family: 'Open Sans';
}
h5 {
padding-left:10px;
padding-top:10px;
}
.dropdown .dropdown-menu {
-<API key>: 6px;
-moz-border-radius: 6px;
border-radius: 6px;
}
.btn-icon-only {
padding-right: 3px;
padding-left: 3px;
}
.table td {
vertical-align: middle;
}
.table-bordered th {
background: #E9E9E9;
background:-moz-linear-gradient(top, #FAFAFA 0%, #E9E9E9 100%); /* FF3.6+ */
background:-webkit-gradient(linear, left top, left bottom, color-stop(0%,#FAFAFA), color-stop(100%,#E9E9E9)); /* Chrome,Safari4+ */
background:-<API key>(top, #FAFAFA 0%,#E9E9E9 100%); /* Chrome10+,Safari5.1+ */
background:-o-linear-gradient(top, #FAFAFA 0%,#E9E9E9 100%); /* Opera11.10+ */
background:-ms-linear-gradient(top, #FAFAFA 0%,#E9E9E9 100%); /* IE10+ */
background:linear-gradient(top, #FAFAFA 0%,#E9E9E9 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#FAFAFA', endColorstr='#E9E9E9');
-ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr='#FAFAFA', endColorstr='#E9E9E9')";
font-size: 10px;
color: #444;
text-transform: uppercase;
}
.navbar .container {
position: relative;
border:none;
}
.navbar-inner {
padding: 7px 0;
margin-bottom:15px;
background: transparent !important;
border:none;
-moz-border-radius: 0;
-<API key>: 0;
border-radius: 0;
}
.navbar-fixed-top {
position: static;
border:none;
}
.nav-collapse {
margin-top:7px;
}
.navbar .nav a {
font-size: 11px;
}
.navbar .nav>li>a { color:#444 !important;font-size:14px;}
.navbar .brand {
font-weight: 900;
position: relative;
color:#444;
font-size:24px;
font: 27px 'Open Sans';
}
.navbar .search-query {
background-color: #444;
width: 150px;
font-size: 11px;
font-weight: bold;
}
.navbar .search-query::-<API key> {
color: #666;
}
.navbar .search-query:-moz-placeholder {
color: #666;
}
.navbar-search .search-query { background:#008866; border:0; color:#fff; line-height:normal;}
.subnavbar {
margin-bottom: 2.5em;
}
.subnavbar-inner {
height: 60px;
background: #fff;
}
.subnavbar .container > ul {
display: inline-block;
height: 80px;
padding: 0;
margin: 0;
}
.subnavbar .container > ul > li {
float: left;
min-width: 90px;
height: 60px;
padding: 0;
margin: 0;
text-align: center;
list-style: none;
border-left: 1px solid #d9d9d9;
}
.subnavbar .container > ul > li > a {
display: block;
height: 100%;
padding: 0 15px;
font-size: 12px;
font-weight: bold;
color: #b2afaa;
}
.subnavbar .container > ul > li > a:hover {
color: #888;
text-decoration: none;
}
.subnavbar .container > ul > li > a > i {
display: inline-block;
width: 24px;
height: 24px;
margin-top: 11px;
margin-bottom: -3px;
font-size: 20px;
}
.subnavbar .container > ul > li > a > span {
display: block;
}
.subnavbar .container > ul > li.active > a {
color: #383838;
}
.subnavbar .dropdown .dropdown-menu a {
font-size: 12px;
}
.subnavbar .dropdown .dropdown-menu {
text-align: left;
-<API key>: 0;
-<API key>: 0;
-<API key>: 0;
-<API key>: 0;
<API key>: 0;
<API key>: 0;
}
.subnavbar .dropdown-menu::before {
content: '';
display: inline-block;
border-left: 7px solid transparent;
border-right: 7px solid transparent;
border-bottom: 7px solid #CCC;
border-bottom-color: rgba(0, 0, 0, 0.2);
position: absolute;
top: -7px;
left: 9px;
}
.subnavbar .dropdown-menu::after {
content: '';
display: inline-block;
border-left: 6px solid transparent;
border-right: 6px solid transparent;
border-bottom: 6px solid white;
position: absolute;
top: -6px;
left: 10px;
}
.subnavbar .caret {
margin-top: 4px;
border-top-color: white;
border-bottom-color: white;
}
.subnavbar .dropdown.open .caret {
display: none;
}
.main {
padding-bottom: 2em;
}
.extra {
border-top: 1px solid #585858;
border-bottom: 1px solid #000;
}
.extra-inner {
padding: 20px 0;
font-size: 11px;
color: #BBB;
background: #1A1A1A;
}
.extra a {
color: #666;
}
.extra h4 {
margin-bottom: 1em;
font-weight: 400;
}
.extra ul {
padding: 0;
margin: 0;
}
.extra li {
margin-bottom: .6em;
list-style: none;
}
.footer {
margin-top: 0;
}
.footer-inner {
padding: 5px 0;
float:left;
font-size: 14px;
background: #111;
color: #999;
}
.footer a {
color: #AAA;
}
.footer a:hover {
color: #777;
text-decoration: none;
}
.widget {
position: relative;
clear: both;
width: auto;
margin-bottom: 2em;
overflow: hidden;
}
.widget-header {
position: relative;
height: 40px;
line-height: 40px;
background: #24E072;
border: 1px solid #d6d6d6;
-<API key>: padding-box;
}
.widget-header h3 {
position: relative;
top: 2px;
left: 10px;
display: inline-block;
margin-right: 3em;
font-size: 16px;
font-weight: 800;
color: #FFF;
line-height: 18px;
}
.widget-header [class^="icon-"], .widget-header [class*=" icon-"] {
display: inline-block;
margin-left: 13px;
margin-right: -2px;
font-size: 18px;
color: #FFF;
vertical-align: middle;
}
.widget-content {
padding: 20px 15px 15px;
background: #FFF;
}
.widget-header+.widget-content {
border-top: none;
-<API key>: 0;
-<API key>: 0;
-<API key>: 0;
-<API key>: 0;
<API key>: 0;
<API key>: 0;
}
.widget-nopad .widget-content {
padding: 0;
}
/* Widget Content Clearfix */
.widget-content:before,
.widget-content:after {
content:"";
display:table;
}
.widget-content:after {
clear:both;
}
/* For IE 6/7 (trigger hasLayout) */
.widget-content {
zoom:1;
}
/* Widget Table */
.widget-table .widget-content {
padding: 0;
}
.widget-table .table {
margin-bottom: 0;
border: none;
}
.widget-table .table tr td:first-child {
border-left: none;
}
.widget-table .table tr th:first-child {
border-left: none;
}
/* Widget Plain */
.widget-plain {
background: transparent;
border: none;
}
.widget-plain .widget-content {
padding: 0;
background: transparent;
border: none;
}
/* Widget Box */
.widget-box {
}
.widget-box .widget-content {
background: #E3E3E3;
background: #FFF;
}
.error-container {
margin-top: 4em;
margin-bottom: 4em;
text-align: center;
}
.error-container h1 {
margin-bottom: .5em;
font-size: 120px;
line-height: 1em;
}
.error-container h2 {
margin-bottom: .75em;
font-size: 28px;
}
.error-container .error-details {
margin-bottom: 1.5em;
font-size: 16px;
}
.error-container .error-actions a {
margin: 0 .5em;
}
/* Message layout */
ul.messages_layout {
position: relative;
margin: 0;
padding: 0
}
ul.messages_layout li {
float: left;
list-style: none;
position: relative
}
ul.messages_layout li.left {
padding-left: 75px
}
ul.messages_layout li.right {
padding-right: 75px
}
ul.messages_layout li.right .avatar {
right: 0;
left: auto
}
ul.messages_layout li.right .message_wrap .arrow {
right: -12px;
left: auto;
background-position: 0 -213px;
height: 15px;
width: 12px
}
ul.messages_layout li.by_myself .message_wrap {
border: 1px solid #b3cdf8
}
ul.messages_layout li.by_myself .message_wrap .info a.name {
color: #4a8cf7
}
ul.messages_layout li a.avatar {
position: absolute;
left: 0;
top: 0
}
ul.messages_layout li a.avatar img {
-<API key>: 5px;
-moz-border-radius: 5px;
border-radius: 5px
}
ul.messages_layout li .message_wrap {
-<API key>: 3px;
-moz-border-radius: 3px;
border-radius: 3px;
position: relative;
border: 1px solid #e9e9e9;
padding: 10px;
border: 1px solid #cbcbcb;
margin-bottom: 20px;
float: left;
background: #fefefe;
-webkit-box-shadow: rgba(0,0,0,0.1) 0 1px 0px;
-moz-box-shadow: rgba(0,0,0,0.1) 0 1px 0px;
box-shadow: rgba(0,0,0,0.1) 0 1px 0px
}
ul.messages_layout li .message_wrap .arrow {
background-position: 0 -228px;
height: 15px;
width: 12px;
height: 15px;
width: 12px;
position: absolute;
left: -12px;
top: 13px
}
ul.messages_layout li .message_wrap .info {
float: left;
width: 100%;
border-bottom: 1px solid #fff;
line-height: 23px
}
ul.messages_layout li .message_wrap .info .name {
float: left;
font-weight: bold;
color: #483734
}
ul.messages_layout li .message_wrap .info .time {
float: left;
font-size: 11px;
margin-left: 6px
}
ul.messages_layout li .message_wrap .text {
float: left;
width: 100%;
border-top: 1px solid #cfcfcf;
padding-top: 5px
}
ul.messages_layout .dropdown-menu li{ width:100%; font-size:11px;}
/* Full Calendar */
.fc {
direction: ltr;
text-align: left;
position: relative
}
.fc table {
border-collapse: collapse;
border-spacing: 0
}
html .fc, .fc table {
font-size: 1em
}
.fc td, .fc th {
padding: 0;
vertical-align: top
}
.fc-header td {
white-space: nowrap;
background: none
}
.fc-header-left {
width: 100%;
text-align: left;
position: absolute;
left: 0;
top: 6px
}
.fc-header-left .fc-button {
margin: 0;
position: relative
}
.fc-header-left .fc-button-prev, .fc-header-left .fc-button-next {
float: left;
border: none;
padding: 14px 10px;
opacity: 0.5
}
.fc-header-left .fc-button-prev .fc-button-inner, .fc-header-left .fc-button-next .fc-button-inner {
border: none
}
.fc-header-left .fc-button-prev .fc-button-inner .fc-button-content, .fc-header-left .fc-button-next .fc-button-inner .fc-button-content {
display: none
}
.fc-header-left .fc-button-prev.fc-state-hover, .fc-header-left .fc-button-next.fc-state-hover {
opacity: 1
}
.fc-header-left .fc-button-prev.fc-state-down, .fc-header-left .fc-button-next.fc-state-down {
background: none !important;
margin-top: -1px
}
.fc-header-left .fc-button-prev .fc-button-inner {
background-position: 0 -351px;
height: 16px;
width: 11px
}
.fc-header-left .fc-button-next {
float: right
}
.fc-header-left .fc-button-next .fc-button-inner {
background-position: 0 -367px;
height: 16px;
width: 11px
}
.fc-header-center {
text-align: center
}
.fc-header-right {
text-align: right;
position: absolute;
top: -34px;
right: 10px
}
.fc-header-title {
display: inline-block;
vertical-align: top
}
.fc-header-title h2 {
margin-top: 0;
white-space: nowrap;
font-size: 1.1rem;
color: #6C737F;
line-height: 55px;
}
.fc .fc-header-space {
padding-left: 10px
}
.fc-header .fc-button {
margin-bottom: 1em;
vertical-align: top
}
.fc-header .fc-button {
margin-right: -1px
}
.fc-header .fc-corner-right {
margin-right: 1px
}
.fc-header .ui-corner-right {
margin-right: 0
}
.fc-header .fc-state-hover, .fc-header .ui-state-hover {
z-index: 2
}
.fc-header .fc-state-down {
z-index: 3
}
.fc-header .fc-state-active, .fc-header .ui-state-active {
z-index: 4
}
.fc-content {
clear: both;
background: #f9f9f9
}
.fc-view {
width: 100%;
overflow: hidden
}
.fc-view thead {
background:#e9ecf1;
line-height: 35px
}
.fc-widget-header, .fc-widget-content {
border: 1px solid #ccc
}
.fc-state-highlight {
background: #F4F3E6
}
.fc-cell-overlay {
background: #9cf;
opacity: .2;
filter: alpha(opacity=20)
}
.fc-button {
position: relative;
display: inline-block;
cursor: pointer
}
.fc-button-today{margin-top: 8px !important;}
.fc-state-default {
border-style: solid;
border-width: 1px 0
}
.fc-button-inner {
position: relative;
float: left;
overflow: hidden
}
.fc-state-default .fc-button-inner {
border-style: solid;
border-width: 0 1px
}
.fc-button-content {
position: relative;
float: left;
height: 1.9em;
line-height: 1.9em;
padding: 0 .6em;
white-space: nowrap
}
.fc-button-content .fc-icon-wrap {
position: relative;
float: left;
top: 50%
}
.fc-button-content .ui-icon {
position: relative;
float: left;
margin-top: -50%;
*margin-top:0;
*top:-50%
}
.fc-state-default .fc-button-effect {
position: absolute;
top: 50%;
left: 0
}
.fc-state-default .fc-button-effect span {
position: absolute;
top: -100px;
left: 0;
width: 500px;
height: 100px;
border-width: 100px 0 0 1px;
border-style: solid;
border-color: #fff;
background: #444;
opacity: .09;
filter: alpha(opacity=9)
}
.fc-state-default, .fc-state-default .fc-button-inner {
border-style: solid;
border-color: #ccc #bbb #aaa;
color: #000
}
.fc-state-hover, .fc-state-hover .fc-button-inner {
border-color: #999
}
.fc-state-down {
border-color: #555;
background: #777
}
.fc-state-active, .fc-state-active .fc-button-inner {
border-color: #555;
background: #777;
color: #fff
}
.fc-state-disabled, .fc-state-disabled .fc-button-inner {
color: #999;
border-color: #ddd
}
.fc-state-disabled {
cursor: default
}
.fc-state-disabled .fc-button-effect {
display: none
}
.fc-event {
border-style: solid;
border-width: 0;
font-size: .85em;
cursor: default
}
a.fc-event, .fc-event-draggable {
cursor: pointer
}
a.fc-event {
text-decoration: none
}
.fc-rtl .fc-event {
text-align: right
}
.fc-event-skin {
border-color: #3f85f5;
background-color: #5e96ea;
color: #fff
}
.fc-event-inner {
position: relative;
width: 100%;
height: 100%;
border-style: solid;
border-width: 0;
overflow: hidden
}
.fc-event-time, .fc-event-title {
padding: 0 1px
}
.fc .ui-resizable-handle {
display: block;
position: absolute;
z-index: 99999;
overflow: hidden;
font-size: 300%;
line-height: 50%
}
.fc-event-hori {
border-width: 1px 0;
margin-bottom: 1px
}
.fc-event-hori .ui-resizable-e {
top: 0 !important;
right: -3px !important;
width: 7px !important;
height: 100% !important;
cursor: e-resize
}
.fc-event-hori .ui-resizable-w {
top: 0 !important;
left: -3px !important;
width: 7px !important;
height: 100% !important;
cursor: w-resize
}
.fc-event-hori .ui-resizable-handle {
_padding-bottom: 14px
}
.fc-corner-left {
margin-left: 1px
}
.fc-corner-left .fc-button-inner, .fc-corner-left .fc-event-inner {
margin-left: -1px
}
.fc-corner-right {
margin-right: 1px
}
.fc-corner-right .fc-button-inner, .fc-corner-right .fc-event-inner {
margin-right: -1px
}
.fc-corner-top {
margin-top: 1px
}
.fc-corner-top .fc-event-inner {
margin-top: -1px
}
.fc-corner-bottom {
margin-bottom: 1px
}
.fc-corner-bottom .fc-event-inner {
margin-bottom: -1px
}
.fc-corner-left .fc-event-inner {
border-left-width: 1px
}
.fc-corner-right .fc-event-inner {
border-right-width: 1px
}
.fc-corner-top .fc-event-inner {
border-top-width: 1px
}
.fc-corner-bottom .fc-event-inner {
border-bottom-width: 1px
}
table.fc-border-separate {
border-collapse: separate
}
.fc-border-separate th, .fc-border-separate td {
border-width: 1px 0 0 1px
}
.fc-border-separate th.fc-last, .fc-border-separate td.fc-last {
border-right-width: 1px
}
.fc-border-separate tr.fc-last th, .fc-border-separate tr.fc-last td {
border-bottom-width: 0px
}
.fc-first {
border-left-width: 0 !important
}
.fc-last {
border-right-width: 0 !important
}
.fc-grid th {
text-align: center
}
.fc-grid .fc-day-number {
float: right;
padding: 0 2px
}
.fc-grid .fc-other-month .fc-day-number {
opacity: 0.3;
filter: alpha(opacity=30)
}
.fc-grid .fc-day-content {
clear: both;
padding: 2px 2px 1px
}
.fc-grid .fc-event-time {
font-weight: bold
}
.fc-rtl .fc-grid .fc-day-number {
float: left
}
.fc-rtl .fc-grid .fc-event-time {
float: right
}
.fc-agenda table {
border-collapse: separate
}
.fc-agenda-days th {
text-align: center
}
.fc-agenda .fc-agenda-axis {
width: 60px !important;
padding: 0 4px;
vertical-align: middle;
text-align: right;
white-space: nowrap;
font-weight: normal
}
.fc-agenda .fc-day-content {
padding: 2px 2px 1px
}
.fc-agenda-days .fc-agenda-axis {
border-right-width: 1px
}
.fc-agenda-days .fc-col0 {
border-left-width: 0
}
.fc-agenda-allday th {
border-width: 0 1px
}
.fc-agenda-allday .fc-day-content {
min-height: 34px;
_height: 34px
}
.<API key> {
height: 2px;
overflow: hidden
}
.fc-widget-header .<API key> {
background: #eee
}
.fc-agenda-slots th {
border-width: 1px 1px 0
}
.fc-agenda-slots td {
border-width: 1px 0 0;
background: none
}
.fc-agenda-slots td div {
height: 20px
}
.fc-agenda-slots tr.fc-slot0 th, .fc-agenda-slots tr.fc-slot0 td {
border-top-width: 0
}
.fc-agenda-slots tr.fc-minor th, .fc-agenda-slots tr.fc-minor td {
border-top-style: dotted
}
.fc-agenda-slots tr.fc-minor th.ui-widget-header {
*border-top-style:solid
}
.fc-event-vert {
border-width: 0 1px
}
.fc-event-vert .fc-event-head, .fc-event-vert .fc-event-content {
position: relative;
z-index: 2;
width: 100%;
overflow: hidden
}
.fc-event-vert .fc-event-time {
white-space: nowrap;
font-size: 10px
}
.fc-event-vert .fc-event-bg {
position: absolute;
z-index: 1;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: #fff;
opacity: .3;
filter: alpha(opacity=30)
}
.fc .<API key> .fc-event-bg, .fc-select-helper .fc-event-bg {
display: none\9
}
.fc-event-vert .ui-resizable-s {
bottom: 0 !important;
width: 100% !important;
height: 8px !important;
overflow: hidden !important;
line-height: 8px !important;
font-size: 11px !important;
font-family: monospace;
text-align: center;
cursor: s-resize
}
.fc-agenda .<API key> {
_overflow: hidden
}
.fc-header-left .fc-button-prev .fc-button-inner {background: url('../img/icons-sa7c41345d9.png') no-repeat; background-position: 0 -351px;
height: 16px;
width: 11px;}
.fc-header-left .fc-button-next .fc-button-inner {background: url('../img/icons-sa7c41345d9.png') no-repeat; background-position: 0 -367px;
height: 16px;
width: 11px;}
.chart-holder {
width: 100%;
height: 250px;
}
.dropdown-menu li>a:hover, .dropdown-menu .active>a, .dropdown-menu .active>a:hover { background:#00ba8b;}
.accordion-heading { background:#e5e5e5; }
.accordion-heading a { color:#545454; text-decoration:none; font-weight:bold; }
.btn-facebook-alt i {
color: #23386a;
}
.btn-twitter-alt i {
color: #0098d0;
}
.btn-google-alt i {
color: #b6362d;
}
.btn-linkedin-alt i {
color: #0073b2;
}
.btn-pinterest-alt i {
color: #ab171e;
}
.btn-github-alt i {
color: #333;
}
.all-icons li { list-style:none;}
.ML0 { margin-left:0}
.MR0 { margin-right:0;}
@media (max-width: 480px) {
.error-container h1 {
font-size: 72px;
}
}
@media (max-width: 767px) {
#main {
padding: 0 10px;
margin-right: -20px;
margin-left: -20px;
}
.subnavbar {
margin-left: -20px;
margin-right: -20px;
}
.subnavbar-inner {
height: auto;
}
.subnavbar .container > ul {
width: 100%;
height: auto;
border: none;
}
.subnavbar .container > ul > li {
width: 33%;
height: 70px;
margin-bottom: 0;
border: none;
}
.subnavbar .container > ul > li.active > a {
font-size: 11px;
background: transparent;
}
.subnavbar .container > ul > li > a > i {
display: inline-block;
margin-bottom: 0;
font-size: 20px;
}
.<API key> .dropdown-menu {
left: auto;
right: 0;
}
.<API key> .dropdown-menu:before {
left: auto;
right: 12px;
}
.<API key> .dropdown-menu:after {
left: auto;
right: 13px;
}
.extra {
margin-right: -20px;
margin-left: -20px;
}
.extra .container {
padding: 0 20px;
}
.footer {
margin-right: -20px;
margin-left: -20px;
height:auto;
}
.footer .container {
padding: 0 20px;
}
.footer .footer-terms {
text-align: left;
}
.footer .footer-terms a {
margin-left: 0;
margin-right: 1em;
}
}
@media (max-width: 979px) {
.navbar-fixed-top {
position: static;
margin-bottom: 0;
}
.subnavbar {
}
.subnavbar .container {
width: auto;
}
}
@media (min-width: 1200px) {
.navbar .search-query {
width: 200px;
}
}
|
title: "Line-Following Robot"
Here's goes my first "projects" post. Last semester I took a class called "Intro To Electromechanical Systems" (shout out to my professor Greg Lewin), a fun class about combining software and hardware to make some cool things. As you've probably guessed, one of the projects we had was to create a line following robot. But what I didn't mention in the title was that this robot didn't only follow lines, but also delivered packages! The robot can be seen below:
<img src="/assets/linefollowing1.JPG" width="70%" />
Basically an Amazon delivery drone
The general idea was for this robot to get an order from a website we created, go and retrieve the package from our "warehouse", deliver it to the "customers home", and finally update the SQL database with help from some PHP scripts and a little bit of magic. We created the map that the robot following with electrical tape as the lines, and set specific points on the map to be warehouse A, B, or C and other points to be customer's addresses 1, 2, 3, and 4. The robot's "brain" (AI/singularity rant incoming...) was made using the arduino UNO, as well as the arduino wireless and motor shields. This allowed the robot to take the order wirelessly without needing to keep it connected to the computer that was putting the order in through the website.
To make sure that the robot was able to properly follow the lines, light sensors and encoders on the motors were used to keep track of distance and whether the robot was actually on the line or not. Some psuedo code can be seen below:
If (not on line) {
Get back on the line
}
In all seriousness, the robot had two light sensors, and whenever one was giving out a high output (meaning it is seeing black), we adjusted its direction back towards the line.
Everything was wired together using a small breadboard to keep it neat. The body was designed in AutoCAD and laser cut before we put anything else together. Overall, it was pretty satisfying to have the system work in unison (after a ton of tests...I mean seriously a ton...). You can see the side and a closer view of the front of the robot below:
<img src="/assets/linefollowing2.JPG" width="70%" />
<img src="/assets/linefollowing3.JPG" width="70%" />
Jamel Charouel
Monday, August 3rd, 2015
|
#ifndef <API key>
#define <API key>
#include "hkbmodifier.h"
class <API key> final: public hkbModifier
{
friend class <API key>;
public:
<API key>(HkxFile *parent, long ref = 0);
<API key>& operator=(const <API key>&) = delete;
<API key>(const <API key> &) = delete;
~<API key>();
public:
QString getName() const;
static const QString getClassname();
private:
void setName(const QString &newname);
bool getEnable() const;
void setEnable(bool value);
hkQuadVariable getTranslationOut() const;
void setTranslationOut(const hkQuadVariable &value);
hkQuadVariable getRotationOut() const;
void setRotationOut(const hkQuadVariable &value);
bool readData(const HkxXmlReader & reader, long & index);
bool link();
void unlink();
QString <API key>();
bool write(HkxXMLWriter *writer);
private:
static uint refCount;
static const QString classname;
long userData;
QString name;
bool enable;
hkQuadVariable translationOut;
hkQuadVariable rotationOut;
mutable std::mutex mutex;
};
#endif // <API key>
|
@extends('admin.layout')
@section('title')
Payment
@endsection
@section('content')
<a href="/admin/ff/payment/create/{{$pledge->id}}" class="ui teal button right floated">New Payment</a>
<h1 class="ui header">Payments</h1>
<div class="ui horizontal divider">{{$pledge->name}}'s <br> Summary </div>
<table class="ui unstackable table">
<thead>
<tr>
<th class="center aligned"> {{trans('futurefund.total_pledge')}} </th>
<th class="center aligned"> {{trans('futurefund.collected')}} </th>
<th class="center aligned"> {{trans('futurefund.balance')}} </th>
</tr>
</thead>
<tr>
<td class="center aligned">RM {{number_format($pledge->amount, 2)}}</td>
<td class="center aligned">RM {{number_format($pledge_collected, 2)}}</td>
<td class="center aligned">RM {{number_format(($pledge->amount - $pledge_collected), 2)}}</td>
</tr>
</table>
<div class="ui horizontal divider">{{$pledge->name}}'s <br> Payments </div>
<div class="ui segment">
{!! Form::select('is_cleared', ['0' => 'Not cleared', '1' => 'Cleared', 'all' => 'All'], $filter['is_cleared'], ['class' => 'ui dropdown']) !!}
{!! Form::select('is_cancelled', ['0' => 'Not cancelled', '1' => 'Cancelled', 'all' => 'All'], $filter['is_cancelled'], ['class' => 'ui dropdown']) !!}
<div class="clearfix field">
<a href="{{ url()->current() }}" class="ui basic right floated right labeled icon tiny button">
Reset <i class="undo icon"></i>
</a>
<button class="ui teal right floated right labeled icon tiny button">
Filter <i class="filter icon"></i>
</button>
</div>
<div class="ui hidden divider"></div>
{!! Form::close() !!}
</div>
<table class="ui very compact unstackable table">
<thead>
<tr>
<th >{!! sort_by('id', 'ID' ) !!}</th>
<th class="three wide">Amount</th>
<th >Status</th>
<th >Created at</th>
<th >Actions</th>
</tr>
</thead>
<tbody>
@forelse ($payments as $payment)
<tr>
<td>
<h5 class="ui header">
{{ prefix()->wrap($payment) }}
</h5>
</td>
<td>
<h5 class="ui header">
RM {{ $payment->amount }}
@if ($payment->remarks)
<div class="sub uppercased header">{{ $payment->remarks }}</div>
@endif
</h5>
</td>
<td>
<div>
@if ($payment->is_cancelled)
<div class="ui grey label">cancelled</div>
@else
@if ($payment->is_cleared)
<div class="ui green label">cleared</div>
@else
<div class="ui orange label">pending</div>
@endif
@endif
</div>
</td>
<td>
{{ $payment->created_at->format('Y-m-d') }}
<div>{{ $payment->created_at->format('h:i a') }}</div>
</td>
<td>
<div class="ui small icon buttons">
<a href="/admin/ff/payment/update/{{$payment->id}}" class="ui button">
<i class="pencil icon"></i>
</a>
</div>
</td>
</tr>
@empty
<tr>
<td colspan="5"> No payment record yet, change filter or come back later </td>
</tr>
@endforelse
</tbody>
</table>
@endsection
|
(function (window) {
'use strict';
var <API key> = 'mean';
var service = {
<API key>: <API key>,
<API key>: ['ngResource', 'ngAnimate', 'ngMessages', 'ui.router', 'angularFileUpload', 'ngMaterial'],
registerModule: registerModule
};
window.<API key> = service;
// Add a new vertical module
function registerModule(moduleName, dependencies) {
// Create angular module
angular.module(moduleName, dependencies || []);
// Add the module to the AngularJS configuration file
angular.module(<API key>).requires.push(moduleName);
}
}(window));
|
struct stat;
struct rtcdate;
// system calls
int fork(void);
int exit(void) __attribute__((noreturn));
int wait(void);
int pipe(int*);
int write(int, void*, int);
int read(int, void*, int);
int close(int);
int kill(int);
int exec(char*, char**);
int open(char*, int);
int mknod(char*, short, short);
int unlink(char*);
int fstat(int fd, struct stat*);
int link(char*, char*);
int mkdir(char*);
int chdir(char*);
int dup(int);
int getpid(void);
char* sbrk(int);
int sleep(int);
int uptime(void);
// Priority increment syscall
int nice(int);
// ulib.c
int stat(char*, struct stat*);
char* strcpy(char*, char*);
void *memmove(void*, void*, int);
char* strchr(const char*, char c);
int strcmp(const char*, const char*);
void printf(int, char*, ...);
char* gets(char*, int max);
uint strlen(char*);
void* memset(void*, int, uint);
void* malloc(uint);
void free(void*);
int atoi(const char*);
|
/*
* 5-high FONT FOR RENDERING TO THE LED SCREEN.
* Includes kerning support
* Gaurav Manek, 2011
*/
#ifndef __FONT5X4_H
#define __FONT5X4_H
#include <avr/pgmspace.h>
#define FONT_5X4_HEIGHT 5
#define FONT_5X4_STEP_GLYPH 10
// Number of bytes per glyph
const char FONT_5X4 [] PROGMEM = {
0b0000, 0b0000, 0b0000, 0b0000, 0b0000, 0b0000, 0b0000, 0b0000, 0b0000, 0b0000, // SPACE
0b0111, 0b0001, 0b0000, 0b0000, 0b0000, 0b0000, 0b0000, 0b0000, 0b0000, 0b0000,
0b0011, 0b0000, 0b0000, 0b0000, 0b0011, 0b0000, 0b0000, 0b0000, 0b0000, 0b0000,
0b1010, 0b0000, 0b1111, 0b0001, 0b1010, 0b0000, 0b1111, 0b0001, 0b1010, 0b0000, //
0b0000, 0b0000, 0b0000, 0b0000, 0b0000, 0b0000, 0b0000, 0b0000, 0b0000, 0b0000,
0b0011, 0b0001, 0b1011, 0b0000, 0b0100, 0b0000, 0b1010, 0b0001, 0b1001, 0b0001,
0b1010, 0b0000, 0b0101, 0b0001, 0b1001, 0b0001, 0b1010, 0b0001, 0b0000, 0b0000,
0b0011, 0b0000, 0b0000, 0b0000, 0b0000, 0b0000, 0b0000, 0b0000, 0b0000, 0b0000,
0b1110, 0b0000, 0b0001, 0b0001, 0b0000, 0b0000, 0b0000, 0b0000, 0b0000, 0b0000,
0b0001, 0b0001, 0b1110, 0b0000, 0b0000, 0b0000, 0b0000, 0b0000, 0b0000, 0b0000,
0b0101, 0b0000, 0b0010, 0b0000, 0b0101, 0b0000, 0b0000, 0b0000, 0b0000, 0b0000,
0b0100, 0b0000, 0b0100, 0b0000, 0b1111, 0b0001, 0b0100, 0b0000, 0b0100, 0b0000,
0b0000, 0b0001, 0b1000, 0b0000, 0b0000, 0b0000, 0b0000, 0b0000, 0b0000, 0b0000,
0b0100, 0b0000, 0b0100, 0b0000, 0b0100, 0b0000, 0b0000, 0b0000, 0b0000, 0b0000,
0b0000, 0b0001, 0b0000, 0b0000, 0b0000, 0b0000, 0b0000, 0b0000, 0b0000, 0b0000,
0b0000, 0b0001, 0b1100, 0b0000, 0b0110, 0b0000, 0b0001, 0b0000, 0b0000, 0b0000,
0b1110, 0b0000, 0b0001, 0b0001, 0b1110, 0b0000, 0b0000, 0b0000, 0b0000, 0b0000,
0b0010, 0b0001, 0b1111, 0b0001, 0b0000, 0b0001, 0b0000, 0b0000, 0b0000, 0b0000,
0b0010, 0b0001, 0b1001, 0b0001, 0b0101, 0b0001, 0b0010, 0b0001, 0b0000, 0b0000,
0b0101, 0b0001, 0b0101, 0b0001, 0b1010, 0b0000, 0b0000, 0b0000, 0b0000, 0b0000,
0b1100, 0b0000, 0b1010, 0b0000, 0b1111, 0b0001, 0b1000, 0b0000, 0b0000, 0b0000,
0b0111, 0b0001, 0b0101, 0b0001, 0b1101, 0b0000, 0b0000, 0b0000, 0b0000, 0b0000,
0b1110, 0b0000, 0b0101, 0b0001, 0b0101, 0b0001, 0b1000, 0b0000, 0b0000, 0b0000,
0b0001, 0b0000, 0b1101, 0b0001, 0b0101, 0b0000, 0b0011, 0b0000, 0b0000, 0b0000,
0b1010, 0b0000, 0b0101, 0b0001, 0b0101, 0b0001, 0b1010, 0b0000, 0b0000, 0b0000,
0b0010, 0b0000, 0b0101, 0b0000, 0b0101, 0b0001, 0b1110, 0b0000, 0b0000, 0b0000,
0b1010, 0b0000, 0b0000, 0b0000, 0b0000, 0b0000, 0b0000, 0b0000, 0b0000, 0b0000,
0b0000, 0b0001, 0b1010, 0b0000, 0b0000, 0b0000, 0b0000, 0b0000, 0b0000, 0b0000,
0b0100, 0b0000, 0b1010, 0b0000, 0b0001, 0b0001, 0b0000, 0b0000, 0b0000, 0b0000,
0b1010, 0b0000, 0b1010, 0b0000, 0b1010, 0b0000, 0b0000, 0b0000, 0b0000, 0b0000,
0b0001, 0b0001, 0b1010, 0b0000, 0b0100, 0b0000, 0b0000, 0b0000, 0b0000, 0b0000,
0b0010, 0b0000, 0b0001, 0b0000, 0b1001, 0b0001, 0b0110, 0b0000, 0b0000, 0b0000,
0b1110, 0b0000, 0b0001, 0b0000, 0b1101, 0b0000, 0b0101, 0b0001, 0b1111, 0b0000,
0b1110, 0b0001, 0b0101, 0b0000, 0b0101, 0b0000, 0b1110, 0b0001, 0b0000, 0b0000,
0b1111, 0b0001, 0b0101, 0b0001, 0b1010, 0b0000, 0b0000, 0b0000, 0b0000, 0b0000,
0b1110, 0b0000, 0b0001, 0b0001, 0b0001, 0b0001, 0b1010, 0b0000, 0b0000, 0b0000,
0b1111, 0b0001, 0b0001, 0b0001, 0b1110, 0b0000, 0b0000, 0b0000, 0b0000, 0b0000,
0b1111, 0b0001, 0b0101, 0b0001, 0b0001, 0b0001, 0b0000, 0b0000, 0b0000, 0b0000,
0b1111, 0b0001, 0b0101, 0b0000, 0b0101, 0b0000, 0b0000, 0b0000, 0b0000, 0b0000,
0b1110, 0b0000, 0b0001, 0b0001, 0b1001, 0b0001, 0b1010, 0b0000, 0b0000, 0b0000,
0b1111, 0b0001, 0b0100, 0b0000, 0b0100, 0b0000, 0b1111, 0b0001, 0b0000, 0b0000,
0b0001, 0b0001, 0b1111, 0b0001, 0b0001, 0b0001, 0b0000, 0b0000, 0b0000, 0b0000,
0b1001, 0b0000, 0b0001, 0b0001, 0b1111, 0b0000, 0b0000, 0b0000, 0b0000, 0b0000,
0b1111, 0b0001, 0b0100, 0b0000, 0b1010, 0b0000, 0b0001, 0b0001, 0b0000, 0b0000,
0b1111, 0b0001, 0b0000, 0b0001, 0b0000, 0b0001, 0b0000, 0b0000, 0b0000, 0b0000,
0b1111, 0b0001, 0b0010, 0b0000, 0b0100, 0b0000, 0b0010, 0b0000, 0b1111, 0b0001,
0b1111, 0b0001, 0b0010, 0b0000, 0b0100, 0b0000, 0b1000, 0b0000, 0b1111, 0b0001,
0b1110, 0b0000, 0b0001, 0b0001, 0b0001, 0b0001, 0b1110, 0b0000, 0b0000, 0b0000,
0b1111, 0b0001, 0b0101, 0b0000, 0b0010, 0b0000, 0b0000, 0b0000, 0b0000, 0b0000,
0b1110, 0b0000, 0b0001, 0b0001, 0b0001, 0b0001, 0b1001, 0b0000, 0b0110, 0b0001,
0b1111, 0b0001, 0b0101, 0b0000, 0b1010, 0b0001, 0b0000, 0b0000, 0b0000, 0b0000,
0b0010, 0b0001, 0b0101, 0b0001, 0b0101, 0b0001, 0b1001, 0b0000, 0b0000, 0b0000,
0b0001, 0b0000, 0b1111, 0b0001, 0b0001, 0b0000, 0b0000, 0b0000, 0b0000, 0b0000,
0b1111, 0b0000, 0b0000, 0b0001, 0b0000, 0b0001, 0b1111, 0b0000, 0b0000, 0b0000,
0b0011, 0b0000, 0b1100, 0b0000, 0b0000, 0b0001, 0b1100, 0b0000, 0b0011, 0b0000,
0b1111, 0b0000, 0b0000, 0b0001, 0b1100, 0b0000, 0b0000, 0b0001, 0b1111, 0b0000,
0b1011, 0b0001, 0b0100, 0b0000, 0b1011, 0b0001, 0b0000, 0b0000, 0b0000, 0b0000,
0b0011, 0b0000, 0b1100, 0b0001, 0b0011, 0b0000, 0b0000, 0b0000, 0b0000, 0b0000,
0b1001, 0b0001, 0b0101, 0b0001, 0b0101, 0b0001, 0b0011, 0b0001, 0b0000, 0b0000,
0b1111, 0b0001, 0b0001, 0b0001, 0b0000, 0b0000, 0b0000, 0b0000, 0b0000, 0b0000,
0b0001, 0b0000, 0b0110, 0b0000, 0b1100, 0b0000, 0b0000, 0b0001, 0b0000, 0b0000, // backslash
0b0001, 0b0001, 0b1111, 0b0001, 0b0000, 0b0000, 0b0000, 0b0000, 0b0000, 0b0000,
0b0010, 0b0000, 0b0001, 0b0000, 0b0010, 0b0000, 0b0000, 0b0000, 0b0000, 0b0000,
0b0000, 0b0001, 0b0000, 0b0001, 0b0000, 0b0001, 0b0000, 0b0000, 0b0000, 0b0000
};
const char FONT_5X4_WIDTH [] = {
1, 1, 3, 5, 4, 5, 4, 1,
2, 2, 3, 5, 2, 3, 1, 4,
3, 3, 4, 3, 4, 3, 4, 4,
4, 4, 1, 2, 3, 3, 3, 4,
5, 4, 3, 4, 3, 3, 3, 4,
4, 3, 3, 4, 3, 5, 5, 4,
3, 5, 3, 4, 3, 4, 5, 5,
3, 3, 4, 2, 4, 2, 3, 3
};
#endif // __FONT5X4_H
|
layout: default
<section id="content-region-3" class="padding-40 page-tree-bg">
<div class="container">
<h3 class="page-tree-text">
Becoming a Sponsor
</h3>
</div>
</section>
<div class="space-70"></div>
<div class="container">
<div class="row">
<div class="col-md-12">
</div>
</div>
<div class="row">
<div class="col-md-4 margin-btm-20">
<div class="pricing-wrapper">
<div class="pricing-head">
<h3>Terawatt</h3>
</div>
<div class="pricing-rate">
<h1>$6,000 and above</h1>
</div>
<div class="pricing-desc">
<ul class="list-unstyled">
<li><i class="ion-checkmark-round"></i> Invitation to Sponsor Day</li>
<li><i class="ion-checkmark-round"></i> Feature in our newsletter</li>
<li><i class="ion-checkmark-round"></i> Company logo on team website</li>
<li><i class="ion-checkmark-round"></i> Social media shout outs</li>
<li><i class="ion-checkmark-round"></i> Company logo on team banner </li>
<li><i class="ion-checkmark-round"></i> Large Company logo on REV 2</li>
<li><i class="ion-checkmark-round"></i> Access to our team resume book and EVT room tour</li>
<li><i class="ion-checkmark-round"></i> Large Company logo on team T-shirts</li>
</ul>
</div>
</div><!--pricing wrapper
</div><!--pricing col end
<div class="col-md-4 margin-btm-20">
<div class="pricing-wrapper">
<div class="pricing-head">
<h3>Gigawatt</h3>
</div>
<div class="pricing-rate">
<h1>$3,500 - $5,999</h1>
</div>
<div class="pricing-desc">
<ul class="list-unstyled">
<li><i class="ion-checkmark-round"></i> Invitation to Sponsor Day</li>
<li><i class="ion-checkmark-round"></i> Feature in our newsletter</li>
<li><i class="ion-checkmark-round"></i> Company logo on team website</li>
<li><i class="ion-checkmark-round"></i> Social media shout outs</li>
<li><i class="ion-checkmark-round"></i> Company logo on team banner </li>
<li><i class="ion-checkmark-round"></i> Medium Company logo on REV 2</li>
<li><i class="ion-checkmark-round"></i> Access to our team resume book and EVT room tour</li>
<li><i class="ion-checkmark-round"></i> Medium Company logo on team T-shirts</li>
</ul>
</div>
</div><!--pricing wrapper
</div><!--pricing col end
<div class="col-md-4 margin-btm-20">
<div class="pricing-wrapper">
<div class="pricing-head">
<h3>Megawatt</h3>
</div>
<div class="pricing-rate">
<h1>$1000 - $3,499</h1>
</div>
<div class="pricing-desc">
<ul class="list-unstyled">
<li><i class="ion-checkmark-round"></i> Invitation to Sponsor Day</li>
<li><i class="ion-checkmark-round"></i> Feature in our newsletter</li>
<li><i class="ion-checkmark-round"></i> Company logo on team website</li>
<li><i class="ion-checkmark-round"></i> Social media shout outs</li>
<li><i class="ion-checkmark-round"></i> Company logo on team banner </li>
<li><i class="ion-checkmark-round"></i> Small Company logo on REV 2</li>
<li><i class="ion-checkmark-round"></i> Access to our team resume book and EVT room tour</li>
<li><i class="ion-checkmark-round"></i> Small Company logo on team T-shirts</li>
</ul>
</div>
</div><!--pricing wrapper
</div><!--pricing col end
<div class="col-md-4 margin-btm-20">
<div class="pricing-wrapper">
<div class="pricing-head">
<h3>Kilowatt</h3>
</div>
<div class="pricing-rate">
<h1>$500-$999</h1>
</div>
<div class="pricing-desc">
<ul class="list-unstyled">
<li><i class="ion-checkmark-round"></i> Invitation to Sponsor Day</li>
<li><i class="ion-checkmark-round"></i> Feature in our newsletter</li>
<li><i class="ion-checkmark-round"></i> Company logo on team website</li>
<li><i class="ion-checkmark-round"></i> Social media shout outs</li>
<!--<li><i class="ion-close-round"></i> Company logo on team banner </li>-->
<!--<li><i class="ion-close-round"></i> Company logo on REV 1</li>-->
<!--<li><i class="ion-close-round"></i> Private tour of team room and projects</li>-->
</ul>
</div>
</div><!--pricing wrapper
</div><!--pricing col end
<div class="col-md-4 margin-btm-20">
<div class="pricing-wrapper">
<div class="pricing-head">
<h3>Watt</h3>
</div>
<div class="pricing-rate">
<h1>$1-$499</h1>
</div>
<div class="pricing-desc">
<ul class="list-unstyled">
<li><i class="ion-checkmark-round"></i> Invitation to Sponsor Day</li>
<li><i class="ion-checkmark-round"></i> Feature in our newsletter</li>
<!--<li><i class="ion-close-round"></i> Social media shout outs</li> -->
<!--<li><i class="ion-close-round"></i> Company logo on team banner </li>-->
<!--<li><i class="ion-close-round"></i> Company logo on REV 1</li>-->
<!--<li><i class="ion-close-round"></i> Private tour of team room and projects</li>-->
</ul>
</div>
</div><!--pricing wrapper
</div><!--pricing col end
</div><!--pricing 3 col row end
<div class="col-md-6 text-center">
<h1><a href="../../assets/documents/2018.<API key>.pdf" target="_blank" class="text-center btn theme-btn-evt btn-lg btn-radius btn-block">View the official 2018-19 Sponsorship Packet</a></h1>
</div>
<div class="col-md-6 text-center">
<h1><a href="https://securelb.imodules.com/s/1624/index-giving.aspx?sid=1624&gid=1&pgid=705&cid=1466&fid=1466&gfid=800&bledit=1&dids=354"
target="_blank" class="text-center btn theme-btn-evt btn-lg btn-radius btn-block">Make a donation to the RIT Electric Vehicle Team</a></h1>
</div>
<div class="space-40"></div>
<!--<div class="col-md-12">-->
<!--<h1 class="heading-mini">How to Donate</h1>-->
<!--</div>-->
<!--<div class="col-md-8">-->
<!--<div>-->
<!--<img src="/assets/img/gift_to_evt_1.png" class="img-responsive" alt="Responsive Image">-->
<!--</div>-->
<!--</div>-->
<!--<div class="col-md-12">-->
<!--<div class="price-faq-box">-->
<!--<div class="space-20"></div>-->
<!--<h3>Safe, Fast, Offical</h3>-->
<!--Donating only takes 5 steps. On the first page,
<!--be sure to select "Other" and fill in
<!--"<strong>Electric Vehicle Team</strong>".-->
<!--</div>-->
<!--</div>-->
</div>
</div>
<div class="space-20"></div>
|
<?php
namespace Symfony\Bundle\FrameworkBundle\Tests\Functional;
use Symfony\Bundle\FrameworkBundle\Command\<API key>;
use Symfony\Bundle\FrameworkBundle\Console\Application;
use Symfony\Component\Console\Tester\CommandTester;
/**
* @group functional
*/
class <API key> extends AbstractWebTestCase
{
protected function setUp()
{
static::bootKernel(['test_case' => 'CachePools', 'root_config' => 'config.yml']);
}
public function testListPools()
{
$tester = $this->createCommandTester(['cache.app', 'cache.system']);
$tester->execute([]);
$this->assertSame(0, $tester->getStatusCode(), 'cache:pool:list exits with 0 in case of success');
$this->assertContains('cache.app', $tester->getDisplay());
$this->assertContains('cache.system', $tester->getDisplay());
}
public function testEmptyList()
{
$tester = $this->createCommandTester([]);
$tester->execute([]);
$this->assertSame(0, $tester->getStatusCode(), 'cache:pool:list exits with 0 in case of success');
}
private function createCommandTester(array $poolNames)
{
$application = new Application(static::$kernel);
$application->add(new <API key>($poolNames));
return new CommandTester($application->find('cache:pool:list'));
}
}
|
module ActiveSurvey
class Visitor
def visit_items(items)
res = items.map { |item| item.accept(self) }
after_visit_items(items, res)
end
def after_visit_items(items, result)
result
end
def visit_question(item)
end
def visit_section(item)
self.visit_items item.items
end
def visit_text_item(item)
end
end
end
|
(function (require) {
var test = require('test'),
asyncTest = require('asyncTest'),
start = require('start'),
module = require('module'),
ok = require('ok'),
expect = require('expect'),
$ = require('$'),
document = require('document'),
raises = require('raises'),
rnd = '?' + Math.random(),
ENV_NAME = require('<API key>') ? 'Worker' : require('<API key>') ? 'Node' : 'DOM';
function getComputedStyle(element, rule) {
if(document.defaultView && document.defaultView.getComputedStyle){
return document.defaultView.getComputedStyle(element, "").getPropertyValue(rule);
}
rule = rule.replace(/\-(\w)/g, function (strMatch, p1){
return p1.toUpperCase();
});
return element.currentStyle[rule];
}
module('LMD loader @ ' + ENV_NAME);
asyncTest("require.js()", function () {
expect(6);
require.js('./modules/loader/non_lmd_module.js' + rnd, function (script_tag) {
ok(typeof script_tag === "object" &&
script_tag.nodeName.toUpperCase() === "SCRIPT", "should return script tag on success");
ok(require('some_function')() === true, "we can grab content of the loaded script");
ok(require('./modules/loader/non_lmd_module.js' + rnd) === script_tag, "should cache script tag on success");
// some external
require.js('http://yandex.ru/jquery.js' + rnd, function (script_tag) {
ok(typeof script_tag === "undefined", "should return undefined on error in 3 seconds");
ok(typeof require('http:
require.js('module_as_string', function (module_as_string) {
require.async('module_as_string', function (<API key>) {
ok(module_as_string === <API key>, 'require.js() acts like require.async() if in-package/declared module passed');
start();
});
});
});
});
});
asyncTest("require.js() JSON callback and chain calls", function () {
expect(2);
var id = require('setTimeout')(function () {
ok(false, 'JSONP call fails');
start();
}, 3000);
require('window').someJsonHandler = function (result) {
ok(result.ok, 'JSON called');
require('window').someJsonHandler = null;
require('clearTimeout')(id);
start();
};
var requireReturned = require.js('./modules/loader/non_lmd_module.jsonp.js' + rnd);
ok(typeof requireReturned === "function", "require.js() must return require");
});
asyncTest("require.js() race calls", function () {
expect(1);
var result;
var check_result = function (scriptTag) {
if (typeof result === "undefined") {
result = scriptTag;
} else {
ok(result === scriptTag, "Must perform one call. Results must be the same");
start();
}
};
require.js('./modules/loader_race/non_lmd_module.js' + rnd, check_result);
require.js('./modules/loader_race/non_lmd_module.js' + rnd, check_result);
});
asyncTest("require.js() shortcut", function () {
expect(5);
require.js('sk_js_js', function (script_tag) {
ok(typeof script_tag === "object" &&
script_tag.nodeName.toUpperCase() === "SCRIPT", "should return script tag on success");
ok(require('sk_js_js') === script_tag, "require should return the same result");
require.js('sk_js_js', function (script_tag2) {
ok(script_tag2 === script_tag, 'should load once');
ok(require('sk_js_js') === require('/modules/shortcuts/js.js'), "should be defined using path-to-module");
ok(typeof require('shortcuts_js') === "function", 'Should create a global function shortcuts_js as in module function');
start();
})
});
});
// -- CSS
asyncTest("require.css()", function () {
expect(4);
require.css('./modules/loader/some_css.css' + rnd, function (link_tag) {
ok(typeof link_tag === "object" &&
link_tag.nodeName.toUpperCase() === "LINK", "should return link tag on success");
ok(getComputedStyle(document.getElementById('qunit-fixture'), 'visibility') === "hidden", "css should be applied");
ok(require('./modules/loader/some_css.css' + rnd) === link_tag, "should cache link tag on success");
require.css('module_as_string', function (module_as_string) {
require.async('module_as_string', function (<API key>) {
ok(module_as_string === <API key>, 'require.css() acts like require.async() if in-package/declared module passed');
start();
});
});
});
});
asyncTest("require.css() CSS loader without callback", function () {
expect(1);
var requireReturned = require
.css('./modules/loader/<API key>.css' + rnd)
.css('./modules/loader/<API key>.css' + rnd + 1);
ok(typeof requireReturned === "function", "require.css() must return require");
start();
});
asyncTest("require.css() race calls", function () {
expect(1);
var result;
var check_result = function (linkTag) {
if (typeof result === "undefined") {
result = linkTag;
} else {
ok(result === linkTag, "Must perform one call. Results must be the same");
start();
}
};
require.css('./modules/loader_race/some_css.css' + rnd, check_result);
require.css('./modules/loader_race/some_css.css' + rnd, check_result);
});
asyncTest("require.css() shortcut", function () {
expect(4);
require.css('sk_css_css', function (link_tag) {
ok(typeof link_tag === "object" &&
link_tag.nodeName.toUpperCase() === "LINK", "should return link tag on success");
ok(require('sk_css_css') === link_tag, "require should return the same result");
require.css('sk_css_css', function (link_tag2) {
ok(link_tag2 === link_tag, 'should load once');
ok(require('sk_css_css') === require('/modules/shortcuts/css.css'), "should be defined using path-to-module");
start();
})
});
});
asyncTest("require.css() cross origin", function () {
expect(2);
require.css('sk_css_xdomain', function (link_tag) {
ok(typeof link_tag === "object" &&
link_tag.nodeName.toUpperCase() === "LINK", "should return link tag on success");
ok(getComputedStyle(document.body, 'min-width') === "960px", "css should be applied");
start();
});
});
// -- image
asyncTest("require.image()", function () {
expect(5);
require.image('./modules/loader/image.gif' + rnd, function (img_tag) {
ok(typeof img_tag === "object" &&
img_tag.nodeName.toUpperCase() === "IMG", "should return img tag on success");
ok(require('./modules/loader/image.gif' + rnd) === img_tag, "should cache img tag on success");
require.image('./modules/loader/image_404.gif' + rnd, function (img_tag) {
ok(typeof img_tag === "undefined", "should return undefined on error in 3 seconds");
ok(typeof require('./modules/loader/image_404.gif' + rnd) === "undefined", "should not cache errorous modules");
require.image('module_as_string', function (module_as_string) {
require.async('module_as_string', function (<API key>) {
ok(module_as_string === <API key>, 'require.image() acts like require.async() if in-package/declared module passed');
start();
});
});
});
});
});
asyncTest("require.image() image loader without callback", function () {
expect(1);
var requireReturned = require
.image('./modules/loader/image_callbackless.gif' + rnd)
.image('./modules/loader/image_callbackless.gif' + rnd + 1);
ok(typeof requireReturned === "function", "require.image() must return require");
start();
});
asyncTest("require.image() race calls", function () {
expect(1);
var result;
var check_result = function (linkTag) {
if (typeof result === "undefined") {
result = linkTag;
} else {
ok(result === linkTag, "Must perform one call. Results must be the same");
start();
}
};
require.image('./modules/loader_race/image.gif' + rnd, check_result);
require.image('./modules/loader_race/image.gif' + rnd, check_result);
});
asyncTest("require.image() shortcut", function () {
expect(4);
require.image('sk_image_image', function (img_tag) {
ok(typeof img_tag === "object" &&
img_tag.nodeName.toUpperCase() === "IMG", "should return img tag on success");
ok(require('sk_image_image') === img_tag, "require should return the same result");
require.image('sk_image_image', function (img_tag2) {
ok(img_tag2 === img_tag, 'should load once');
ok(require('sk_image_image') === require('/modules/shortcuts/image.gif'), "should be defined using path-to-module");
start();
})
});
});
})
|
/*
The main entry point for the client side of the app
*/
// Create the main app object
this.App = {};
// Create the needed collections on the client side
this.Surprises = new Meteor.Collection("surprises");
// Subscribe to the publishes in server/collections
Meteor.subscribe('surprises');
// Start the app
Meteor.startup(function() {
$(function() {
App.routes = new Routes();
});
});
|
// -*- coding: utf-8 -*-
// de l'Epita (LRDE).
// This file is part of Spot, a model checking library.
// Spot is free software; you can redistribute it and/or modify it
// (at your option) any later version.
// Spot is distributed in the hope that it will be useful, but WITHOUT
// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
#include <cassert>
#include <ctime>
#include <vector>
#include <spot/twaalgos/dualize.hh>
#include <spot/twaalgos/hoa.hh>
#include <spot/twaalgos/iscolored.hh>
#include <spot/twaalgos/parity.hh>
#include <spot/twaalgos/product.hh>
#include <spot/twaalgos/randomgraph.hh>
#include <spot/misc/random.hh>
#include <spot/twaalgos/complete.hh>
#include <spot/twa/twagraph.hh>
#include <spot/twa/fwd.hh>
#include <spot/twa/acc.hh>
#include <spot/misc/trival.hh>
#include <utility>
#include <string>
#include <iostream>
#define LAST_AUT result.back().first
#define LAST_NUM_SETS result.back().second
#define NEW_AUT() do { \
result.emplace_back(spot::random_graph(6, 0.5, &apf, \
current_bdd, 0, 0, 0.5, true), 0); \
LAST_NUM_SETS = 0; \
/* print_hoa need this */ \
LAST_AUT->prop_state_acc(spot::trival::maybe()); \
} while (false)
#define SET_TR(t, value) do { \
unsigned value_tmp = value; \
if (value_tmp + 1 > LAST_NUM_SETS) \
LAST_NUM_SETS = value_tmp + 1; \
t.acc.set(value_tmp); \
} while (false)
static std::vector<std::pair<spot::twa_graph_ptr, unsigned>>
generate_aut(const spot::bdd_dict_ptr& current_bdd)
{
spot::atomic_prop_set apf = spot::<API key>(3);
std::vector<std::pair<spot::twa_graph_ptr, unsigned>> result;
// No accset on any transition
NEW_AUT();
// The same accset on every transitions
NEW_AUT();
for (auto& t: LAST_AUT->edges())
SET_TR(t, 0);
// All used / First unused / Last unused / First and last unused
for (auto incr_ext: { 0, 1 })
for (auto used: { 1, 2 })
for (auto modulo: { 4, 5, 6 })
if (incr_ext + modulo <= 6)
{
NEW_AUT();
unsigned count = 0;
for (auto& t: LAST_AUT->edges())
if (std::rand() % used == 0)
{
auto value = ++count % modulo + incr_ext;
SET_TR(t, value);
}
}
// One-Three in middle not used
for (auto i: { 0, 1 })
for (auto start: { 1, 2 })
for (auto unused: { 1, 2, 3 })
{
NEW_AUT();
auto count = 0;
for (auto& t: LAST_AUT->edges())
{
int val = 0;
if (count % (3 + i) < start)
val = count % (3 + i);
else
val = count % (3 + i) + unused;
SET_TR(t, val);
}
}
// All accset on all transitions
for (auto i: { 0, 1 })
{
NEW_AUT();
for (auto& t: LAST_AUT->edges())
for (auto acc = 0; acc < 5 + i; ++acc)
SET_TR(t, acc);
}
// Some random automata
std::vector<std::vector<int>> cont_sets;
for (auto i = 0; i <= 6; ++i)
{
std::vector<int> cont_set;
for (auto j = 0; j < i; ++j)
cont_set.push_back(j);
cont_sets.push_back(cont_set);
}
for (auto min: { 0, 1 })
{
for (auto num_sets: { 1, 2, 5, 6 })
for (auto i = 0; i < 10; ++i)
{
NEW_AUT();
for (auto& t: LAST_AUT->edges())
{
auto nb_acc = std::rand() % (num_sets - min + 1) + min;
std::random_shuffle(cont_sets[num_sets].begin(),
cont_sets[num_sets].end());
for (auto j = 0; j < nb_acc; ++j)
SET_TR(t, cont_sets[num_sets][j]);
}
}
for (auto num_sets: {2, 3})
for (auto even: {0, 1})
if ((num_sets - 1) * 2 + even < 6)
{
NEW_AUT();
for (auto& t: LAST_AUT->edges())
{
auto nb_acc = std::rand() % (num_sets - min + 1) + min;
std::random_shuffle(cont_sets[num_sets].begin(),
cont_sets[num_sets].end());
for (auto j = 0; j < nb_acc; ++j)
{
auto value = cont_sets[num_sets][j] * 2 + even;
SET_TR(t, value);
}
}
}
}
return result;
}
static std::vector<std::tuple<spot::acc_cond::acc_code, bool, bool, unsigned>>
generate_acc()
{
std::vector<std::tuple<spot::acc_cond::acc_code, bool, bool, unsigned>>
result;
for (auto max: { true, false })
for (auto odd: { true, false })
for (auto num_sets: { 0, 1, 2, 5, 6 })
result.emplace_back(spot::acc_cond::acc_code::parity(max, odd,
num_sets), max, odd, num_sets);
return result;
}
static bool is_included(spot::const_twa_graph_ptr left,
spot::const_twa_graph_ptr right, bool first_left)
{
auto tmp = spot::dualize(right);
auto product = spot::product(left, tmp);
if (!product->is_empty())
{
std::cerr << "======Not included======" << std::endl;
if (first_left)
std::cerr << "======First automaton======" << std::endl;
else
std::cerr << "======Second automaton======" << std::endl;
spot::print_hoa(std::cerr, left);
std::cerr << std::endl;
if (first_left)
std::cerr << "======Second automaton======" << std::endl;
else
std::cerr << "======First automaton======" << std::endl;
spot::print_hoa(std::cerr, right);
std::cerr << std::endl;
if (first_left)
std::cerr << "======!Second automaton======" << std::endl;
else
std::cerr << "======!First automaton======" << std::endl;
spot::print_hoa(std::cerr, tmp);
std::cerr << std::endl;
if (first_left)
std::cerr << "======First X !Second======" <<std::endl;
else
std::cerr << "======Second X !First======" <<std::endl;
spot::print_hoa(std::cerr, product);
std::cerr << std::endl;
return false;
}
return true;
}
static bool are_equiv(spot::const_twa_graph_ptr left,
spot::const_twa_graph_ptr right)
{
return is_included(left, right, true) && is_included(right, left, false);
}
static bool is_right_parity(spot::const_twa_graph_ptr aut,
spot::parity_kind target_kind,
spot::parity_style target_style,
bool origin_max, bool origin_odd, unsigned num_sets)
{
bool is_max;
bool is_odd;
if (!aut->acc().is_parity(is_max, is_odd))
return false;
bool target_max;
bool target_odd;
if (aut->num_sets() <= 1 || num_sets <= 1
|| target_kind == spot::parity_kind_any)
target_max = is_max;
else if (target_kind == spot::parity_kind_max)
target_max = true;
else if (target_kind == spot::parity_kind_min)
target_max = false;
else
target_max = origin_max;
if (aut->num_sets() == 0 || num_sets == 0
|| target_style == spot::parity_style_any)
target_odd = is_odd;
else if (target_style == spot::parity_style_odd)
target_odd = true;
else if (target_style == spot::parity_style_even)
target_odd = false;
else
target_odd = origin_odd;
if (!(is_max == target_max && is_odd == target_odd))
{
std::cerr << "======Wrong accceptance======" << std::endl;
std::string kind[] = { "max", "min", "same", "any" };
std::string style[] = { "odd", "even", "same", "any" };
std::cerr << "target: " << kind[target_kind] << ' '
<< style[target_style] << std::endl;
std::cerr << "origin: " << kind[origin_max ? 0 : 1] << ' '
<< style[origin_odd ? 0 : 1] << ' '
<< num_sets << std::endl;
std::cerr << "actually: " << kind[is_max ? 0 : 1] << ' '
<< style[is_odd ? 0 : 1] << ' '
<< aut->num_sets() << std::endl;
std::cerr << std::endl;
return false;
}
return true;
}
static bool is_almost_colored(spot::const_twa_graph_ptr aut)
{
for (auto t: aut->edges())
if (t.acc.count() > 1)
{
std::cerr << "======Not colored======" << std::endl;
spot::print_hoa(std::cerr, aut);
std::cerr << std::endl;
return false;
}
return true;
}
static bool is_colored_printerr(spot::const_twa_graph_ptr aut)
{
bool result = is_colored(aut);
if (!result)
{
std::cerr << "======Not colored======" << std::endl;
spot::print_hoa(std::cerr, aut);
std::cerr << std::endl;
}
return result;
}
static spot::parity_kind to_parity_kind(bool is_max)
{
if (is_max)
return spot::parity_kind_max;
return spot::parity_kind_min;
}
static spot::parity_style to_parity_style(bool is_odd)
{
if (is_odd)
return spot::parity_style_odd;
return spot::parity_style_even;
}
int main()
{
auto current_bdd = spot::make_bdd_dict();
spot::srand(0);
auto parity_kinds =
{
spot::parity_kind_max,
spot::parity_kind_min,
spot::parity_kind_same,
spot::parity_kind_any,
};
auto parity_styles =
{
spot::parity_style_odd,
spot::parity_style_even,
spot::parity_style_same,
spot::parity_style_any,
};
auto acceptance_sets = generate_acc();
auto automata_tuples = generate_aut(current_bdd);
unsigned num_automata = automata_tuples.size();
unsigned num_acceptance = acceptance_sets.size();
std::cerr << "num of automata: " << num_automata << '\n';
std::cerr << "num of acceptance expression: " << num_acceptance << '\n';
for (auto acc_tuple: acceptance_sets)
for (auto& aut_tuple: automata_tuples)
{
auto& aut = aut_tuple.first;
auto aut_num_sets = aut_tuple.second;
auto acc = std::get<0>(acc_tuple);
auto is_max = std::get<1>(acc_tuple);
auto is_odd = std::get<2>(acc_tuple);
auto acc_num_sets = std::get<3>(acc_tuple);
if (aut_num_sets <= acc_num_sets)
{
aut->set_acceptance(acc_num_sets, acc);
// Check change_parity
for (auto kind: parity_kinds)
for (auto style: parity_styles)
{
auto output = spot::change_parity(aut, kind, style);
assert(is_right_parity(output, kind, style,
is_max, is_odd, acc_num_sets)
&& "change_parity: wrong acceptance.");
assert(are_equiv(aut, output)
&& "change_parity: not equivalent.");
assert(is_almost_colored(output)
&& "change_parity: too many acc on a transition");
}
// Check colorize_parity
for (auto keep_style: { true, false })
{
auto output = spot::colorize_parity(aut, keep_style);
assert(is_colored_printerr(output)
&& "colorize_parity: not colored.");
assert(are_equiv(aut, output)
&& "colorize_parity: not equivalent.");
auto target_kind = to_parity_kind(is_max);
auto target_style = keep_style ? to_parity_style(is_odd)
: spot::parity_style_any;
assert(is_right_parity(output, target_kind, target_style,
is_max, is_odd, acc_num_sets)
&& "change_parity: wrong acceptance.");
}
// Check cleanup_parity
for (auto keep_style: { true, false })
{
auto output = spot::cleanup_parity(aut, keep_style);
assert(is_almost_colored(output)
&& "cleanup_parity: too many acc on a transition.");
assert(are_equiv(aut, output)
&& "cleanup_parity: not equivalent.");
auto target_kind = to_parity_kind(is_max);
auto target_style = keep_style ? to_parity_style(is_odd)
: spot::parity_style_any;
assert(is_right_parity(output, target_kind, target_style,
is_max, is_odd, acc_num_sets)
&& "cleanup_parity: wrong acceptance.");
}
}
}
std::random_shuffle(automata_tuples.begin(), automata_tuples.end());
unsigned num_left = 15;
unsigned num_right = 15;
unsigned acc_index = 0;
unsigned nb = 0;
// Parity product and sum
for (unsigned left_index = 0; left_index < num_left; ++left_index)
{
auto& aut_tuple_first = automata_tuples[left_index % num_automata];
auto& left = aut_tuple_first.first;
auto aut_num_sets_first = aut_tuple_first.second;
while (std::get<3>(acceptance_sets[acc_index]) < aut_num_sets_first)
acc_index = (acc_index + 1) % num_acceptance;
auto acc_tuple_first = acceptance_sets[acc_index];
acc_index = (acc_index + 1) % num_acceptance;
auto acc_first = std::get<0>(acc_tuple_first);
auto acc_num_sets_first = std::get<3>(acc_tuple_first);
left->set_acceptance(acc_num_sets_first, acc_first);
for (unsigned right_index = 0; right_index < num_right; ++right_index)
{
auto& aut_tuple_second =
automata_tuples[(num_left + right_index) % num_automata];
auto& right = aut_tuple_second.first;
auto aut_num_sets_second = aut_tuple_second.second;
while (std::get<3>(acceptance_sets[acc_index]) < aut_num_sets_second)
acc_index = (acc_index + 1) % num_acceptance;
auto acc_tuple_second = acceptance_sets[acc_index];
acc_index = (acc_index + 1) % num_acceptance;
auto acc_second = std::get<0>(acc_tuple_second);
auto acc_num_sets_second = std::get<3>(acc_tuple_second);
right->set_acceptance(acc_num_sets_second, acc_second);
auto result_prod = spot::parity_product(left, right);
auto ref_prod = spot::product(left, right);
if (!are_equiv(result_prod, ref_prod))
{
std::cerr << nb << ": parity_product: Not equivalent.\n"
<< "=====First Automaton=====\n";
spot::print_hoa(std::cerr, left);
std::cerr << "=====Second Automaton=====\n";
spot::print_hoa(std::cerr, right);
assert(false && "parity_product: Not equivalent.\n");
}
assert(is_colored_printerr(result_prod)
&& "parity_product: not colored.");
assert(is_right_parity(result_prod, spot::parity_kind_any,
spot::parity_style_any,
true, true, 2)
&& "parity_product: not a parity acceptance condition");
auto result_sum = spot::parity_product_or(left, right);
auto ref_sum = spot::product_or(left, right);
if (!are_equiv(result_sum, ref_sum))
{
std::cerr << nb << ": parity_product_or: Not equivalent.\n"
<< "=====First Automaton=====\n";
spot::print_hoa(std::cerr, left);
std::cerr << "=====Second Automaton=====\n";
spot::print_hoa(std::cerr, right);
assert(false && "parity_product_or: Not equivalent.\n");
}
assert(is_colored_printerr(result_sum)
&& "parity_product_or: not colored.");
assert(is_right_parity(result_sum, spot::parity_kind_any,
spot::parity_style_any,
true, true, 2)
&& "parity_product_or: not a parity acceptance condition");
++nb;
}
}
return 0;
}
|
namespace Meeko
{
partial class Form1
{
<summary>
Required designer variable.
</summary>
private System.ComponentModel.IContainer components = null;
<summary>
Clean up any resources being used.
</summary>
<param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
<summary>
Required method for Designer support - do not modify
the contents of this method with the code editor.
</summary>
private void InitializeComponent()
{
System.ComponentModel.<API key> resources = new System.ComponentModel.<API key>(typeof(Form1));
this.SuspendLayout();
// Form1
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(284, 261);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Name = "Form1";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Meeko";
this.Load += new System.EventHandler(this.Form1_Load);
this.ResumeLayout(false);
}
#endregion
}
}
|
title: Hey Boss, Event Sourcing Can Fix That!
author:
name: Emily Stamey
twitter: elstamey
url: http://elstamey.com
theme: elstamey/<API key>
style: basic-style.css
output: hey_boss.html
controls: true
# Event Sourcing Can Fix That!


# Basics of Event Sourcing
- pull from library 11-45 with thinning
# Scholarships
- replaced in pieces
- added DDD & ES & CQRS beside complex framework spaghetti
- separation of concerns
- cleaner history and reports of what had been done













## Dependency Injection
- add slide from bootstrapping through controllers and rearrange
## Legacy
- this was an example of replacing the code in pieces
- could have replaced only one part or a few
- really powerful to see which parts of your application could benefit from event sourcing
- and finding the simplest way to implement
# Student Enrollment Process
- rewrote
- ES to follow the process
- status drop-down versus events

# Diagram

# Session Threats Report
- multiple daemons running parts of code and the UI consumes the results of the analysis
- complex DB queries
- reports are slow to generate on-demand
## Event: SessionDiscovered
- after validation to determine whether we have a valid session, we log a new event
new SessionDiscovered( attributes we need to know )
## Event: SessionDiscovered
- session id
- start time
- protocol
- source ip
- destination ip
- source port
- destination port
## Event: SessionScored
- session id
- threat contributor
- score
## Event: FileScored
- after validation that a file has matched a signature, we log a new event
new FileScored( attributes we need to know )
## Event: FileScored
- file id
- session id
- integration
- score
- signature that found it
## Event: FileRescored
- after validation that a file has matched a signature and that it has been scored before\n- we log a new event
new FileRescored( attributes we need to know )
## Event: FileRescored
- file id
- session id
- integration
- new score
- signature that found it
## Projection: Session
- listens for SessionDiscovered events
- creates a new row in a table with the session details and a null score
- listens for SessionScored events
- finds the session in the table and updates the score and score contributor
## Projection: Report for Top Threats by Hash
- listens for FileScored and FileRescored Events
- looks up details of file by the file id
- adds a row to table with
- file id
- file md5 hash
- the filename
- file type
- the score
- signature that scored it
- source ip
- destination ip
- protocol
## Read Model: Top Threats
methods:
- top 10 threats by the file hash
- this excludes hits I'm not allowed to see by the signature that did the scoring
- gets a current hit count of only the records I can see
- top threats by file type
- top threats by source/destination ip pairs
- top threats by protocol
## Good Stuff!
- works well in our environment where we have multiple applications doing different things
- full audit log of what has happened in our environment
- the results of those events can be optimized for read to shorten the time to retrieve data
- separate the logic of what an event means based on context and purpose
- only display results that a user is allowed to see
- flexible to change, our interpretation of events can change, and we can rebuild projections without losing the full history
## Signatures
- history of changes
- past scores/score history
## Rescans and history from rescans
- what can we see?
## Efficiency
- With events written, can process them for multiple contexts
- Speed up scans by delaying the writes to the report
- Speed up reports by building from events/optimized for read
# Thank you

|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.