# This file is part of QuTiP: Quantum Toolbox in Python.
#
# Copyright (c) 2011 and later, Paul D. Nation and Robert J. Johansson.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# 3. Neither the name of the QuTiP: Quantum Toolbox in Python nor the names
# of its contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
 IN NO EVENT SHALL THE COPYRIGHT
# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
###############################################################################
"""
This module provides solvers for the Lindblad master equation and von Neumann
equation.
"""
__all__ = ['mesolve']
import numpy as np
import scipy.integrate
from qutip.qobj import Qobj, isket, isoper, issuper
from qutip.superoperator import spre, spost, liouvillian, vec2mat, lindblad_dissipator
from qutip.expect import expect_rho_vec
from qutip.solver import Options, Result, solver_safe, SolverSystem
from qutip.cy.spmatfuncs import spmv
from qutip.cy.spconvert import dense2D_to_fastcsr_fmode
from qutip.states import ket2dm
from qutip.sesolve import sesolve
from qutip.ui.progressbar import BaseProgressBar, TextProgressBar
from qutip.qobjevo import QobjEvo
from qutip.cy.openmp.utilities import check_use_openmp
# -----------------------------------------------------------------------------
# pass on to wavefunction solver or master equation solver depending on whether
# any collapse operators were given.
#
[docs]def mesolve(H, rho0, tlist, c_ops=None, e_ops=None, args=None, options=None,
progress_bar=None, _safe_mode=True):
"""
Master equation evolution of a density matrix for a given Hamiltonian and
set of collapse operators, or a Liouvillian.
Evolve the state vector or density matrix (`rho0`) using a given
Hamiltonian or Liouvillian (`H`) and an optional set of collapse operators
(`c_ops`), by integrating the set of ordinary differential equations
that define the system. In the absence of collapse operators the system is
evolved according to the unitary evolution of the Hamiltonian.
The output is either the state vector at arbitrary points in time
(`tlist`), or the expectation values of the supplied operators
(`e_ops`). If e_ops is a callback function, it is invoked for each
time in `tlist` with time and the state as arguments, and the function
does not use any return values.
If either `H` or the Qobj elements in `c_ops` are superoperators, they
will be treated as direct contributions to the total system Liouvillian.
This allows the solution of master equations that are not in standard
Lindblad form.
**Time-dependent operators**
For time-dependent problems, `H` and `c_ops` can be a specified in a
nested-list format where each element in the list is a list of length 2,
containing an operator (:class:`qutip.qobj`) at the first element and where
the second element is either a string (*list string format*), a callback
function (*list callback format*) that evaluates to the time-dependent
coefficient for the corresponding operator, or a NumPy array (*list
array format*) which specifies the value of the coefficient to the
corresponding operator for each value of t in `tlist`.
Alternatively, `H` (but not `c_ops`) can be a callback function with the
signature `f(t, args) -> Qobj` (*callback format*), which can return the
Hamiltonian or Liouvillian superoperator at any point in time. If the
equation cannot be put in standard Lindblad form, then this time-dependence
format must be used.
*Examples*
H = [[H0, 'sin(w*t)'], [H1, 'sin(2*w*t)']]
H = [[H0, f0_t], [H1, f1_t]]
where f0_t and f1_t are python functions with signature f_t(t, args).
H = [[H0, np.sin(w*tlist)], [H1, np.sin(2*w*tlist)]]
In the *list string format* and *list callback format*, the string
expression and the callback function must evaluate to a real or complex
number (coefficient for the corresponding operator).
In all cases of time-dependent operators, `args` is a dictionary of
parameters that is used when evaluating operators. It is passed to the
callback functions as their second argument.
**Additional options**
Additional options to mesolve can be set via the `options` argument, which
should be an instance of :class:`qutip.solver.Options`. Many ODE
integration options can be set this way, and the `store_states` and
`store_final_state` options can be used to store states even though
expectation values are requested via the `e_ops` argument.
.. note::
If an element in the list-specification of the Hamiltonian or
the list of collapse operators are in superoperator form it will be
added to the total Liouvillian of the problem without further
transformation. This allows for using mesolve for solving master
equations that are not in standard Lindblad form.
.. note::
On using callback functions: mesolve transforms all :class:`qutip.Qobj`
objects to sparse matrices before handing the problem to the integrator
function. In order for your callback function to work correctly, pass
all :class:`qutip.Qobj` objects that are used in constructing the
Hamiltonian via `args`. mesolve will check for :class:`qutip.Qobj` in
`args` and handle the conversion to sparse matrices. All other
:class:`qutip.Qobj` objects that are not passed via `args` will be
passed on to the integrator in scipy which will raise a NotImplemented
exception.
Parameters
----------
H : :class:`qutip.Qobj`
System Hamiltonian, or a callback function for time-dependent
Hamiltonians, or alternatively a system Liouvillian.
rho0 : :class:`qutip.Qobj`
initial density matrix or state vector (ket).
tlist : *list* / *array*
list of times for :math:`t`.
c_ops : None / list of :class:`qutip.Qobj`
single collapse operator, or list of collapse operators, or a list
of Liouvillian superoperators.
e_ops : None / list of :class:`qutip.Qobj` / callback function single
single operator or list of operators for which to evaluate
expectation values.
args : None / *dictionary*
dictionary of parameters for time-dependent Hamiltonians and
collapse operators.
options : None / :class:`qutip.Options`
with options for the solver.
progress_bar : None / BaseProgressBar
Optional instance of BaseProgressBar, or a subclass thereof, for
showing the progress of the simulation.
Returns
-------
result: :class:`qutip.Result`
An instance of the class :class:`qutip.Result`, which contains
either an *array* `result.expect` of expectation values for the times
specified by `tlist`, or an *array* `result.states` of state vectors or
density matrices corresponding to the times in `tlist` [if `e_ops` is
an empty list], or nothing if a callback function was given in place of
operators for which to calculate the expectation values.
"""
if c_ops is None:
c_ops = []
if isinstance(c_ops, (Qobj, QobjEvo)):
c_ops = [c_ops]
if e_ops is None:
e_ops = []
if isinstance(e_ops, Qobj):
e_ops = [e_ops]
if isinstance(e_ops, dict):
e_ops_dict = e_ops
e_ops = [e for e in e_ops.values()]
else:
e_ops_dict = None
if progress_bar is None:
progress_bar = BaseProgressBar()
if progress_bar is True:
progress_bar = TextProgressBar()
# check if rho0 is a superoperator, in which case e_ops argument should
# be empty, i.e., e_ops = []
# TODO: e_ops for superoperator
if issuper(rho0) and not e_ops == []:
raise TypeError("Must have e_ops = [] when initial condition rho0 is" +
" a superoperator.")
if options is None:
options = Options()
if options.rhs_reuse and not isinstance(H, SolverSystem):
# TODO: deprecate when going to class based solver.
if "mesolve" in solver_safe:
# print(" ")
H = solver_safe["mesolve"]
else:
pass
# raise Exception("Could not find the Hamiltonian to reuse.")
if args is None:
args = {}
check_use_openmp(options)
use_mesolve = ((c_ops and len(c_ops) > 0)
or (not isket(rho0))
or (isinstance(H, Qobj) and issuper(H))
or (isinstance(H, QobjEvo) and issuper(H.cte))
or (isinstance(H, list) and isinstance(H[0], Qobj) and
issuper(H[0]))
or (not isinstance(H, (Qobj, QobjEvo)) and callable(H) and
not options.rhs_with_state and issuper(H(0., args)))
or (not isinstance(H, (Qobj, QobjEvo)) and callable(H) and
options.rhs_with_state))
if not use_mesolve:
return sesolve(H, rho0, tlist, e_ops=e_ops, args=args, options=options,
progress_bar=progress_bar, _safe_mode=_safe_mode)
if isket(rho0):
rho0 = ket2dm(rho0)
if (not (rho0.isoper or rho0.issuper)) or (rho0.dims[0] != rho0.dims[1]):
raise ValueError(
"input state must be a pure state vector, square density matrix, "
"or superoperator"
)
if isinstance(H, SolverSystem):
ss = H
elif isinstance(H, (list, Qobj, QobjEvo)):
ss = _mesolve_QobjEvo(H, c_ops, tlist, args, options)
elif callable(H):
ss = _mesolve_func_td(H, c_ops, rho0, tlist, args, options)
else:
raise Exception("Invalid H type")
func, ode_args = ss.makefunc(ss, rho0, args, e_ops, options)
if _safe_mode:
# This is to test safety of the function before starting the loop.
v = rho0.full().ravel('F')
func(0., v, *ode_args) + v
res = _generic_ode_solve(func, ode_args, rho0, tlist, e_ops, options,
progress_bar, dims=rho0.dims)
res.num_collapse = len(c_ops)
if e_ops_dict:
res.expect = {e: res.expect[n]
for n, e in enumerate(e_ops_dict.keys())}
return res
# -----------------------------------------------------------------------------
# A time-dependent unitary wavefunction equation on the list-function format
#_mesolve_QobjEvo(H, c_ops, tlist, args, options)
def _mesolve_QobjEvo(H, c_ops, tlist, args, opt):
"""
Prepare the system for the solver, H can be an QobjEvo.
"""
H_td = QobjEvo(H, args, tlist=tlist)
if not issuper(H_td.cte):
L_td = liouvillian(H_td)
else:
L_td = H_td
for op in c_ops:
# We want to avoid passing tlist where it isn't necessary, to allow a
# Hamiltonian/Liouvillian which already _has_ time-dependence not equal
# to the mesolve evaluation times to be used in conjunction with
# time-independent c_ops. If we _always_ pass it, it may appear to
# QobjEvo that there is a tlist mismatch, even though it is not used.
if isinstance(op, Qobj):
op_td = QobjEvo(op)
elif isinstance(op, QobjEvo):
op_td = QobjEvo(op, args)
else:
op_td = QobjEvo(op, args, tlist=tlist)
if not issuper(op_td.cte):
op_td = lindblad_dissipator(op_td)
L_td += op_td
if opt.rhs_with_state:
L_td._check_old_with_state()
nthread = opt.openmp_threads if opt.use_openmp else 0
L_td.compile(omp=nthread)
ss = SolverSystem()
ss.H = L_td
ss.makefunc = _qobjevo_set
solver_safe["mesolve"] = ss
return ss
def _test_liouvillian_dimensions(L_dims, rho_dims):
"""
Raise ValueError if the dimensions of the Liouvillian and the density
matrix or superoperator state are incompatible with the master equation.
"""
if L_dims[0] != L_dims[1]:
raise ValueError("Liouvillian had nonsquare dims: " + str(L_dims))
if not ((L_dims[1] == rho_dims) or (L_dims[1] == rho_dims[0])):
raise ValueError("".join([
"incompatible Liouvillian and state dimensions: ",
str(L_dims), " and ", str(rho_dims),
]))
def _qobjevo_set(HS, rho0, args, e_ops, opt):
"""
From the system, get the ode function and args
"""
H_td = HS.H
H_td.solver_set_args(args, rho0, e_ops)
if issuper(rho0):
func = H_td.compiled_qobjevo.ode_mul_mat_f_vec
elif rho0.isket or rho0.isoper:
func = H_td.compiled_qobjevo.mul_vec
else:
# Should be caught earlier in mesolve.
raise ValueError("rho0 must be a ket, density matrix or superoperator")
_test_liouvillian_dimensions(H_td.cte.dims, rho0.dims)
return func, ()
# -----------------------------------------------------------------------------
# Master equation solver for python-function time-dependence.
#
class _LiouvillianFromFunc:
def __init__(self, func, c_ops, rho_dims):
self.f = func
self.c_ops = c_ops
self.rho_dims = rho_dims
def H2L(self, t, rho, args):
Ht = self.f(t, args)
Lt = -1.0j * (spre(Ht) - spost(Ht))
_test_liouvillian_dimensions(Lt.dims, self.rho_dims)
Lt = Lt.data
for op in self.c_ops:
Lt += op(t).data
return Lt
def H2L_with_state(self, t, rho, args):
Ht = self.f(t, rho, args)
Lt = -1.0j * (spre(Ht) - spost(Ht))
_test_liouvillian_dimensions(Lt.dims, self.rho_dims)
Lt = Lt.data
for op in self.c_ops:
Lt += op(t).data
return Lt
def L(self, t, rho, args):
Lt = self.f(t, args)
_test_liouvillian_dimensions(Lt.dims, self.rho_dims)
Lt = Lt.data
for op in self.c_ops:
Lt += op(t).data
return Lt
def L_with_state(self, t, rho, args):
Lt = self.f(t, rho, args)
_test_liouvillian_dimensions(Lt.dims, self.rho_dims)
Lt = Lt.data
for op in self.c_ops:
Lt += op(t).data
return Lt
def _mesolve_func_td(L_func, c_op_list, rho0, tlist, args, opt):
"""
Evolve the density matrix using an ODE solver with time dependent
Hamiltonian.
"""
c_ops = []
for op in c_op_list:
td = QobjEvo(op, args, tlist=tlist, copy=False)
c_ops.append(td if td.cte.issuper else lindblad_dissipator(td))
c_ops_ = [sum(c_ops)] if c_op_list else []
L_api = _LiouvillianFromFunc(L_func, c_ops_, rho0.dims)
if opt.rhs_with_state:
obj = L_func(0., rho0.full().ravel("F"), args)
L_func = L_api.L_with_state if issuper(obj) else L_api.H2L_with_state
else:
obj = L_func(0., args)
L_func = L_api.L if issuper(obj) else L_api.H2L
ss = SolverSystem()
ss.L = L_func
ss.makefunc = _Lfunc_set
solver_safe["mesolve"] = ss
return ss
def _Lfunc_set(HS, rho0, args, e_ops, opt):
"""
From the system, get the ode function and args
"""
L_func = HS.L
if issuper(rho0):
func = _ode_super_func_td
else:
func = _ode_rho_func_td
return func, (L_func, args)
def _ode_rho_func_td(t, y, L_func, args):
L = L_func(t, y, args)
return spmv(L, y)
def _ode_super_func_td(t, y, L_func, args):
L = L_func(t, y, args)
ym = vec2mat(y)
return (L*ym).ravel('F')
# -----------------------------------------------------------------------------
# Generic ODE solver: shared code among the various ODE solver
# -----------------------------------------------------------------------------
def _generic_ode_solve(func, ode_args, rho0, tlist, e_ops, opt,
progress_bar, dims=None):
"""
Internal function for solving ME.
Calculate the required expectation values or invoke
callback function at each time step.
"""
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# This function is made similar to sesolve's one for futur merging in a
# solver class
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# prepare output array
n_tsteps = len(tlist)
output = Result()
output.solver = "mesolve"
output.times = tlist
size = rho0.shape[0]
initial_vector = rho0.full().ravel('F')
r = scipy.integrate.ode(func)
r.set_integrator('zvode', method=opt.method, order=opt.order,
atol=opt.atol, rtol=opt.rtol, nsteps=opt.nsteps,
first_step=opt.first_step, min_step=opt.min_step,
max_step=opt.max_step)
if ode_args:
r.set_f_params(*ode_args)
r.set_initial_value(initial_vector, tlist[0])
e_ops_data = []
output.expect = []
if callable(e_ops):
n_expt_op = 0
expt_callback = True
output.num_expect = 1
elif isinstance(e_ops, list):
n_expt_op = len(e_ops)
expt_callback = False
output.num_expect = n_expt_op
if n_expt_op == 0:
# fall back on storing states
opt.store_states = True
else:
for op in e_ops:
if op.dims != rho0.dims:
raise TypeError(f"e_ops dims ({op.dims}) are not "
f"compatible with the state's "
f"({rho0.dims})")
e_ops_data.append(spre(op).data)
if op.isherm and rho0.isherm:
output.expect.append(np.zeros(n_tsteps))
else:
output.expect.append(np.zeros(n_tsteps, dtype=complex))
else:
raise TypeError("Expectation parameter must be a list or a function")
if opt.store_states:
output.states = []
def get_curr_state_data(r):
return vec2mat(r.y)
#
# start evolution
#
dt = np.diff(tlist)
cdata = None
progress_bar.start(n_tsteps)
for t_idx, t in enumerate(tlist):
progress_bar.update(t_idx)
if not r.successful():
raise Exception("ODE integration error: Try to increase "
"the allowed number of substeps by increasing "
"the nsteps parameter in the Options class.")
if opt.store_states or expt_callback:
cdata = get_curr_state_data(r)
fdata = dense2D_to_fastcsr_fmode(cdata, size, size)
# Try to guess if there is a fast path for rho_t
if issuper(rho0) or not rho0.isherm:
rho_t = Qobj(fdata, dims=dims)
else:
rho_t = Qobj(fdata, dims=dims, fast="mc-dm")
if opt.store_states:
output.states.append(rho_t)
if expt_callback:
# use callback method
output.expect.append(e_ops(t, rho_t))
for m in range(n_expt_op):
output.expect[m][t_idx] = expect_rho_vec(e_ops_data[m], r.y,
e_ops[m].isherm
and rho0.isherm)
if t_idx < n_tsteps - 1:
r.integrate(r.t + dt[t_idx])
progress_bar.finished()
if opt.store_final_state:
cdata = get_curr_state_data(r)
output.final_state = Qobj(cdata, dims=dims,
isherm=rho0.isherm or None)
return output


I had been curious about Datura since I had first read about it in lycaeum back in '96. In '98 I was in the caribbean at a beach house when on a walk a plant caught my attention. I looked for a second and behold it was exactly as I had seen in pictures on the internet. The long trumpet like flowers and the little seed pods dangling near the base clued me in to the fact that I had found my long sought after plant. I was stoked to say the least. I quickly ran and gathered a few handfuls of the leaves and took them back and stuffed them in a zip loc bag.
 I took the whole bag and boiled it in a pot with about 2 cups of water until the water boiled down to the amount that would fit a coffee mug. I strained out the leaves and made the raunchiest tasting iced tea I have ever encountered.
About an hour later I started to feel kind of feverish and hot. And my head felt tight. I got extremely tired and decided to lie down.  It felt like I had taken a paper towel and started wiping all traces of saliva from my mouth. It was so dry that I couldn't even swallow. No amount of water alleviated this horrible dry feeling. It was like there was a thin plastic coating between the water and my tormented mouth. My throat felt like it had sandpaper grating against it. I couldn't talk above a whisper and even if my mouth had been moist I don't know if I would have had the strength to talk. Reaching to my table by my bed for water took more energy than anything ever had. It felt like I had been completely sapped of all energy and had been plunged into a fevered delirium.
Then the phone rang and I had my friend answer it cuz I couldn't and then my friend tried to make me talk on it and I just couldn't. All I could do was mutter under my breath. It was that really shitty feeling you get like if your really tired after a speed binge where you have no energy to talk and someone keeps saying 'what??  Then after the phone call I just passed out.
But here is where it gets weird. At least I thought I had passed out. Apparently I layed there with my eyes open some of the time staring off at nothing or I was asleep but the strangest part was that I kept coughing. I wasn't sick and I don't remember coughing.  Though I had no recollection of it my friend most definitely did.  And he had to deal with my concerned mom coming into my room and somehow he covered for me. Yet I still was coughing. I woke up to find that he was gone but he told me what was up soon enough.
What I do remember of the night is little but it was vivid. There was this large portal in my back yard that I stepped through and then when I entered into the darkness of it I don't remember what happened. And also there had been some dreams I had that I thought were real stuff but hadn't happened. Like I believed one of my friends had been in a car wreck and when I asked her about it the next day she told me she hadn't been in one. It turned out I had dreamed/hallucinated it the night before. They weren't like dreams where in the morning you remember it as a dream, it was like these things had really happened. But that was all I remembered. So I am sure there was whole night of me travelling and doing stuff in my head but I didn't remember any of it except for a few things.
The next day I couldn't focus on anything that was within arms reach and one other experience that was really weird happened.  So I was lying in my bed and I wanted some water. I got up out of bed and went and got a glass of water and as I put it to my lips it disappeared and I realized I was back in bed with my eyes closed. So I got up and got water. And again it disappeared as I brought it to my lips and I was back in bed. This happened like 4 more times before I finally managed to roll in my bed and snap my eyes open to true reality. The weird thing is that it seemed so real.
But all in all it was a horrible experience. I mean I could see how it would sound cool that you would hallucinate, have real seeming lucid dreams, whatever, but it isn't at all. The physical discomfort itself is more than enough to discourage any more experimenting with the horrible effects of scopolamine. Maybe lower doses would have made it so I remembered more. But I don't know if remembering is necessarily a good thing when you're dealing with this junk.
Experience Reports are the writings and opinions of the individual authors who submit them.
Some of the activities described are dangerous and/or illegal and none are recommended by Erowid.


My first semester at BYU-Idaho I was a physics major with a geology emphasis. Then I decided to switch the two and became a Geology student with a physics minor. I took an introductory GIS course and loved it, ultimately switching degrees again to focus on it.
The Geospatial Computing degree at BYU-Idaho really feels like an Interdisciplinary Degree,but more focused and with a better name. As a student I have taken courses in geology, math, statistics, GIS, and programming. I've completed some very in-depth and rigorous projects in every subject except programming.
My goal with this project was to do apply the coding skills I'd learned from my courses thus far and to teach myself CSS, which I hadn't covered in any previous coursework. At my current job I have come in contact with it several times already and have not been able to perform the task at hand as well as I would like.
The true outcome of this website is not really the content seen on the webpages (although I did try and make it meaningful and applicable to anyone who may come across it), but the HTML and CSS code working behind the scenes. The code and the powerpoint presentation discussing it will be available on the Documents page for download.


Drag and drop an audio file onto the input below, then click the "Compute" button and let the magic happen!
Read more
Audio file
Start level (dB)
Duration (s)
OR
Start peak level (dB)
Both detections will be computed. The first one that will be triggered will define the position of the cue point.
Next level (dB)
Next peak level (dB)
Begin fade (s)
End fade (s)
Compute
{{ message }}
▶
Add to playlist
The playlist is empty.
Play Stop


White to play 62
pips White=114 Black=105
(CorrectAnswer= 0/0, ErrorScore= 0)
1. 22/16 15/13 eq: +0.594 62.64% (G:25.34% B:0.38%) 37.36% (G:13.71% B:1.12%) 2. 22/14 eq: +0.560 (-0.034) 62.19% (G:25.67% B:0.36%) 37.81% (G:13.69% B:1.09%) 3. 21/13 eq: +0.536 (-0.058) 58.14% (G:21.85% B:0.24%) 41.86% (G:10.08% B:0.38%) 4. 15/9* 9/7 eq: +0.518 (-0.076) 60.30% (G:20.62% B:0.24%) 39.70% (G: 8.61% B:0.26%) 5. 15/7 eq: +0.005 (-0.589) 43.30% (G:11.95% B:0.22%) 56.70% (G:13.08% B:0.43%)


WARNING: This file will be deleted from the dist folder after production build.
Focused Youtube extension is injected as a JS file into every Youtube page (file dist/assets/extension.js).
Check out development instructions in the README.md file: https://github.com/makaroni4/focused_youtube#development


We will often define a machine to include primitive
operations that are
actually very complex. For example, in sections \ref{sec:eceval} and
\ref{sec:compilation} we will treat JavaScript's environment
manipulations as primitive. Such abstraction is valuable because it
allows us to ignore the details of parts of a machine so that we can
concentrate on other aspects of the design. The fact that we have
swept a lot of complexity under the rug, however, does not mean that a
machine design is unrealistic. We can always replace the complex
primitives
by simpler primitive operations.
Consider the GCD machine. The machine has an instruction that computes the remainder of the contents of registers a and b and assigns the result to register t. If we want to construct the GCD machine without using a primitive remainder operation, we must specify how to compute remainders in terms of simpler operations, such as subtraction. Indeed, we can write a JavaScript function that finds remainders in this way:
We can thus replace the remainder operation in the GCD machine's data paths with a subtraction operation and a comparison test. Figure \ref{fig:gcd-machine-rem} shows the data paths and controller for the elaborated machine. The instruction \begin{figure}[H] \centering \maxsizebox{\linewidth}{0.8\paperheight}{\includegraphics[scale=0.8]{{img\string_original/Fig5.5b.std}.svg}} \caption{Data paths and controller for the elaborated GCD machine.} \label{fig:gcd-machine-rem} \end{figure}
assign("t", list(op("rem"), reg("a"), reg("b")))
controller( "test-b", list(test(list(op("="), reg("b"), constant(0))), branch(label("gcd-done")), assign("t", reg("a")), "rem-loop", test(list((op "<"), reg("t"), reg("b"))), branch(label("rem-done")), assign("t", list(op("-"), reg("t"), reg("b"))), go_to(label("rem-loop")), "rem-done", assign("a", reg("b")), assign("b", reg("t")), go_to(label("test-b"))), "gcd-done");\caption{Controller instruction sequence for the GCD machine in figure \ref{fig:gcd-machine-rem}.} \label{fig:gcd-machine-rem-controller} \end{figure}


TPPDF is a fast PDF builder for iOS using simple commands to create advanced documents!
Features • Communication • Example • Installation • Usage • Credits • License
Features
- Page header and footer
- Dynamic content layout with page alignment
- Support for tables and cell alignment
- Attributed strings
- Custom spacing
- Image support
- Horizontal line separators
- Custom indentation
- Custom top offset (good for layered rendering)
- Pagination
- Image caption
- Compress images
- Custom image size fit
- Image in the header and footer
- Horizontal line separators in the header and footer
- Generate PDF files directly to handle large PDF files (Details)
- PDF metadata
- Custom table styling
- You need more features? Checkout #Contribute
Communication
- If you need help, use Stack Overflow. (Tag ‘TPPDF’)
- If you’d like to ask a general question, use Stack Overflow.
- If you found a bug, open an issue.
- If you have a feature request, open an issue.
- If you want to contribute, submit a pull request.
Example
To run the example project, run pod try TPPDF
Usage
Building a PDF document is very easy:
First, you create a document with a paperformat…
let document = PDFDocument(format: .a4)
…then you add your information to a container…
document.addText(.contentCenter, text: "Create PDF documents easily.")
…then you render the document…
PDFGenerator.generateURL(document: document, filename: "Example.pdf")
…done!
If you need more details, start here:
Document creation
You can create a document using a predefined PDFPageFormat
or by creating a custom PDFPageLayout
:
let layout = PDFPageLayout()
let document = PDFDocument(layout: layout)
let document = PDFDocument(format: PDFPageFormat.a4)
Page Layout
The following values can be set to format the page:
size
— width and height of a pagemargin
— content inset on each side of a pagespace.header
— Space between header and content elementsspace.footer
— Space between footer and content elements
All values are in dots and are rendered using 72 DPI (dots per inch), as this is the default screen DPI.
You can also used the predefined formats. For details please refer to the source file PDFPageFormat.swift
If you need your page in landscape format, use the landscapeSize
variable.
Elements
TPPDF is element based. When adding any content to the document, you are actually adding an element. Then at the render process all elements are calculated and rendered. But first you need to understand the concept of the layout engine:
Container
Every element is placed in a specific container. Three containers exist: Header, Content, Footer. Additionally every container has an alignment: Left, Center, Right.
When you add an new element, you need to provide the correct container - the default container is ContentLeft
, therefore it is an optional parameter. During calculation it will place the element in the correct container and calculate the correct frame accordingly.
A good example would be the following:
let document = PDFDocument(format: .a4)
document.addText(.footerCenter, text: "Created using TPPDF for iOS.")
This command adds the text Created using TPPDF for iOS to the footer of all pages, because elements in the header and footer containers are placed on every page.
Header & Footer
Basically all elements which are either to either a header (headerLeft
, headerCenter
or headerRight
) or footer (footerLeft
, footerCenter
or footerRight
) container, are considered as header and footer elements and will be repeated on each page.
If a page does not have any content, e.g. an empty page in between two pages, the header and footer elements won’t be added to this page neither.
List of element types
… now let’s continue with the different kinds of elements.
Line Separator
let style = PDFLineStyle(type: .full, color: UIColor.darkGray, width: 0.5)
document.addLineSeparator(PDFContainer.contentLeft, style: style)
Adds a horizontal line with a specific style
in the given container
. This line is affected by the indentation
, therefore it is possible to change its width by setting a left and a right indentation before. See Line Style for details about the line styling.
Simple Text
To add a simple string text
with a custom lineSpacing
, you first need to create a PDFSimpleText
and the an add it to the document.
let text = "Some text!"
let spacing: CGFloat = 10.0
let textElement = PDFSimpleText(text: text, spacing: spacing)
document.addText(textObject: textElement)
For convenience you are also able to add an attributed string directly, and TPPDF will wrap it in a PDFSimpleText
for you.
document.addText(text: text, lineSpacing: spacing)
During the render process it will create an attributed string using the font set by setFont(font:)
and the text color set by setTextColor(color:)
.
Attributed Text
To add an attributed string to the document, you first need to create a PDFAttributedText
and then add it to the document.
let attributedTitle = NSMutableAttributedString(string: "Awesome attributed title!", attributes: [
NSFontAttributeName : UIFont.systemFontOfSize(28.0),
NSForegroundColorAttributeName : UIColor(red: 219.0 / 255.0, green: 100.0 / 255.0, blue: 58.0 / 255.0, alpha: 1.0)
])
let textElement = PDFAttributedText(text: title)
document.addAttributedText(textObject: attributedTitle)
For convenience you are also able to add an attributed string directly, and TPPDF will wrap it in a PDFAttributedText
for you.
document.addAttributedText(text: attributedTitle)
Image
To add an image to the document, you first need to create a PDFImage
which wraps the image and the customization.
let image = UIImage(named: "awesome-image")!
let imageElement = PDFImage(image: image)
document.addImage(image: imageElement)
A PDFImage
can also include a optional caption
which is either a PDFSimpleText
or PDFAttributedText
.
The caption is underneath the image and has the image width as the maximum available width.
If you set a size
it will try to fit in this size, defaults to CGSize.zero
which will then use the actual image pixel size. The image can either be scaled to fit the width
the height
or both. Adjust this by setting the sizeFit
to either
To minimize the file size, images can be compressed using JPEG compression, which can be modified by setting the quality
value between 0.0
for bad quality and 1.0
for best quality. Default value is 0.85
which gives good compression and good quality.
Images in one row
To create a image collage, you can add multiple images in a single row with a spacing
between them.
Just create an array of PDFImage
and add them as images in a row.
let images = [
PDFImage(image: UIImage(named: "Image-1.jpg")!,
caption: PDFAttributedText(text: NSAttributedString(string: "In this picture you can see a beautiful waterfall!", attributes: captionAttributes))),
PDFImage(image: UIImage(named: "Image-2.jpg")!,
caption: PDFAttributedText(text: NSAttributedString(string: "Forrest", attributes: captionAttributes))),
]
document.addImagesInRow(images: images, spacing: 10)
List
Create a PDFList
element with the indentation of each level. Each indentation level consists out of a pair of values, pre
setting the indentation before the list symbol and past
setting the distance between the symbol and the text.
If you do not provide enough indentation levels, e.g. you only define three but you add an element at the fourth level, the default value 0
will be used for pre
and past
.
let list = PDFList(indentations: [(pre: 0.0, past: 20.0), (pre: 20.0, past: 20.0), (pre: 40.0, past: 20.0)])
A list item consists out of a symbol
and an optional content
. The symbol is one of the following:
Doesn’t display a symbol before the content
If an item is nested and uses this symbol, it will take the same one as the parent.
Symbol is a middle-dot.
Symbol is a dash/minus.
PDFListItemSymbol.custom(value: String)
You need to provide any string value
which will then be used as the symbol. Be sure to set the indentation value correctly, as the indentation is not based on the symbol frame width.
PDFListItemSymbol.numbered(value: String?)
When the parent of multiple list items is of type numbered
then it will use the index as the symbol, starting with 1
and append a dot .
to the number.
If you provide value
this will be used for the parent item, in case you want to override the value.
Nested Lists
By adding a list item to another list item you can create nested lists:
list.addItem(PDFListItem(symbol: .numbered(value: nil))
.addItem(PDFListItem(content: "Introduction")
.addItem(PDFListItem(symbol: .numbered(value: nil))
.addItem(PDFListItem(content: "Text"))
.addItem(PDFListItem(content: "Attributed Text"))
))
.addItem(PDFListItem(content: "Usage")))
Now you have created a multi-level list element, you can add to the document:
document.addList(list: list)
Table
Create a PDFTable
element, which will now be customized.
let table = PDFTable()
Each cell has an optional content
of type PDFTableContent
, an optional style
of PDFTableCellStyle
and always an alignment
of PDFTableCellAlignment
.
Alignment
The aligmnet is one of the following PDFTableCellAlignment
:
topLeft
,top
,topRight
left
,center
,right
bottomLeft
,bottom
,bottomRight
During calculation the size of the content will be calculated, and afterwards it will be positioned using the cell alignment.
Content
A cell content instance PDFTableCellContent
has a content
value and a property type
, which is one of the following:
PDFTableContent.none
, empty cellPDFTableContent.string
, a simple string only styled through the cell stylePDFTableContent.attributedString
, an attributed string which won’t be changed by the cell stylePDFTableContent.image
, an image which
If a cell height is too big for the rest of the page, it will be placed on the next page.
Cell Style
To define the style of a cell, you can create the an instance of PDFTableCellStyle
and directly set it to the cells style
property, but you can also style a whole table using the property style
of type PDFTableStyle
of the table
.
A cell style defines the fill
and the text
color of the content. Also it defines how the border
is drawn and what font
should be used:
let colors = (fill: UIColor.blue, text: UIColor.orange)
let lineStyle = PDFLineStyle(type: .dashed, color: UIColor.gray, width: 10)
let borders = PDFTableCellBorders(left: lineStyle, top: lineStyle, right: lineStyle, bottom: lineStyle)
let font = UIFont.systemFont(ofSize: 20)
let style = PDFTableCellStyle(colors: colors, borders: borders, font: font)
An instance of PDFTableCellBorders
allows you set each border of a cell indvidually. The line style is defined as a PDFLineStyle
(See Line Style).
To change the style of a specific cell, use the following method of table
:
do {
try table.setCellStyle(row: 1, column: 1, style: PDFTableCellStyle(colors: (fill: UIColor.yellow, text: UIColor.black)))
} catch PDFError.tableIndexOutOfBounds(let index, let length){
// In case the index is out of bounds
print("Requested cell is out of bounds! \(index) / \(length)")
} catch {
// General error handling in case something goes wrong.
print("Error while setting cell style: " + error.localizedDescription)
}
Table style
A table style is a collection of cell styles, which will be applied as global values. Take a look at PDFTableStyleDefaults
where you can find a collection of presets, e.g. PDFTableStyleDefaults.simple
.
Using the table style you can define the outline
line style. This will be drawn around the table on each page.
A PDFTableStyle
lets you set how many rows and columns are considered header cells, and how many rows should be styled as footer rows:
let style = PDFTableStyle()
style.rowHeaderCount = 3
style.columnHeaderCount = 5
style.footerCount = 1
Now the top five rows will be styled using the style.columnHeaderStyle
, the first three columns will be styled using the style.rowHeaderStyle
and the very last row will be styled using the style.footerStyle
.
All other cells are styled using the style.contentStyle
and if the optional value style.alternatingContentStyle
is set, then every other row will use this style.
If there are conflicts, e.g a cell is a column and a header row, then the following priority order, with the higher ones beating the lower ones, is used:
cell.style
, a custom style set for this particular cellstyle.columnHeaderStyle
, if the cell is a column header therefore in the top rowsstyle.footerStyle
, if the cell is a footer rowstyle.rowHeaderStyle
, if the cell is in the one of the first columnsstyle.alternatingContentStyle
, if the cell is has an odd row indexstyle.contentStyle
, the style every normal cell has
If you set the property table.showHeadersOnEveryPage
to true
, the first rows which are the column headers, will be copied and inserted at the top of the table, after each page break.
Table generation
First, add your cell data and set the alignment for each cell. This needs to be wrapped in a try-catch
because it can fail with invalid data or if the validation fails.
The quickest way to generate a new table is using generateCells(data:, alignments:)
. You need to pass two two-dimensional arrays, one with the data which can be nil
, String
, NSAttributedString
, Int
, Double
, Float
or an UIImage
. Numbers will be converted into simple strings. Any other content will throw a PDFError.tableContentInvalid
:
do {
try table.generateCells(data: [
[nil, "Name", "Image", "Description"],
[1, "Waterfall", UIImage(named: "Image-1.jpg")!, "Water flowing down stones."],
[2, "Forrest", UIImage(named: "Image-2.jpg")!, "Sunlight shining through the leafs."],
[3, "Fireworks", UIImage(named: "Image-3.jpg")!, "Fireworks exploding into 100.000 stars"],
[4, "Fields", UIImage(named: "Image-4.jpg")!, "Crops growing big and providing food."],
[1, "Waterfall", UIImage(named: "Image-1.jpg")!, "Water flowing down stones."],
[2, "Forrest", UIImage(named: "Image-2.jpg")!, "Sunlight shining through the leafs."],
[3, "Fireworks", UIImage(named: "Image-3.jpg")!, "Fireworks exploding into 100.000 stars"],
[4, "Fields", UIImage(named: "Image-4.jpg")!, "Crops growing big and providing food."],
[nil, nil, nil, "Many beautiful places"]
],
alignments: [
[.center, .left, .center, .right],
[.center, .left, .center, .right],
[.center, .left, .center, .right],
[.center, .left, .center, .right],
[.center, .left, .center, .right],
[.center, .left, .center, .right],
[.center, .left, .center, .right],
[.center, .left, .center, .right],
[.center, .left, .center, .right],
[.center, .left, .center, .right],
])
} catch PDFError.tableContentInvalid(let value) {
// In case invalid input is provided, this error will be thrown.
print("This type of object is not supported as table content: " + String(describing: (type(of: value))))
} catch {
// General error handling in case something goes wrong.
print("Error while creating table: " + error.localizedDescription)
}
You are also able to create each cell individually, put them in a two-dimensional cell array and assign it to table.cells
directly. The method above is simply added for convenience.
Layout
The table height is defined by its content, but the width is the available space between the indentations.
The width of each column is set by a relative width, defined in an array of values between 0.0
and 1.0
which should sum up to 1.0
being 100%
of the width.
table.widths = [0.1, 0.3, 0.4, 0.2]
Also each cell can have a margin
which is the distance between the cell frame and its inner borders and the padding
as the distance between the inner borders and the content.
…and finally you add the table to the document:
document.addTable(table: table)
Helpers
The following methods of PDFDocument
are not considered as elements, as they are only runtime changes to the calculations and rendering.
Space - addSpace(_ container: PDFContainer, space: CGFloat)
Adds a space with the height of space
between the previous element and the next element.
document.setSpace(space: 32.0)
Simple Text Font - setFont(_ container: PDFContainer, font: UIFont)
Sets the font of a container. This font will be used in all following elements of type PDFSimpleText
in the given container, until the font is changed. This font does not affect PDFAttributedText
elements.
document.setFont(font: UIFont.systemFont(ofSize: 20.0))
Reset Simple Text Font - resetFont(_ container: PDFContainer)
This resets the font to the default font, which is UIFont.systemFont(ofSize: UIFont.systemFontSize)
document.resetFont(.contentLeft)
Simple Text Color - setTextColor(_ container: PDFContainer, color: UIColor)
Sets the font of a container. This font will be used in the next commands in the given container, if there is not a different font specified.
document.setFont(UIFont.systemFont(ofSize: 20.0))
Reset Simple Text Color - resetTextColor(_ container: PDFContainer)
This resets the font to the default font, which is UIFont.systemFont(ofSize: UIFont.systemFontSize)
document.resetFont(.contentLeft)
setIndentation(_ container: PDFContainer, indent: CGFloat, left: Bool)
Set the indentation to a given indent
in the container. By setting left
to false
you will change the indentation from the right edge.
document.setIndentation(indent: 50.0, left: true)
document.setIndentation(indent: 50.0, left: false)
Now the document has an indentation of 50
points from left and right edge.
If you need to reset the indentation, call the function with 0.0
as parameter
document.setIndentation(indent: 0.0)
setAbsoluteOffset(_ container: PDFContainer, offset: CGFloat)
Sets the offset in points from the top edge of a container
to the given parameter offset
.
This is useful if you need to layer multiple elements above each other.
Page Break
Simply call document.createNewPage()
and it will add a page break. The next element will be positioned on the next page.
Styling objects
Line Style
A PDFLineStyle
can have one a line type
, a color
and a width
. The following types are currently impelemented:
PDFLineType.none
, invisible linePDFLineType.full
, a full linePFDLineType.dashed
, a dashed line with the dash length and spacing three times the line widthPDFLineType.dotted
, a dotted line with the spacing two times the line width
Pagination
To customize pagination, create an instance of PDFPagination
and set it to the pagination
property of your document or simply edit the default one.
Pagination needs one container where it will add the pagination elements on each page. This defaults to .none
which results in no pagination added.
It is possible to set pagination range
with a start
and end
index. You can also hide specific pages, by adding the page nunber to the hiddenPages
property. The range is set default to include all pages.
As an example this won’t paginate page 1
, 2
, 5
nor any page above 7
:
let pagination = PDFPagination()
pagination.range = (start: 3, end: 7)
pagination.hiddenPages = [5]
To actually define the style
of the pagination, you can either choose on of the predefined ones, or create a custom closure-based style. The pagination algorithm receives the current
page number and the total
pages amount and returns a String, which will then be transformed into an attributed text element, using the attributes in the textAttributes
dictionary.
.default
This is the default pagination setting, converts page 1
of 3
to 1 - 3
.roman(template: String)
Page 8
of 13
will be converted into roman numerals VIII
and XIII
and inserted in the format, e.g %@ _|_ %@
becomes VIII _|_ XIII
. The main idea of this preset is converting the numbers into roman numerals but configure the text using the format.
.customNumberFormat(let template, numberFormatter: NumberFormatter)
Both numbers are converted into a string using the provided numberFormatter
. This allows you to use the full capabilities of the built-in formatter class. Afterwards both values are also inserted into the provided template
.
Example:
let formatter = NumberFormatter.init()
formatter.alwaysShowsDecimalSeparator = true
formatter.numberStyle = .currency
formatter.currencyCode = "EUR"
let template = "%@ + %@"
Page 8
of 13
will return the following: €8.00 + €13.00
which might be completly unsuitable as a pagination, but displays the possibilities. :)
customClosure(closure: (_ page: Int, _ total: Int) -> String)
The closure
will be called everytime the generator needs the pagination value. You have full control on how the resulting string will look like.
Example:
PDFPaginationStyle.customClosure({ (page, total) -> String in
let separator: String = {
switch page % 4 {
case 1:
return "#"
case 2:
return "&"
case 3:
return "*"
default:
return "-"
}
}()
return "\(page) " + separator + " \(total)"
})
This example will return a different separator, depending on the modulo result.
MORE!
If you want a specific style to be included in the presets, please open an issue! The more presets can be provided the better for everyone!
Document Info
To store metadata information in the document, change the values of the info
property.
You are able to set a title
, author
, subject
and keywords
.
If you need to encrypt the document, set an owner password
and a user password
. Also you can restrict printing and copying by setting the allows printing
and allows copying
flags.
Installation
Requirements
| Language | Branch | Pod version | Xcode version | iOS version |
|---|---|---|---|---|
| Swift 4.1 | master | >= 1.0.x | Xcode 9.3 or greater | iOS 8.3+ |
| Swift 3.0 | master | >= 0.2.x | Xcode 8 or greater | iOS 8.0+ |
| Swift 2.3 | swift-2.3 | 0.1.5 | Xcode 8, Xcode 7.3.x | iOS 8.0+ |
| Swift 2.2 | swift-2.2 | 0.1.4 | Xcode 7.3.x | iOS 8.0+ |
CocoaPods
CocoaPods is a dependency manager for Cocoa projects. You can install it with the following command:
$ gem install cocoapods
To integrate TPPDF into your Xcode project using CocoaPods, specify it in your Podfile
:
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '10.0'
use_frameworks!
target '<Your Target Name>' do
pod 'TPPDF'
end
Then, run the following command:
$ pod install
Carthage
Carthage is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks.
You can install Carthage with Homebrew using the following command:
$ brew update
$ brew install carthage
To integrate TPPDF into your Xcode project using Carthage, specify it in your Cartfile
:
github "Techprimate/TPPDF" ~> 1.0
Run carthage update
to build the framework and drag the built Alamofire.framework
into your Xcode project
Swift Package Manager
Swift Package Manager is not supported, as TPPDF requires the framework UIKit
which is not available on macOS or Linux.
Manually
If you prefer not to use either of the aforementioned dependency managers, you can integrate TPPDF into your project manually.
Embedded Framework
- Open up Terminal,
cd
into your top-level project directory, and run the following commandif
your project is not initialized as a git repository:
$ git init
- Add TPPDF as a git submodule by running the following command:
$ git submodule add https://github.com/Techprimate/TPPDF.git
Open the new
TPPDF
folder, and drag theTPPDF.xcodeproj
into the Project Navigator of your application’s Xcode project.It should appear nested underneath your application’s blue project icon. Whether it is above or below all the other Xcode groups does not matter.
Select the
TPPDF.xcodeproj
in the Project Navigator and verify the deployment target matches that of your application target.Next, select your application project in the Project Navigator (blue project icon) to navigate to the target configuration window and select the application target under the
Targets
heading in the sidebar.In the tab bar at the top of that window, open the
General
panel.Click on the
+
button under theEmbedded Binaries
section.You will see two different
TPPDF.xcodeproj
folders each with two different versions of theTPPDF.framework
nested inside aProducts
folder.It does not matter which
Products
folder you choose from, but it does matter whether you choose the top or bottomTPPDF.framework
.Select the top
TPPDF.framework
for iOS and the bottom one for OS X.You can verify which one you selected by inspecting the build log for your project. The build target for
TPPDF
will be listed as eitherTPPDF iOS
orTPPDF OSX
.And that’s it!
The
TPPDF.framework
is automagically added as a target dependency, linked framework and embedded framework in a copy files build phase which is all you need to build on the simulator and a device.
Apps using TPPDF
If you are using TPPDF in your app and want to be listed here, simply create a pull request or let me know on twitter or via github. I am always curious who is using my projects :)
Hikingbook - by Zheng-Xiang Ke
Bug Journal - by David Johnson
Mama’s Cookbook (future release) - by Philip Niedertscheider
Credits
TPPDF is created by Philip Niedertscheider, owned by techprimate
Contributors
- Philip Niedertscheider, techprimate-phil
- Zheng-Xiang Ke, kf99916
Thank You
Special thanks goes to Nutchaphon Rewik for his project SimplePDF for the inspiration.
License
TPPDF is available under the MIT license. See the LICENSE file for more info.


In general, developing plugins for jMonkeyPlatform is not much different than creating plugins for the NetBeans Platform which in turn is not much different than creating Swing applications.
So if you feel like you want to make an addition to jMonkeyPlatform dont hesitate to contact the jme team regardless of your knowledge in NetBeans platform development. For new plugins, the basic project creation and layout of the plugin can always be handled by a core developer and you can go on from there creating a jme / swing application like you are used to.
Note however that by using the Platform functions, your plugin feels more like a Platform application (global save button, file type support etc.).
Learn more about NetBeans Plugin Development at .


$BTC update: Did you sell everything yet?
 It has been in a ear market since 2011 you plebs
#bitcoin #crypto
meatspoon10-Dec-18 02:16 AM
The text "In 2011, BTC couldn't break the resistance and has since been in a bear market" seems, uh, suspect. This has been a bear market this whole time?
Komodo is preparing to activate a major update to the Komodo code base. Learn more about all the new tech features coming to Komodo on December 15, 2018.
Twitch.KNZN10-Dec-18 09:52 PM
do you think the price is already factored in
we seen a spike from 1300
yorklab10-Dec-18 09:52 PM
No idea. Bitcoin controls much of the Alt's price, so who knows.
Twitch.KNZN10-Dec-18 09:53 PM
and volume looks very weak but there isnt much sell action so alot off long term investorsd
grewalsatinder11-Dec-18 12:07 AM
I can buy some KMD with BTC here
Can msg me
AndrewK11-Dec-18 12:24 AM
Have a friend buying any large volumes of top 250 coins - KMD included. $100K USD+ in coins. DM me
Stinkfist11-Dec-18 01:22 AM
@FishyGuts do not Trade with this guy, he will not send the coins he is Scammer!
5
NutellaLicka11-Dec-18 01:25 AM
Are you sure you've got the right fishyguts?
Check the #5085 after the name. There was a scammer impersonating him a month or so ago, could be that. Unless you're trolling. Because FishyGuts is trustworthy and many would vouch for him
Stinkfist11-Dec-18 01:32 AM
yes i have the right guy
NutellaLicka11-Dec-18 01:33 AM
Okay, well I'd just wait to hear back from him. He is a trusted member of the community.
Stinkfist11-Dec-18 01:38 AM
i sent him .024 bitcoin for 2100 C25 over 24 hours ago . said he would send me my coins after 2 confirmations and have yet to see them.. I can post our entire conversation if that helps... i would just like what i paid for or my BTC back
NutellaLicka11-Dec-18 01:41 AM
It would not help, no. I haven't seen him on much the last day or two. So maybe just wait for him to get back. Again, he is a trusted member of the community
Stinkfist11-Dec-18 01:43 AM
he is on now, i have sent him a message everytime i see him online now i get no response, hoping this will guilt him in to doing the right thing...or i will continue to warn everyone about him
NutellaLicka11-Dec-18 01:44 AM
I will see if I can get in contact with him
FishyGuts11-Dec-18 01:46 AM
So my friend who had eth last January was told by me to sell at least his original investment. He didn’t.
Now he just asked me “eth is $2 above where I bought it, should I sell?”
I love the Smells of capitulation in the morning.
@Stinkfist I assure you that was not me.
Go to the private chat and click the user. What’s the # after their name?
I was at the LA auto show all day yesterday and 4x4 all day before that. Definitely did no crypto stuff this weekend.
What is c25?
Post the conversation is fine but check the # after the user.
We’ve had people impersonate me in the past on pirate.
Stinkfist11-Dec-18 01:48 AM
6295
FishyGuts11-Dec-18 01:48 AM
Shit man.
I’m sorry. That’s not me.
Does it still say FishyGuts with my pic or deleted user?
I keep having shossain or others block the frauds.
Stinkfist11-Dec-18 01:49 AM
well this sucks...
FishyGuts11-Dec-18 01:49 AM
@SHossain can you block FishyGuts6295
Stinkfist11-Dec-18 01:49 AM
yep everything is the same
FishyGuts11-Dec-18 01:50 AM
I lost 390 KMD last month trying to buy those A9s the guy was selling in the mining room.
I feel your pain.
Luckily @Deleted User is working on a solution for trading OTC.
2
Stinkfist11-Dec-18 01:52 AM
sorry man didnt even know that was something you can, why does discord allow that, same name...
blackjok3r11-Dec-18 01:53 AM
Man we need to finish the blockchain based caht dAPP... that helps a fair bit... as each person is a pubkey with a name as their alias... reamoves hte abilty for impersonation.
1
FishyGuts11-Dec-18 01:55 AM
No need to be sorry. Communication solves most problems. The admins will ban that user but someone can do it again. Sad, I agree.
So Pirate wants to fight that. We have a discord Escrow bot in development AND @Deleted User is working on another solution too.
blackjok3r11-Dec-18 01:55 AM
Like every chat platfrom allows this stupid thing... but short of having KYC for discord, what can you even do about it lol.
Hermes11-Dec-18 01:55 AM
I dont see the alias anymore
FishyGuts11-Dec-18 01:56 AM
WHats the name in your chat log now @Stinkfist ?
Hermes11-Dec-18 01:56 AM
if you see him again let me know and I will ban him
FishyGuts11-Dec-18 01:56 AM
Either changes name or deleted user
Deleted User11-Dec-18 01:56 AM
Hopefully we ll bridge the chatbot to an api ^^
1
Stinkfist11-Dec-18 02:08 AM
he was not i. this discord he was in the C25 one its a new coin. the name is still the same
I found you in this discord based on your twitter account
Vertigo11-Dec-18 02:28 AM
Man this volumes are so shitty #1 on bittrex by volume has 411btc
Followed by eth 254btc
Last year at this time 411btc will put you in the second page


12
1 The men of the tribe of Ephraim called together their soldiers, and they crossed the Jordan River and went to the town of Zaphon to talk with Jephthah. They said to him, "Why did you not ask us to help your army fight the Ammonites.
2 Jephthah replied, "The Ammonites oppressed us. And I asked you to come and rescue us from them, you refused. When I called to you, you did not come to our rescue.
3 When I saw that you would not come to help us, I risked my own life by leading our people to pass through the people of Ammon. And Yahweh helped us to defeat them. So why do you come to fight against me today?"
4 Then Jephthah called together the soldiers of Gilead to fight against the soldiers of Ephraim. They attacked them because men of the tribe of Ephraim said, "You men from Gilead are just refugees here in the land of Ephraim and Manasseh.
5 The Gileadites captured the low places in the Jordan River where people could cross over the river and go to the territory of Ephraim. If someone from the tribe of Ephraim came to the ford to try to escape, he would say, "Allow me to cross the river." Then the men of Gilead would ask him, "Are you from the tribe of Ephraim?" If he said "No,"
6 they would say to him, "Say the word 'Shibboleth.'" The men of Ephraim could not pronounce that word correctly. So if the person from the tribe of Ephraim said "Sibboleth," they would know that he was lying and that he was really from the tribe of Ephraim, and they would kill him there at the ford.
So the men of Gilead killed forty-two thousand people from the tribe of Ephraim at that time.
7 Jephthah, the man from Gilead, served as a judge and leader over Israel for six years. Then he died and was buried in one of the towns of Gilead.
8 After Jephthah died, a man named Ibzan, from Bethlehem, became a leader and a judge over Israel.
9 He had thirty sons and he gave thirty daughters away in marriage. He brought in thirty daughters from families outside his clan. He was a leader and a judge over Israel for seven years.
10 When died, he was buried in Bethlehem.
11 After Ibzan died, a man named Elon, from the tribe of Zebulun, became a leader of Israel. He was their leader for ten years.
12 Then he died and was buried in the city of Aijalon in the area where the tribe of Zebulun lives.
13 After Elon died, a man named Abdon son of Hillel, from the city of Pirathon, became a leader and a judge over Israel.
14 He had forty sons and thirty grandsons. They had seventy donkeys. Abdon was a leader and a judge over Israel for eight years.
15 When Abdon died, he was buried in Pirathon, in the land of Ephraim, in the hill country of the Amalekites.


Cambodia’s opposition leader in Indonesia plotting next move
by The Associated PressJAKARTA, Indonesia (AP) — Exiled Cambodian opposition leader Sam Rainsy has arrived in Indonesia to meet some of the country’s lawmakers as he considers when and how to make his long-awaited return to his homeland.
Sam Rainsy flew in from Malaysia after failing to make his planned return to Cambodia on Saturday. He was barred by Cambodian authorities who also won cooperation from some neighboring countries and airlines to hinder his freedom of movement.
He said on arrival Thursday in Jakarta that he plans to meet some Indonesian lawmakers and civil society groups during his visit. He says he intends to return to Cambodia at the earliest possible opportunity to continue his mission to lead a movement to unseat Cambodian’s long-serving authoritarian prime minister, Hun Sen.
___
This story has been corrected to state that Sam Rainsy arrived in Jakarta on Thursday, not Friday.
The Associated Press


Mushrooms - P. mexicana
I began the day with a light breakfast and skipped lunch so there wouldn’t be too much in my stomach to soften the effects. Then just before taking the truffles I had a small snack to get the juices going. In the morning I had spent a small time meditating in silence in my room, maybe ten/fifteen munites. Just clearing my mind, calming my body. We had just over 30 grams between three of us and we divided it up fairly roughly. We didn’t eat them all at once. We each ate our ten grams in three portions with about an hours gap in between. In my experience this makes coming up far more relaxed and increases the duration of the trip.
After about an hour I just seemed to relax completely in to the big black leather armchair I was sitting in, comfortably numb and drowsy. The other two where like cut-out figures to my left and right, I was unable to talk or relate to any conversation for some time and any attempt interact ended before it had started with manic giggling. This seemed to be affecting Kelly as well while Chris in his camping chair slipped in to silence. It felt like the trip was coming in waves, each stronger than the last, each taking me to a new unexplored level. I tried to relax, avoid panic and let the waves wash over me. For the best experience I find it is best to stay calm and still and meditate while coming up.
After watching TV for a bit I looked around the room and was suddenly jerked awake, I felt vibrant, alive and aware of my entire physical body. The friction of blood in my veins, the movement of my diaphragm, the tensing of muscles, the clenching of my heart. I looked down at my hands and was acutely aware of the bones within, I could feel the flesh sliding over the bone internally while my normal sense of external touch was reduced so every thing felt like cold chrome. Moving my hands became a beautiful ballet of stretching sinew and the movement left a purple trail in the air. Amazing.
I was aware that Kelly and Chris were talking but was completely absorbed in myself. Closed eye visuals were crowding in. fractal shapes in cool blues and violets emerging from the horizon point and drifting towards and past my vision. The most vivid of these was four liner fractals that emerged from each corner of my vision. They moved in creating a square and then each line exploded out into a wing shape of misty blue. The whole structure of four transparent intersecting wings rotated and then sped past me.
I opened my eyes and laughed, Kelly said I had been muttering to myself and was laughing. Colours in the room were ecstatic, like vibrant paint with no shading between light and dark areas. Like drippy cell shading. We all started talking and during the conversation I found I could shift between the layers my mind was processing. To explain; there was the layer of the conversation, the layer of my own train of thought (completely unrelated to the conversation), and the layer of my physical bodily processes. I could completely immerse myself in any of these forgetting the other two but when I returned to the conversation layer I knew exactly what had been said. Of course I had been listening all along but it was like I was a little man looking at the workings of my mind from an objective point of view only seeing one operation at a time.
Suddenly we all entered a very active phase, we sprung to our feet and began to explore the room. I felt springy and soft and perspective became very distorted. Whereas before, when we were coming up, we were on different planes, now we came together, started to explain how we were seeing things and it rely felt like our minds were connected. We were finishing each others sentences.
Chris mentioned the clutter on the floor and it became a tiny city environment. We all put our heads to the floor and explored the juice cartons, plates, boxes, magazines and musical instruments as if we were tiny, inch high, people. The room really was a playground and we were tiny children seeing it all for the first time.
We started to talk about the notion of all we are experiencing at a given point being all of our reality. This seemed to make Kelly nervous and when Chris mentioned going down stairs she froze up, afraid of the corridor outside. For her it had become a void because she couldn’t see it at that point, then when we opened the door she said it looked like something out of a horror movie. Blood stained walls and peeling paper. She talked of a terrible sense of foreboding.
Me and Chris couldn’t understand this and I tried to talk her out of it. I was still in a euphoric state, and I said “Being afraid of an empty corridor is as absurd as being afraid of an inanimate object like a …cheesecake!” but even as I said this I began to feel uneasy looking at the expression of fear on Kelly’s face. The prospect of being afraid of a cheesecake seemed more and more like a genuine possibility.  It was there for a split second and was gone. I remember thinking how absurd this was at the time but the feeling was still very real.
All this time everything felt dreamy and unreal and I remember looking in the bathroom mirror and seeing my face In vivid contrasting colours like clown make up. My features were hilariously distorted and I didn’t recognise myself at all. At one point gravity left all of us completely at the same time. The wall was the floor then the ceiling was the floor, it felt like we were stuck on the ceiling and I remember looking DOWN at the light shade. Unsettling.
At the peak of my trip I stood up and leant on the wall, pushing my fingertips into it. My core was vibrating, my fingers were buzzing and I felt the same vibration pouring out of the wall, the room, everything. I lost my physical self, normal senses left me for a second and I rolled along the wall and into the corner of the room laughing ecstatically. I was overwhelmed by the profound feeling of being the wall, of the wall being me, of me being everything, and everything being connected by this vibration. I was feeling with a non physical sense. Not touch, taste, or even sight. I felt my sphere of existence in its simplest and most profound state, without ego, without a centre. I could not be afraid because I was no more. My friends were distant shapes looking at me, I knew they were people but I wasn't one of them. As this passed my memories flooded back like warm water. My self retuned to me.
Experience Reports are the writings and opinions of the individual authors who submit them.
Some of the activities described are dangerous and/or illegal and none are recommended by Erowid.


Display a moveable marker on a map
This example displays a moveable map of Boston, including a marker. The marker can also be moved around the map.
Default markers are created by using the H.map.Marker
class without specifying an icon and passing in a location only.
To respond to drag events the marker.draggable
flag needs to be set. The default panning interaction of the
map (H.mapevents.Behavior
) must be disabled whilst the drag
event is in operation.


Background
Quick links:
- Why another metrics library?
- Moving Averages
- Histograms and Percentiles
- Application Modes - Normal, Heavy, Unresponsive
- BucketTimedMetric
- Agent enhancement
Why another metrics library?
When I began looking for a Java metrics library to adopt I ended up using and forking Coda Hale Metrics which is a very successful metrics library. For Timed events Coda Hale metrics emphasises Histograms/percentiles and Moving Averages . Avaje metrics is orientated towards reporting metrics every minute or better and in that scenario I developed a significant preference for simpler and cheaper counters (count, total, average, max) as well as some other features - separate error statistics, BucketTimedMetric.
Moving Averages
When collecting and reporting metrics every minute I found the expotentially weighted moving averages to be quite laggy. For interpreting minute by minute activity the simpler counters (count, total, mean, max) provided a much more accurate representation of the behaviour.
Histograms and Percentiles
Percentiles are definately the way to go if the period in which you are monitoring is relatively long. Said another way, if the period you are collecting metrics for is 1 hour then simple counters like mean and max can be next to useless - the server could have spent 55 minutes in normal millisecond response and then some resource gets maxed out and for 5 minutes the reponse times went off the charts - a single mean and max covering the 1 hour period is not going to provide much insight or help. You need to collect frequently enough so that you can discern the varous 'modes' of the application (normal/good, heavy load, terminal/unresponsive/dead) and that the statistics of these modes are relatively separate/distinct.
Histograms typically hold a sample size of collected metrics and in this sense they require more memory. In addtion they have more overhead compared to LongAdder and LongMaxUpdater.
Application Modes - Normal load, Heavy load, Unresponsive
Generalisations for applications are dangerous but frequently applications have different 'modes' based on the load they are handling.
- Good / Normal Load - Server responding as expected under light or moderate load. No resources have hit their limit.
- Heavy Load - One of the resources has hit a limit, response times take a jump.
- Unresponsive - Multiple resources hitting limits (perhaps with feedback on each other), response times make large jumps and tends towards unresponsive as load increases.
If your application has 'modes' then the response times do not increase in some linear fashion but instead 'jump' - there are inflection points at which the 'mode' changes and response times jump significantly. IF the collect statistics cover multiple 'modes' then a single mean and max that span both of those modes is relatively unhelpful - perhaps even useless.
Histograms excel when the statistics collected cover multiple 'modes' (and max and mean are not as useful). If you collect frequently enough then the issue when statistics span multiple 'modes' is reduced and you can use simpler and cheaper counters (count, total, mean, max).
BucketTimedMetric
One aspect of BucketTimedMetric is that it provides a simple way to separate the statistics collected for 'normal' mode response times from the other modes. Separating those statistics provides a clearer view that a single mean and max will not. BucketTimedMetric has other uses like clear monitoring of SLA requirements and monitoring a method that has multiple execution paths (fast path with cache hit, slower path with data fetch).
BucketTimedMetric also has the nice property that it can be aggregated accurately.
Agent enhancement
Agent enhancement provides the ability to instrument an existing application without requiring code changes. With the developer coding effort removed (at least for TimedMetric and BucketTimedMetric) you can get good application performance metrics at low cost to the project.
No excuses - any 7+ JVM application can have performance metrics collection.


| Package | Description |
|---|---|
| org.deidentifier.arx.algorithm |
This package provides implementations of search algorithms
|
| org.deidentifier.arx.framework.check |
This package implements the core functionality of the ARX framework, i.e., a highly efficient check for k-anonymity
|
| org.deidentifier.arx.framework.check.transformer |
This package provides several transformers that efficiently implement the 'projection' optimization.
|
| org.deidentifier.arx.framework.lattice |
This package provides the internal generalization lattice
|
| Class and Description |
|---|
| TransformationChecker
This class orchestrates the process of transforming and analyzing a dataset.
|
| Class and Description |
|---|
| TransformationApplicator
This class applies a transformation to the dataset.
|
| TransformationChecker.ScoreType
The type of scores.
|
| TransformationCheckerStateMachine.Transition
The resulting transition.
|
| TransformationCheckerStateMachine.TransitionType
The possible transition type.
|
| TransformationResult
The result of a check of a transformation.
|
| TransformedData
Helper class to convey buffers.
|
| Class and Description |
|---|
| TransformationCheckerStateMachine.TransitionType
The possible transition type.
|
| Class and Description |
|---|
| TransformationResult
The result of a check of a transformation.
|


This is an example of how to create an array of floats on the fly using the C-API.
module MakeArray{ omethod+notify_inst update() = "mk_array"; };
This MakeArray module utilizes the currently undocumented OMset_array_dims ( I think the variables are like OMget_array_dims....)
You can't create the object and then change the dimensions using OMset_array_size because that required that the array to be changed already BE an array. The object created with OMcreate_obj_from_path is not yet an array.
The module is provided as a simple example for developers, and is not for general use in an application.
n/a
n/a
n/a
This module is for developer information only and does not include an example application, or any other support macros.
xp_comm_proj/mk_array/mkarmods.v contains the MakeArray module V definition.
The low-level MakeArrayMods library containing the module MakeArray does not specify a process. By default the express process will be used.
Leigh J. Grundy, AVS Inc.
Paul G. Lever


Our neighborhood put on an Art Walk, where everyone was invited to display art in their yard, or do a performance. This is during the Covid-19 pandemic, so everyone was glad for a way to get out and have an experience in a way that left plenty of space for people to keep their distance.
Our street is part of a small group of new modern townhomes. As we are all relatively new to these homes, and they are tightly built together, we've made a point to have good communication.
We decided our street should try to participate in the larger neighborhood effort in a big way. I offered to create "coloring book" style posters that everyone could fill in and decorate however they like. We chose the theme of bird species that are found here in the neighborhood.
I made about a dozen of these.
It was a very rewarding feeling to have started a project that the neighborhood felt inspired to be involved with.


You can login on the web with your existing accounts.
You will be authenticated in the desktop app with the same account.
Login with password, Facebook, Google, and what not
You are now authenticated.
Start over


A Centennial History of Mount Vernon Iowa 1847-1947
This is a great book on Mount Vernon History and is Available to check out at the Cole Library and also to purchase from City Hall and the Visitor Center.
home


1 R Markdown basics
Here is a brief introduction to using R Markdown. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents and much, much more. R Markdown provides the flexibility of Markdown with the implementation of R input and output. For more details on using R Markdown see http://rmarkdown.rstudio.com.
1.1 Basic markdown syntax
1.1.1 Whitespace
Be careful with your spacing. While whitespace largely is ignored, it does at times give markdown signals as to how to proceed. As a habit, try to keep everything left aligned whenever possible, especially as you type a new paragraph. In other words, there is no need to indent basic text in the Rmd document (in fact, it might cause your text to do funny things if you do).
1.1.2 Italics and bold
- Italics are done like *this* or _this_
- Bold is done like **this** or __this__
- Bold and italics is done like ***this***, ___this___, or (the most transparent solution, in my opinion) **_this_**
1.1.3 Inline code
Inline code
is created with backticks like`this`
1.1.4 Sub and superscript
Sub2 and super2 script is created like this~2~ and this^2^
1.1.5 Strikethrough
Strikethroughis done ~~like this~~
1.1.6 ‘Escaping’ (aka “What if I need an actual asterisk?”)
- To include an actual *, _ or \, add another \ in front of them: \*, \_, \\
1.1.7 Endash (–), emdash (—)
- – and — with -- and ---
1.1.8 Blockquotes
Do like this:
Put a > in front of the line.
1.1.9 Headings
Section headers are created with #’s of increasing number, i.e.
- # First-level heading
- ## Second-level heading
- ### Etc.
In PDF output, a level-five heading will turn into a paragraph heading, i.e. \paragraph{My level-five heading}
, which appears as bold text on the same line as the subsequent paragraph.
1.1.10 Lists
Unordered list by starting a line with an * or a -:
- Item 1
- Item 2
Ordered lists by starting a line with a number. Notice that you can mislabel the numbers and Markdown will still make the order right in the output:
- Item 1
- Item 2
To create a sublist, indent the values a bit (at least four spaces or a tab):
- Item 1
- Item 2
- Item 3
- Item 3a
- Item 3b
1.1.11 Line breaks
The official Markdown way to create line breaks is by ending a line with more than two spaces.
Roses are red. Violets are blue.
This appears on the same line in the output, because we didn’t add spaces after red.
Roses are red.
Violets are blue.
This appears with a line break because I added spaces after red.
I find this is confusing, so I recommend the alternative way: Ending a line with a backslash will also create a linebreak:
Roses are red.
Violets are blue.
To create a new paragraph, you put a blank line.
Therefore, this line starts its own paragraph.
1.1.12 Hyperlinks
- This is a hyperlink created by writing the text you want turned into a clickable link in
[square brackets followed by a](https://hyperlink-in-parentheses)
1.1.13 Footnotes
- Are created1 by writing either ^[my footnote text] for supplying the footnote content inline, or something like
[^a-random-footnote-label]
and supplying the text elsewhere in the format shown below:2
[^a-random-footnote-label]: This is a random test.
1.1.15 Math
The syntax for writing math is stolen from LaTeX. To write a math expression that will be shown inline, enclose it in dollar signs. - This: $A = \pi*r^{2}$ Becomes: \(A = \pi*r^{2}\)
To write a math expression that will be shown in a block, enclose it in two dollar signs.
This: $$A = \pi*r^{2}$$
Becomes: \[A = \pi*r^{2}\]
To create numbered equations, put them in an ‘equation’ environment and give them a label with the syntax (\#eq:label)
, like this:
\begin{equation}
f\left(k\right) = \binom{n}{k} p^k\left(1-p\right)^{n-k}
(\#eq:binom)
\end{equation}
Becomes: \[\begin{equation} f\left(k\right)=\binom{n}{k}p^k\left(1-p\right)^{n-k} \tag{1.1} \end{equation}\]
For more (e.g. how to theorems), see e.g. the documentation on bookdown.org
1.2 Executable code chunks
The magic of R Markdown is that we can add executable code within our document to make it dynamic.
We do this either as code chunks (generally used for loading libraries and data, performing calculations, and adding images, plots, and tables), or inline code (generally used for dynamically reporting results within our text).
The syntax of a code chunk is shown in Figure 1.1.
Common chunk options include (see e.g. bookdown.org):
echo
: whether or not to display code in knitted outputeval
: whether or to to run the code in the chunk when knittinginclude
: whether to include anything from the from a code chunk in the output documentfig.cap
: figure captionfig.scap
: short figure caption, which will be used in the ‘List of Figures’ in the PDF front matter
IMPORTANT: Do not use underscoores in your chunk labels - if you do, you are likely to get an error in PDF output saying something like “! Package caption Error: \caption outside float.”
1.2.1 Setup chunks - setup, images, plots
An R Markdown document usually begins with a chunk that is used to load libraries, and to set default chunk options with knitr::opts_chunk$set
.
In your thesis, this will probably happen in index.Rmd and/or as opening chunks in each of your chapters.
```{r setup, include=FALSE}
# don't show code unless we explicitly set echo = TRUE
knitr::opts_chunk$set(echo = FALSE)
library(tidyverse)
```
1.2.2 Including images
Code chunks are also used for including images, with include_graphics
from the knitr
package, as in Figure 1.2
::include_graphics("figures/sample-content/beltcrest.png") knitr
Useful chunk options for figures include:
out.width
(use with a percentage) for setting the image size- if you’ve got an image that gets waaay to big in your output, it will be constrained to the page width by setting
out.width = "100%"
Figure rotation
You can use the chunk option out.extra
to rotate images.
The syntax is different for LaTeX and HTML, so for ease we might start by assigning the right string to a variable that depends on the format you’re outputting to:
if (knitr::is_latex_output()){
<- "angle=180"
rotate180 else {
} <- "style='transform:rotate(180deg);'"
rotate180 }
Then you can reference that variable as the value of out.extra
to rotate images, as in Figure 1.3.
1.2.3 Including plots
Similarly, code chunks are used for including dynamically generated plots.
You use ordinary code in R or other languages - Figure 1.4 shows a plot of the cars
dataset of stopping distances for cars at various speeds (this dataset is built in to R).
%>%
cars ggplot() +
aes(x = speed, y = dist) +
geom_point()
Under the hood, plots are included in your document in the same way as images - when you build the book or knit a chapter, the plot is automatically generated from your code, saved as an image, then included into the output document.
1.2.4 Including tables
Tables are usually included with the kable
function from the knitr
package.
Table 1.1 shows the first rows of that cars data - read in your own data, then use this approach to automatically generate tables.
%>%
cars head() %>%
::kable(caption = "A knitr kable table") knitr
| speed | dist |
|---|---|
| 4 | 2 |
| 4 | 10 |
| 7 | 4 |
| 7 | 22 |
| 8 | 16 |
| 9 | 10 |
- Gotcha: when using
kable
, captions are set inside thekable
function - The
kable
package is often used with thekableExtra
package
1.2.5 Control positioning
One thing that may be annoying is the way R Markdown handles “floats” like tables and figures. In your PDF output, LaTeX will try to find the best place to put your object based on the text around it and until you’re really, truly done writing you should just leave it where it lies.
In general, you should allow LaTeX to do this, but if you really really need a figure to be positioned where you put in the document, then you can make LaTeX attempt to do this with the chunk option fig.pos="H"
, as in Figure 1.5:
::include_graphics("figures/sample-content/beltcrest.png") knitr
As anyone who has tried to manually play around with the placement of figures in a Word document knows, this can have lots of side effects with extra spacing on other pages, etc. Therefore, it is not generally a good idea to do this - only do it when you really need to ensure that an image follows directly under text where you refer to it (in this document, I needed to do this for Figure 3.1 in section 3.1.4). For more details, read the relevant section of the R Markdown Cookbook.
1.3 Executable inline code
‘Inline code’ simply means inclusion of code inside text.
The syntax for doing this is `r R_CODE`
For example, `r 4 + 4`
will output 8 in your text.
You will usually use this in parts of your thesis where you report results - read in data or results in a code chunk, store things you want to report in a variable, then insert the value of that variable in your text.
For example, we might assign the number of rows in the cars
dataset to a variable:
<- nrow(cars) num_car_observations
We might then write:
“In the cars
dataset, we have `r num_car_observations`
observations.”
Which would output:
“In the cars
dataset, we have 50 observations.”
1.4 Executable code in other languages than R
If you want to use other languages than R, such as Python, Julia C++, or SQL, see the relevant section of the R Markdown Cookbook
1.1.14 Comments
To write comments within your text that won’t actually be included in the output, use the same syntax as for writing comments in HTML. That is, <!-- this will not be included in the output -->.


Sandro: The quick brown fox jumpted over the lazy dog.
... but didn't get hurt
<DanC> (hmm... four score and seven years ago our fathers)
Ralph: brought forth a new nation
... conceived in liberty.
... and dedicated to the proposition.
This is scribe.perl Revision: 1.122 of Date: 2005/03/31 04:43:41 Check for newer version at http://dev.w3.org/cvsweb/~checkout~/2002/scribe/ Guessing input format: Irssi_ISO8601_Log_Text_Format (score 1.00) No ScribeNick specified. Guessing ScribeNick: ericP Inferring Scribes: ericP WARNING: No "Topic:" lines found. WARNING: No "Present: ... " found! Possibly Present: DanC Ralph Sandro You can indicate people for the Present list like this: <dbooth> Present: dbooth jonathan mary <dbooth> Present+ amy WARNING: No meeting title found! You should specify the meeting title like this: <dbooth> Meeting: Weekly Baking Club Meeting WARNING: No meeting chair found! You should specify the meeting chair like this: <dbooth> Chair: dbooth WARNING: No date found! Assuming today. (Hint: Specify the W3C IRC log URL, and the date will be determined from that.) Or specify the date like this: <dbooth> Date: 12 Sep 2002 People with action items: WARNING: No "Topic: ..." lines found! Resulting HTML may have an empty (invalid) <ol>...</ol>. Explanation: "Topic: ..." lines are used to indicate the start of new discussion topics or agenda items, such as: <dbooth> Topic: Review of Amy's report WARNING: IRC log location not specified! (You can ignore this warning if you do not want the generated minutes to contain a link to the original IRC log.)[End of scribe.perl diagnostic output]


Projects
Check us out
Hi! We are Lekan Esan and Isaac Browne
We are software Developers
My Google Projects
My Google Projects
My Google Projects
My Google Projects


Once generated, the sample project will be a standard Maven 3, Java Web project with JPA 2.0, EJB 3.1, CDI 1.0, JSF 2.0 with complete JAX-RS endpoints for all data Entities. It will also provide views to Create, Read, Update, and Delete records.
But that is not all! You can use Forge on your new or existing projects to continue to enhance any application.
The application this project produces is designed to be run on JBoss Enterprise Application Platform 6 or JBoss AS 7.
All you need to build this project is Java 6.0 (Java SDK 1.6) or better, and an JBoss Developer Studio 5 or JBoss Forge version 1.0.0.Final (or higher).
If you are using JBoss Enterprise Application Platform 6, Forge is available in JBoss Developer Studio 5.
To show the Forge Console, navigate to Window -> Show View -> Other, locate Forge Console and click OK. Then click the Start button in top right corner of the view.
If you are using JBoss AS 7, you should install JBoss Forge version 1.0.0.Final or higher. Follow the instructions at Installing Forge.
Open a command line and navigate to the root directory of this quickstart.
Launch Forge by typing the following command:
forge
In the Forge console, make sure you are in the directory where this README.html file is located:
forge> cd QUICKSTART_HOME/forge-from-scratch/
Notice that there is a file in this directory named generate.fsh
. Run this file from Forge using the run
command:
forge> run generate.fsh
This command will prompt you to enter a project-name
, for example: 'example'
After this, you see a lot of console messages with a [INFO] BUILD SUCCESS
towards the end.
This quickstart has created a native Java EE 6 application.
After this command completes, look in your QUICKSTART_HOME/forge-from-scratch/
folder. You will see a folder with the same name as the project-name
you entered in the prompt above. Browse through this project to see the code that was generated as a result of this command.
For a full description of what was generated by running this script and details on the structure of the application, visit the Forge UI Scaffolding Guide
If you have not yet done so, you must Configure Maven before testing the quickstarts.
NOTE: If you are using JBoss Enterprise Application Platform 6, you can not append the path to the Maven settings on the Forge command line. You must configure the Maven user settings as noted in step 4 of the instructions.
The following shows the command line to start the server with the web profile:
For Linux: JBOSS_HOME/bin/standalone.sh
For Windows: JBOSS_HOME\bin\standalone.bat
Make sure you have started the JBoss server. See the instructions in the previous section.
Build the application:
forge> build
Use the jboss-as-7
Forge plugin to deploy the application. Install it with the following command:
forge> forge install-plugin jboss-as-7
Configure the server information:
forge> as7 setup
You will be prompted with three questions. Type 'N' for the first two questions to keep the default settings. Enter the path to your server install for the third question.
Now deploy the application:
forge> as7 deploy
This will deploy target/YOUR_PROJECT_NAME.war
.
The application will be running at the following URL: http://localhost:8080/YOUR_PROJECT_NAME/.
Be sure to replace YOUR_PROJECT_NAME
with the name of the project you chose when running the script.
When you are ready to undeploy from JBoss AS, run this command:
forge> as7 undeploy
Open generate.fsh
and take a look inside! There is not much magic happening here. All of the commands used to generate this project are clearly listed just as if they were typed by your own hands.
Play around with creating more entities, relationships, UI, and generating JAX-RS endpoints,all with just a few simple commands.
Forge has a rich plugin ecosystem. Want to deploy your application to the Cloud? Use the Forge Openshift Express plugin: http://github.com/forge/plugin-openshift-express/
To see a full list of avaialable plugins, make sure that you have an active internet connection and type:
forge> forge find-plugin *
You can also start the server and deploy the quickstarts from Eclipse using JBoss tools. For more information, see Use JBoss Developer Studio or Eclipse to Run the Quickstarts
If you want to debug the source code or look at the Javadocs of any library in the project, run either of the following commands to pull them into your local repository. The IDE should then detect them.
mvn dependency:sources
mvn dependency:resolve -Dclassifier=javadoc