Programming#
Loading and Attaching Sage files#
Next we illustrate how to load programs written in a separate file
into Sage. Create a file called example.sage
with the following
content:
print("Hello World")
print(2^3)
You can read in and execute example.sage
file using the load
command.
sage: load("example.sage")
Hello World
8
You can also attach a Sage file to a running session using the
attach
command:
sage: attach("example.sage")
Hello World
8
Now if you change example.sage
and enter one blank line into Sage
(i.e., hit return
), then the contents of example.sage
will be
automatically reloaded into Sage.
In particular, attach
automatically reloads a file whenever it
changes, which is handy when debugging code, whereas load
only
loads a file once.
When Sage loads example.sage
it converts it to Python, which is
then executed by the Python interpreter. This conversion is
minimal; it mainly involves wrapping integer literals in Integer()
floating point literals in RealNumber()
, replacing ^
’s by **
’s,
and replacing e.g., R.2
by R.gen(2)
. The converted version of
example.sage
is contained in the same directory as example.sage
and is called example.sage.py
. This file contains the following
code:
print("Hello World")
print(Integer(2)**Integer(3))
Integer literals are wrapped and the ^
is replaced by a **
.
(In Python ^
means “exclusive or” and **
means
“exponentiation”.)
(This preparsing is implemented in sage/misc/interpreter.py
.)
You can paste multi-line indented code into Sage as long as there
are newlines to make new blocks (this is not necessary in files).
However, the best way to enter such code into Sage is to save it to
a file and use attach
, as described above.
Creating Compiled Code#
Speed is crucial in mathematical computations. Though Python is a
convenient very high-level language, certain calculations can be
several orders of magnitude faster than in Python if they are
implemented using static types in a compiled language. Some aspects
of Sage would have been too slow if it had been written entirely in
Python. To deal with this, Sage supports a compiled “version” of Python
called Cython ([Cyt] and [Pyr]). Cython is simultaneously
similar to both Python and C. Most Python constructions, including
list comprehensions, conditional expressions, code like +=
are
allowed; you can also import code that you have written in other
Python modules. Moreover, you can declare arbitrary C variables,
and arbitrary C library calls can be made directly. The resulting
code is converted to C and compiled using a C compiler.
In order to make your own compiled Sage code, give the file an
.spyx
extension (instead of .sage
). If you are working with the
command-line interface, you can attach and load compiled code
exactly like with interpreted code (at the moment, attaching and
loading Cython code is not supported with the notebook interface).
The actual compilation is done “behind the scenes” without your
having to do anything explicit. The compiled shared object library is stored under
$HOME/.sage/temp/hostname/pid/spyx
. These files are deleted
when you exit Sage.
NO Sage preparsing is applied to spyx files, e.g., 1/3
will result in
0 in a spyx file instead of the rational number \(1/3\). If
foo
is a function in the Sage library, to use it from a spyx file
import sage.all
and use sage.all.foo
.
import sage.all
def foo(n):
return sage.all.factorial(n)
Accessing C Functions in Separate Files#
It is also easy to access C functions defined in separate *.c
files. Here’s an example. Create files test.c
and test.spyx
in the same directory with contents:
The pure C code: test.c
int add_one(int n) {
return n + 1;
}
The Cython code: test.spyx
:
cdef extern from "test.c":
int add_one(int n)
def test(n):
return add_one(n)
Then the following works:
sage: attach("test.spyx")
Compiling (...)/test.spyx...
sage: test(10)
11
If an additional library foo
is needed to compile the C code
generated from a Cython file, add the line clib foo
to the
Cython source. Similarly, an additional C file bar
can be
included in the compilation with the declaration cfile bar
.
Standalone Python/Sage Scripts#
The following standalone Sage script factors integers, polynomials, etc:
#!/usr/bin/env sage
import sys
from sage.all import *
if len(sys.argv) != 2:
print("Usage: %s <n>" % sys.argv[0])
print("Outputs the prime factorization of n.")
sys.exit(1)
print(factor(sage_eval(sys.argv[1])))
In order to use this script, your SAGE_ROOT
must be in your PATH.
If the above script is called factor
, here is an example usage:
$ ./factor 2006
2 * 17 * 59
Data Types#
Every object in Sage has a well-defined type. Python has a wide range of basic built-in types, and the Sage library adds many more. Some built-in Python types include strings, lists, tuples, ints and floats, as illustrated:
sage: s = "sage"; type(s)
<... 'str'>
sage: s = 'sage'; type(s) # you can use either single or double quotes
<... 'str'>
sage: s = [1,2,3,4]; type(s)
<... 'list'>
sage: s = (1,2,3,4); type(s)
<... 'tuple'>
sage: s = int(2006); type(s)
<... 'int'>
sage: s = float(2006); type(s)
<... 'float'>
To this, Sage adds many other types. E.g., vector spaces:
sage: V = VectorSpace(QQ, 1000000); V
Vector space of dimension 1000000 over Rational Field
sage: type(V)
<class 'sage.modules.free_module.FreeModule_ambient_field_with_category'>
Only certain
functions can be called on V
. In other math software
systems, these would be called using the “functional” notation
foo(V,...)
. In Sage, certain functions are attached to the type (or
class) of V
, and are called using an object-oriented
syntax like in Java or C++, e.g., V.foo(...)
. This helps keep the
global namespace from being polluted with tens of thousands of
functions, and means that many different functions with different
behavior can be named foo, without having to use type-checking of
arguments (or case statements) to decide which to call. Also, if
you reuse the name of a function, that function is still available
(e.g., if you call something zeta
, then want to compute the value
of the Riemann-Zeta function at 0.5, you can still type
s=.5; s.zeta()
).
sage: zeta = -1
sage: s=.5; s.zeta()
-1.46035450880959
In some very common cases, the usual functional notation is also supported for convenience and because mathematical expressions might look confusing using object-oriented notation. Here are some examples.
sage: n = 2; n.sqrt()
sqrt(2)
sage: sqrt(2)
sqrt(2)
sage: V = VectorSpace(QQ,2)
sage: V.basis()
[
(1, 0),
(0, 1)
]
sage: basis(V)
[
(1, 0),
(0, 1)
]
sage: M = MatrixSpace(GF(7), 2); M
Full MatrixSpace of 2 by 2 dense matrices over Finite Field of size 7
sage: A = M([1,2,3,4]); A
[1 2]
[3 4]
sage: A.charpoly('x')
x^2 + 2*x + 5
sage: charpoly(A, 'x')
x^2 + 2*x + 5
To list all member functions for \(A\), use tab completion.
Just type A.
, then type the [tab]
key on your keyboard, as
explained in Reverse Search and Tab Completion.
Lists, Tuples, and Sequences#
The list data type stores elements of arbitrary type. Like in C, C++, etc. (but unlike most standard computer algebra systems), the elements of the list are indexed starting from \(0\):
sage: v = [2, 3, 5, 'x', SymmetricGroup(3)]; v
[2, 3, 5, 'x', Symmetric group of order 3! as a permutation group]
sage: type(v)
<... 'list'>
sage: v[0]
2
sage: v[2]
5
(When indexing into a list, it is OK if the index is
not a Python int!)
A Sage Integer (or Rational, or anything with an __index__
method)
will work just fine.
sage: v = [1,2,3]
sage: v[2]
3
sage: n = 2 # Sage Integer
sage: v[n] # Perfectly OK!
3
sage: v[int(n)] # Also OK.
3
The range
function creates a list of Python int’s (not Sage
Integers):
sage: list(range(1, 15))
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]
This is useful when using list comprehensions to construct lists:
sage: L = [factor(n) for n in range(1, 15)]
sage: L
[1, 2, 3, 2^2, 5, 2 * 3, 7, 2^3, 3^2, 2 * 5, 11, 2^2 * 3, 13, 2 * 7]
sage: L[12]
13
sage: type(L[12])
<class 'sage.structure.factorization_integer.IntegerFactorization'>
sage: [factor(n) for n in range(1, 15) if is_odd(n)]
[1, 3, 5, 7, 3^2, 11, 13]
For more about how to create lists using list comprehensions, see [PyT].
List slicing is a wonderful feature. If L
is a list, then L[m:n]
returns the sublist of L
obtained by
starting at the \(m^{th}\) element and stopping at the
\((n-1)^{st}\) element, as illustrated below.
sage: L = [factor(n) for n in range(1, 20)]
sage: L[4:9]
[5, 2 * 3, 7, 2^3, 3^2]
sage: L[:4]
[1, 2, 3, 2^2]
sage: L[14:4]
[]
sage: L[14:]
[3 * 5, 2^4, 17, 2 * 3^2, 19]
Tuples are similar to lists, except they are immutable, meaning once they are created they can’t be changed.
sage: v = (1,2,3,4); v
(1, 2, 3, 4)
sage: type(v)
<... 'tuple'>
sage: v[1] = 5
Traceback (most recent call last):
...
TypeError: 'tuple' object does not support item assignment
Sequences are a third list-oriented Sage
type. Unlike lists and tuples, Sequence is not a built-in Python
type. By default, a sequence is mutable, but using the Sequence
class method set_immutable
, it can be set to be immutable, as
the following example illustrates. All elements of a sequence have
a common parent, called the sequences universe.
sage: v = Sequence([1,2,3,4/5])
sage: v
[1, 2, 3, 4/5]
sage: type(v)
<class 'sage.structure.sequence.Sequence_generic'>
sage: type(v[1])
<class 'sage.rings.rational.Rational'>
sage: v.universe()
Rational Field
sage: v.is_immutable()
False
sage: v.set_immutable()
sage: v[0] = 3
Traceback (most recent call last):
...
ValueError: object is immutable; please change a copy instead.
Sequences derive from lists and can be used anywhere a list can be used:
sage: v = Sequence([1,2,3,4/5])
sage: isinstance(v, list)
True
sage: list(v)
[1, 2, 3, 4/5]
sage: type(list(v))
<... 'list'>
As another example, basis for vector spaces are immutable sequences, since it’s important that you don’t change them.
sage: V = QQ^3; B = V.basis(); B
[
(1, 0, 0),
(0, 1, 0),
(0, 0, 1)
]
sage: type(B)
<class 'sage.structure.sequence.Sequence_generic'>
sage: B[0] = B[1]
Traceback (most recent call last):
...
ValueError: object is immutable; please change a copy instead.
sage: B.universe()
Vector space of dimension 3 over Rational Field
Dictionaries#
A dictionary (also sometimes called an associative array) is a mapping from ‘hashable’ objects (e.g., strings, numbers, and tuples of such; see the Python documentation http://docs.python.org/tut/node7.html and http://docs.python.org/lib/typesmapping.html for details) to arbitrary objects.
sage: d = {1:5, 'sage':17, ZZ:GF(7)}
sage: type(d)
<... 'dict'>
sage: list(d.keys())
[1, 'sage', Integer Ring]
sage: d['sage']
17
sage: d[ZZ]
Finite Field of size 7
sage: d[1]
5
The third key illustrates that the indexes of a dictionary can be complicated, e.g., the ring of integers.
You can turn the above dictionary into a list with the same data:
sage: list(d.items())
[(1, 5), ('sage', 17), (Integer Ring, Finite Field of size 7)]
A common idiom is to iterate through the pairs in a dictionary:
sage: d = {2:4, 3:9, 4:16}
sage: [a*b for a, b in d.items()]
[8, 27, 64]
A dictionary is unordered, as the last output illustrates.
Sets#
Python has a built-in set type. The main feature it offers is very fast lookup of whether an element is in the set or not, along with standard set-theoretic operations.
sage: X = set([1,19,'a']); Y = set([1,1,1, 2/3])
sage: X # random sort order
{1, 19, 'a'}
sage: X == set(['a', 1, 1, 19])
True
sage: Y
{2/3, 1}
sage: 'a' in X
True
sage: 'a' in Y
False
sage: X.intersection(Y)
{1}
Sage also has its own set type that is (in some cases) implemented using
the built-in Python set type, but has a little bit of extra Sage-related
functionality. Create a Sage set using Set(...)
. For
example,
sage: X = Set([1,19,'a']); Y = Set([1,1,1, 2/3])
sage: X # random sort order
{'a', 1, 19}
sage: X == Set(['a', 1, 1, 19])
True
sage: Y
{1, 2/3}
sage: X.intersection(Y)
{1}
sage: print(latex(Y))
\left\{1, \frac{2}{3}\right\}
sage: Set(ZZ)
Set of elements of Integer Ring
Iterators#
Iterators are a recent addition to Python that are particularly useful in mathematics applications. Here are several examples; see [PyT] for more details. We make an iterator over the squares of the nonnegative integers up to \(10000000\).
sage: v = (n^2 for n in range(10000000))
sage: next(v)
0
sage: next(v)
1
sage: next(v)
4
We create an iterate over the primes of the form \(4p+1\) with \(p\) also prime, and look at the first few values.
sage: w = (4*p + 1 for p in Primes() if is_prime(4*p+1))
sage: w # in the next line, 0xb0853d6c is a random 0x number
<generator object at 0xb0853d6c>
sage: next(w)
13
sage: next(w)
29
sage: next(w)
53
Certain rings, e.g., finite fields and the integers have iterators associated to them:
sage: [x for x in GF(7)]
[0, 1, 2, 3, 4, 5, 6]
sage: W = ((x,y) for x in ZZ for y in ZZ)
sage: next(W)
(0, 0)
sage: next(W)
(0, 1)
sage: next(W)
(0, -1)
Loops, Functions, Control Statements, and Comparisons#
We have seen a few examples already of some common uses of for
loops. In Python, a for
loop has an indented structure, such as
>>> for i in range(5):
... print(i)
...
0
1
2
3
4
Note the colon at the end of the for statement (there is no “do” or
“od” as in GAP or Maple), and the indentation before the “body” of
the loop, namely print(i)
. This indentation is important. In
Sage, the indentation is automatically put in for you when you hit
enter
after a “:”, as illustrated below.
sage: for i in range(5):
....: print(i) # now hit enter twice
....:
0
1
2
3
4
The symbol =
is used for assignment.
The symbol ==
is used to check for equality:
sage: for i in range(15):
....: if gcd(i,15) == 1:
....: print(i)
....:
1
2
4
7
8
11
13
14
Keep in mind how indentation determines the block structure for
if
, for
, and while
statements:
sage: def legendre(a,p):
....: is_sqr_modp=-1
....: for i in range(p):
....: if a % p == i^2 % p:
....: is_sqr_modp=1
....: return is_sqr_modp
sage: legendre(2,7)
1
sage: legendre(3,7)
-1
Of course this is not an efficient implementation of the Legendre symbol! It is meant to illustrate various aspects of Python/Sage programming. The function {kronecker}, which comes with Sage, computes the Legendre symbol efficiently via a C-library call to PARI.
Finally, we note that comparisons, such as ==
,
!=
, <=
, >=
, >
, <
, between numbers will automatically
convert both numbers into the same type if possible:
sage: 2 < 3.1; 3.1 <= 1
True
False
sage: 2/3 < 3/2; 3/2 < 3/1
True
True
Use bool for symbolic inequalities:
sage: x < x + 1
x < x + 1
sage: bool(x < x + 1)
True
When comparing objects of different types in Sage, in most cases
Sage tries to find a canonical coercion of both objects to a common
parent (see Parents, Conversion and Coercion for more details). If successful,
the comparison is performed between the coerced objects; if not successful,
the objects are considered not equal. For testing whether two variables
reference the same object use is
. As we see in this example,
the Python int 1
is unique, but the Sage Integer 1
is not:
sage: 1 is 2/2
False
sage: 1 is 1
False
sage: 1 == 2/2
True
In the following two lines, the first equality is False
because
there is no canonical morphism \(\QQ\to \GF{5}\), hence no
canonical way to compare the \(1\) in \(\GF{5}\) to the
\(1 \in \QQ\). In contrast, there is a canonical map
\(\ZZ \to \GF{5}\), hence the second comparison is True
. Note
also that the order doesn’t matter.
sage: GF(5)(1) == QQ(1); QQ(1) == GF(5)(1)
False
False
sage: GF(5)(1) == ZZ(1); ZZ(1) == GF(5)(1)
True
True
sage: ZZ(1) == QQ(1)
True
WARNING: Comparison in Sage is more restrictive than in Magma, which declares the \(1 \in \GF{5}\) equal to \(1 \in \QQ\).
sage: magma('GF(5)!1 eq Rationals()!1') # optional - magma
true
Profiling#
“Premature optimization is the root of all evil.” - Donald Knuth
Section author: Martin Albrecht<EMAIL_ADDRESS>Sometimes it is useful to check for bottlenecks in code to understand which parts take the most computational time; this can give a good idea of which parts to optimize. Python and therefore Sage offers several profiling–as this process is called–options.
The simplest to use is the prun
command in the interactive
shell. It returns a summary describing which functions took how
much computational time. To profile (the currently slow! - as of
version 1.0) matrix multiplication over finite fields, for example,
do:
sage: k,a = GF(2**8, 'a').objgen()
sage: A = Matrix(k,10,10,[k.random_element() for _ in range(10*10)])
sage: %prun B = A*A
32893 function calls in 1.100 CPU seconds
Ordered by: internal time
ncalls tottime percall cumtime percall filename:lineno(function)
12127 0.160 0.000 0.160 0.000 :0(isinstance)
2000 0.150 0.000 0.280 0.000 matrix.py:2235(__getitem__)
1000 0.120 0.000 0.370 0.000 finite_field_element.py:392(__mul__)
1903 0.120 0.000 0.200 0.000 finite_field_element.py:47(__init__)
1900 0.090 0.000 0.220 0.000 finite_field_element.py:376(__compat)
900 0.080 0.000 0.260 0.000 finite_field_element.py:380(__add__)
1 0.070 0.070 1.100 1.100 matrix.py:864(__mul__)
2105 0.070 0.000 0.070 0.000 matrix.py:282(ncols)
...
Here ncalls
is the number of calls, tottime
is the total time
spent in the given function (and excluding time made in calls to
sub-functions), percall
is the quotient of tottime
divided by
ncalls
. cumtime
is the total time spent in this and all
sub-functions (i.e., from invocation until exit), percall
is the
quotient of cumtime
divided by primitive calls, and
filename:lineno(function)
provides the respective data of each
function. The rule of thumb here is: The higher the function in
that listing, the more expensive it is. Thus it is more interesting
for optimization.
As usual, prun?
provides details on how to use the profiler and
understand the output.
The profiling data may be written to an object as well to allow closer examination:
sage: %prun -r A*A
sage: stats = _
sage: stats?
Note: entering stats = prun -r A\*A
displays a syntax error
message because prun is an IPython shell command, not a regular
function.
For a nice graphical representation of profiling data, you can use
the hotshot profiler, a small script called hotshot2cachetree
and
the program kcachegrind
(Unix only). The same example with the
hotshot profiler:
sage: k,a = GF(2**8, 'a').objgen()
sage: A = Matrix(k,10,10,[k.random_element() for _ in range(10*10)])
sage: import hotshot
sage: filename = "pythongrind.prof"
sage: prof = hotshot.Profile(filename, lineevents=1)
sage: prof.run("A*A")
<hotshot.Profile instance at 0x414c11ec>
sage: prof.close()
This results in a file pythongrind.prof
in the current working
directory. It can now be converted to the cachegrind format for
visualization.
On a system shell, type
$ hotshot2calltree -o cachegrind.out.42 pythongrind.prof
The output file cachegrind.out.42
can now be examined with
kcachegrind
. Please note that the naming convention
cachegrind.out.XX
needs to be obeyed.


Class pv.Scale.quantile
Extends
pv.Scale.
Represents a quantile scale; a function that maps from a value within
a sortable domain to a quantized numeric range. Typically, the domain is a
set of numbers, but any sortable value (such as strings) can be used as the
domain of a quantile scale. The range defaults to [0,1], with 0 corresponding
to the smallest value in the domain, 1 the largest, .5 the median, etc.
By default, the number of quantiles in the range corresponds to the number of values in the domain. The #quantiles method can be used to specify an explicit number of quantiles; for example, quantiles(4) produces a standard quartile scale. A quartile scale's range is a set of four discrete values, such as [0, 1/3, 2/3, 1]. Calling the #range method will scale these discrete values accordingly, similar to {@link pv.Scale.ordinal#splitFlush}.
For example, given the strings ["c", "a", "b"], a default quantile scale:
pv.Scale.quantile("c", "a", "b")will return 0 for "a", .5 for "b", and 1 for "c".
Defined in: QuantileScale.js.
| Constructor Attributes | Constructor Name and Description |
|---|---|
|
Constructs a default quantile scale.
|
| Method Attributes | Method Name and Description |
|---|---|
|
by(f)
Returns a view of this scale by the specified accessor function f.
|
|
|
domain()
Sets or gets the input domain.
|
|
|
quantiles(x)
Sets or gets the quantile boundaries.
|
|
|
range()
Sets or gets the output range.
|
This method is provided for convenience, such that scales can be succinctly defined inline. For example, given an array of data elements that have a score attribute with the domain [0, 1], the height property could be specified as:
.height(pv.Scale.linear().range(0, 480).by(function(d) d.score))This is equivalent to:
.height(function(d) d.score * 480)This method should be used judiciously; it is typically more clear to invoke the scale directly, passing in the value to be scaled.
- Parameters:
- {function} f
- an accessor function.
- Returns:
- {pv.Scale.quantile} a view of this scale by the specified accessor function.
1. domain(values...)
Specifying the domain as a series of values is the most explicit and recommended approach. However, if the domain values are derived from data, you may find the second method more appropriate.
2. domain(array, f)
Rather than enumerating the domain values as explicit arguments to this method, you can specify a single argument of an array. In addition, you can specify an optional accessor function to extract the domain values from the array.
3. domain()
Invoking the domain method with no arguments returns the current domain as an array.
- Parameters:
- {...} domain...
- domain values.
- Returns:
- {pv.Scale.quantile} this, or the current domain.
If no arguments are specified, this method returns the quantile boundaries; the first element is always the minimum value of the domain, and the last element is the maximum value of the domain. Thus, the length of the returned array is always one greater than the number of quantiles.
- Parameters:
- {number} x
- the number of quantiles.
1. range(min, ..., max)
The range may be specified as a series of numbers or colors. Most commonly, two numbers are specified: the minimum and maximum pixel values. For a color scale, values may be specified as pv.Colors or equivalent strings. For a diverging scale, or other subdivided non-uniform scales, multiple values can be specified. For example:
.range("red", "white", "green")
Currently, only numbers and colors are supported as range values. The number of range values must exactly match the number of domain values, or the behavior of the scale is undefined.
2. range()
Invoking the range method with no arguments returns the current range as an array of numbers or colors.
- Parameters:
- {...} range...
- range values.
- Returns:
- {pv.Scale.quantile} this, or the current range.


configarrr
Description:
A simple interface for providin’ configuration. Not all o’ me own creations. Parts borrowed, see Acknowledgements.
Usage:
config = Configarrr::Simple.configure do set :key, :value set :hash => { :other_key => :other_value } end >> config.key => :value >> config.hash[:other_key] => :other_value
Acknowledgements:
Sinatra - http://github.com/sinatra/sinatra/blob/master/lib/sinatra/base.rb - borrowed set and metadef.
License:
(The MIT License)
Copyright (c) 2009 Dylan Egan
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ‘Software’), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
 IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.


Why are the text fields blank?
Hextrapolate provides two adjustable fields for showing a number in a text encoding (ASCII, UTF-8 or UTF-16).
If you enter a number which does not have a valid representation in the specified text encoding then the corresponding field will appear as blank.
This can occur quite often in the case of ASCII because the ASCII text encoding only contains 95 printable characters. It can also happen in the case of UTF-8; even though UTF-8 is capable of encoding thousands of different characters it requires the bytes to be in a very specific order, so it is quite easy to enter numbers which do not respond to valid UTF-8 text.
UTF-16 spans a much wider range of possible values and so is less likely to show as a blank field.


JEROME BURNS
I am a native of Seattle. I enjoy physical activity, gardening, and classic texts. Professionally
I’ve spent 20 years working locally to build affordable rental housing for those with the greatest need. My
passion and interest
is to solve problems through quantitative and analytical means. I want to be a developer of products which gather
and synthesize data more effectively. My goal would be to work with a team equally passionate about creating tools
with focus
on addressing social needs more effectively.
CINDY WEISS
I am a wife, a mother, and a woman completely in love with learning. I love to learn new things and
processes. I hold degrees in both culinary arts and in business management. I also have a background in accounting
and am eligible
to sit for the CPA exam. I am currently learning web development at Code Fellows.
I thrive in open and fun
environments and enjoy opportunities to learn from my peers. I have a history of being able to meet firm deadlines
but truly believe
lasting outcomes are more about the process than one ending product.
PETER COLE
I am a web development student at Code Fellows, I would like to be employed at a smaller outdoor industry company
contracting to serve their web development needs, pursuing full time employment. I love to work in a community
driven and empowering work environment.
My background includes French, music education, geology, tree care, residential painting, electrician
apprenticeship, and several years volunteering as a mountain guide for a nonprofit. Software development, an early
hobby in high school,
has called me back for its ability to touch all of the fields that I am passionate about and provide me an outlet
to express my creativity and work ethic surrounded by like-minded people. I am excited to learn more about
contributing to this community.
ISAAC NELSON
My name is Isaac Nelson, I am very new to coding and incredibly excited to learn! My coding
experience thus far is a few months of online prep courses, and the basic javascript course from Codefellows. I am
passionate about creating a successful future
for my family and myself. My beautiful wife Alexandra is pregnant with our first child, "Miles". Miles should be
joining us around January 10th 2020, with such a soon delivery date I am more motivated than ever to learn the
skills for a successful future.


19. ERC Token Standards
# ERC Token Standards
To help us create tokens, Ethereum has created token standards, contracts which we can inherit that will help us setup a complete token.
To understand how to use these token standards, we will need to understand:
- ERC (Ethereum Request for Comments)
- Fungible vs. Non-fungible tokens
- Different available token standards
# ERC
Every development project improves overtime and Ethereum is no exception. Similar to Bitcoin Improvement Proposals (BIPs), Ethereum has Ethereum Improvement Proposals (EIPs). Ethereum Improvement Proposals (EIPs) describe standards for the Ethereum platform, including core protocol specifications, client APIs, and contract standards.
Included under EIPs are ERCs, Etherum Requests for Comments (a full list can be found here). Some common ERCs resulted interfaces developers can use to create token.
For example,
- ERC-20 - A standard interface for fungible tokens.
- ERC-721 - A standard interface for non-fungible tokens, also known as deeds.
##### Difference between Fungible and Non-Fungible Tokens
Now you might be wondering, what is the difference between fungible and non-fungible?
Fungible Token
A Fungible Token is a token, where all tokens are exactly the same.
- They have the same value.
- For example, any 1 dollar bill is equal to another 1 dollar bill.
- All the widely used ERC-20 tokens are fungible tokens.
Fungible Token
A Non-Fungible Token is a special type of cryptographic token which represents something unique.
- Non-Fungible tokens are not interchangeable, because they all have a different value.
- For example, if we represented real estate parcels in tokens, not all parcels would be equal in value, hence all these tokens will also not be equal in value.
- ERC-721 is a non-fungible token standard.
- The famous CryptoKitties Token is an ERC-721 non-fungible token.
## Explore ERC Tokens
Before we dive into code, let's explore what tokens currently exist. One of the best ways to see the most popular tokens in use is from Etherscan's Token Tracker.
Explore Deployed Tokens using Etherscan
Task Description:
In addition to letting us checkout out transactions, Etherscan has a feature to show the top tokens. Let's explore this feature.
Task Feedback:
At the time of this creation, the #1 token is Binance.
Total Supply: 190,799,315 BNB ($1,504,844,786.39)
Contract Address: https://etherscan.io/address/0xB8c77482e45F1F44dE1745F52C74426C631bDD52
# Different Available Token Standards
In addition to ERC-20 and ERC-721, a number of other token standards have been created. A full list of ERCs can be found here. In this video, we will discuss a few of the most popular ERC standards used to create tokens:
- ERC-20
- ERC-223
- ERC-621
- ERC-721
- ERC-827
C4L3 Concept 19 Token Standards V2
## Explore ERC-721 Tokens
Earlier, you explored the top tokens from Etherscan's Token Tracker, but those were just the top ERC-20 tokens!
Now, let's explore the top ERC-721 Tokens.
Explore ERC-721 Tokens using Etherscan
Task Description:
Let's jump back in Etherscan an checkout the top ERC-721 tokens.
Task Feedback:
At the time of this creation, the #1 token is CryptoKitties.
Total Supply: 1,190,403 CK ($0.00)
Contract Address: https://etherscan.io/address/0x06012c8cf97bead5deae237070f9587f8e7a266d
#### Interesting Facts
- The famous CryptoKitties Token, is still the * #1 * token, as of making this lesson.
- You can find out which ethereum address holds how many tokens, as you see in the screen below. This all is due to the fact that everything on blockchain is viewable by anyone.


In this project, you'll use generative adversarial networks to generate new images of faces.
You'll be using two datasets in this project:
Since the celebA dataset is complex and you're doing GANs in a project for the first time, we want you to test your neural network on MNIST before CelebA. Running the GANs on MNIST will allow you to see how well your model trains sooner.
If you're using FloydHub, set data_dir
to "/input" and use the FloydHub data ID "R5KrjnANiKVhLWAkpXhNBe".
data_dir = './data'
# FloydHub - Use with data ID "R5KrjnANiKVhLWAkpXhNBe"
#data_dir = '/input'
"""
DON'T MODIFY ANYTHING IN THIS CELL
"""
import helper
helper.download_extract('mnist', data_dir)
helper.download_extract('celeba', data_dir)
show_n_images = 25
"""
DON'T MODIFY ANYTHING IN THIS CELL
"""
%matplotlib inline
import os
from glob import glob
from matplotlib import pyplot
mnist_images = helper.get_batch(glob(os.path.join(data_dir, 'mnist/*.jpg'))[:show_n_images], 28, 28, 'L')
pyplot.imshow(helper.images_square_grid(mnist_images, 'L'), cmap='gray')
The CelebFaces Attributes Dataset (CelebA) dataset contains over 200,000 celebrity images with annotations. Since you're going to be generating faces, you won't need the annotations. You can view the first number of examples by changing show_n_images
.
show_n_images = 25
"""
DON'T MODIFY ANYTHING IN THIS CELL
"""
mnist_images = helper.get_batch(glob(os.path.join(data_dir, 'img_align_celeba/*.jpg'))[:show_n_images], 28, 28, 'RGB')
pyplot.imshow(helper.images_square_grid(mnist_images, 'RGB'))
Since the project's main focus is on building the GANs, we'll preprocess the data for you. The values of the MNIST and CelebA dataset will be in the range of -0.5 to 0.5 of 28x28 dimensional images. The CelebA images will be cropped to remove parts of the image that don't include a face, then resized down to 28x28.

You'll build the components necessary to build a GANs by implementing the following functions below:
model_inputs
discriminator
generator
model_loss
model_opt
train
This will check to make sure you have the correct version of TensorFlow and access to a GPU
"""
DON'T MODIFY ANYTHING IN THIS CELL
"""
from distutils.version import LooseVersion
import warnings
import tensorflow as tf
# Check TensorFlow Version
assert LooseVersion(tf.__version__) >= LooseVersion('1.0'), 'Please use TensorFlow version 1.0 or newer. You are using {}'.format(tf.__version__)
print('TensorFlow Version: {}'.format(tf.__version__))
# Check for a GPU
if not tf.test.gpu_device_name():
warnings.warn('No GPU found. Please use a GPU to train your neural network.')
else:
print('Default GPU Device: {}'.format(tf.test.gpu_device_name()))
Implement the model_inputs
function to create TF Placeholders for the Neural Network. It should create the following placeholders:
image_width
, image_height
, and image_channels
.z_dim
.Return the placeholders in the following the tuple (tensor of real input images, tensor of z data)
import problem_unittests as tests
def model_inputs(image_width, image_height, image_channels, z_dim):
"""
Create the model inputs
:param image_width: The input image width
:param image_height: The input image height
:param image_channels: The number of image channels
:param z_dim: The dimension of Z
:return: Tuple of (tensor of real input images, tensor of z data, learning rate)
"""
# TODO: Implement Function
real_dim = (image_width, image_height, image_channels)
input_real = tf.placeholder(tf.float32, (None, image_width, image_height, image_channels), name='input_real')
inputs_z = tf.placeholder(tf.float32, (None, z_dim), name='input_z')
lr = tf.placeholder(tf.float32, None, name='learning_rate')
return input_real, inputs_z, lr
"""
DON'T MODIFY ANYTHING IN THIS CELL THAT IS BELOW THIS LINE
"""
tests.test_model_inputs(model_inputs)
Implement discriminator
to create a discriminator neural network that discriminates on images
. This function should be able to reuse the variables in the neural network. Use tf.variable_scope
with a scope name of "discriminator" to allow the variables to be reused. The function should return a tuple of (tensor output of the discriminator, tensor logits of the discriminator).
def discriminator(images, reuse=False):
"""
Create the discriminator network
:param images: Tensor of input image(s)
:param reuse: Boolean if the weights should be reused
:return: Tuple of (tensor output of the discriminator, tensor logits of the discriminator)
"""
# TODO: Implement Function
alpha = 0.1
with tf.variable_scope('discriminator', reuse=reuse):
x1 = tf.layers.conv2d(images, 64,5,strides=2, padding='same')
relu1 = tf.maximum(alpha*x1, x1)
drop1 = tf.nn.dropout(relu1, keep_prob=0.8)
#14x14x64
#print(relu1)
x2 = tf.layers.conv2d(drop1, 128, 5, strides=2, padding='same')
bn2 = tf.layers.batch_normalization(x2, training=True)
relu2 = tf.maximum(alpha*bn2, bn2)
drop2 = tf.nn.dropout(relu2, keep_prob=0.8)
#print(relu2)
#7x7x128
x3 = tf.layers.conv2d(drop2, 256, 5, strides=2, padding='same')
bn3 = tf.layers.batch_normalization(x3, training=True)
relu3 = tf.maximum(alpha * bn3, bn3)
drop3 = tf.nn.dropout(relu3, keep_prob=0.8)
# size 4x4x256
#x4 = tf.layers.conv2d(drop3, 512, 5, strides=2, padding='same')
#bn4 = tf.layers.batch_normalization(x4, training=True)
#relu4 = tf.maximum(alpha * bn4, bn4)
#drop4 = tf.nn.dropout(relu4, keep_prob=0.8)
#size 2x2x256
# Flatten
flat = tf.contrib.layers.flatten(drop3)
logits = tf.layers.dense(flat,1)
out = tf.sigmoid(logits)
return out, logits
"""
DON'T MODIFY ANYTHING IN THIS CELL THAT IS BELOW THIS LINE
"""
tests.test_discriminator(discriminator, tf)
Implement generator
to generate an image using z
. This function should be able to reuse the variables in the neural network. Use tf.variable_scope
with a scope name of "generator" to allow the variables to be reused. The function should return the generated 28 x 28 x out_channel_dim
images.
def generator(z, out_channel_dim, is_train=True):
"""
Create the generator network
:param z: Input z
:param out_channel_dim: The number of channels in the output image
:param is_train: Boolean if generator is being used for training
:return: The tensor output of the generator
"""
alpha = 0.1
# TODO: Implement Function
with tf.variable_scope('generator', reuse=not is_train):
# First fully connected layer
x1 = tf.layers.dense(z, 7*7*512)
# Reshape it to start the convolutional stack
x1 = tf.reshape(x1, (-1,7,7,512))
x1 = tf.layers.batch_normalization(x1, training=is_train)
x1 = tf.maximum(alpha*x1,x1)
x1 = tf.nn.dropout(x1, keep_prob=0.5)
#print(x1)
# 7*7*512 now
x2 = tf.layers.conv2d_transpose(x1, 256, 5, strides=1, padding='same')
x2 = tf.layers.batch_normalization(x2, training=is_train)
x2 = tf.maximum(alpha* x2, x2)
x2 = tf.nn.dropout(x2, keep_prob=0.5)
#print(x2)
# 7*7x256 now
x3 = tf.layers.conv2d_transpose(x2, 128, 5, strides=2, padding='same')
x3 = tf.layers.batch_normalization(x3, training=is_train)
x3 = tf.maximum(alpha*x3, x3)
x3 = tf.nn.dropout(x3, keep_prob=0.5)
#print(x3)
# 14*14*128 now
# Output layer
logits = tf.layers.conv2d_transpose(x3, out_channel_dim, 5, strides=2, padding='same')
#print(logits)
# 28*28*5 now
out=tf.tanh(logits)
return out
"""
DON'T MODIFY ANYTHING IN THIS CELL THAT IS BELOW THIS LINE
"""
tests.test_generator(generator, tf)
Implement model_loss
to build the GANs for training and calculate the loss. The function should return a tuple of (discriminator loss, generator loss). Use the following functions you implemented:
discriminator(images, reuse=False)
generator(z, out_channel_dim, is_train=True)
def model_loss(input_real, input_z, out_channel_dim):
"""
Get the loss for the discriminator and generator
:param input_real: Images from the real dataset
:param input_z: Z input
:param out_channel_dim: The number of channels in the output image
:return: A tuple of (discriminator loss, generator loss)
"""
# TODO: Implement Function
g_model = generator(input_z, out_channel_dim)
d_model_real, d_logits_real = discriminator(input_real)
d_model_fake, d_logits_fake = discriminator(g_model, reuse=True)
d_loss_real = tf.reduce_mean(
tf.nn.sigmoid_cross_entropy_with_logits(logits=d_logits_real, labels=tf.ones_like(d_model_real)*0.9))
d_loss_fake = tf.reduce_mean(
tf.nn.sigmoid_cross_entropy_with_logits(logits=d_logits_fake, labels=tf.zeros_like(d_model_fake)))
g_loss = tf.reduce_mean(
tf.nn.sigmoid_cross_entropy_with_logits(logits=d_logits_fake, labels=tf.ones_like(d_model_fake)))
d_loss=d_loss_real + d_loss_fake
return d_loss, g_loss
"""
DON'T MODIFY ANYTHING IN THIS CELL THAT IS BELOW THIS LINE
"""
tests.test_model_loss(model_loss)
Implement model_opt
to create the optimization operations for the GANs. Use tf.trainable_variables
to get all the trainable variables. Filter the variables with names that are in the discriminator and generator scope names. The function should return a tuple of (discriminator training operation, generator training operation).
def model_opt(d_loss, g_loss, learning_rate, beta1):
"""
Get optimization operations
:param d_loss: Discriminator loss Tensor
:param g_loss: Generator loss Tensor
:param learning_rate: Learning Rate Placeholder
:param beta1: The exponential decay rate for the 1st moment in the optimizer
:return: A tuple of (discriminator training operation, generator training operation)
"""
# TODO: Implement Function
# Get weights and bias to update
t_vars = tf.trainable_variables()
d_vars = [var for var in t_vars if var.name.startswith('discriminator')]
g_vars = [var for var in t_vars if var.name.startswith('generator')]
# Optimize
with tf.control_dependencies(tf.get_collection(tf.GraphKeys.UPDATE_OPS)):
d_train_opt = tf.train.AdamOptimizer(learning_rate, beta1=beta1).minimize(d_loss, var_list=d_vars)
g_train_opt = tf.train.AdamOptimizer(learning_rate, beta1=beta1).minimize(g_loss, var_list=g_vars)
return d_train_opt, g_train_opt
"""
DON'T MODIFY ANYTHING IN THIS CELL THAT IS BELOW THIS LINE
"""
tests.test_model_opt(model_opt, tf)
"""
DON'T MODIFY ANYTHING IN THIS CELL
"""
import numpy as np
def show_generator_output(sess, n_images, input_z, out_channel_dim, image_mode):
"""
Show example output for the generator
:param sess: TensorFlow session
:param n_images: Number of Images to display
:param input_z: Input Z Tensor
:param out_channel_dim: The number of channels in the output image
:param image_mode: The mode to use for images ("RGB" or "L")
"""
cmap = None if image_mode == 'RGB' else 'gray'
z_dim = input_z.get_shape().as_list()[-1]
example_z = np.random.uniform(-1, 1, size=[n_images, z_dim])
samples = sess.run(
generator(input_z, out_channel_dim, False),
feed_dict={input_z: example_z})
images_grid = helper.images_square_grid(samples, image_mode)
pyplot.imshow(images_grid, cmap=cmap)
pyplot.show()
Implement train
to build and train the GANs. Use the following functions you implemented:
model_inputs(image_width, image_height, image_channels, z_dim)
model_loss(input_real, input_z, out_channel_dim)
model_opt(d_loss, g_loss, learning_rate, beta1)
Use the show_generator_output
to show generator
output while you train. Running show_generator_output
for every batch will drastically increase training time and increase the size of the notebook. It's recommended to print the generator
output every 100 batches.
def train(epoch_count, batch_size, z_dim, learning_rate, beta1, get_batches, data_shape, data_image_mode):
"""
Train the GAN
:param epoch_count: Number of epochs
:param batch_size: Batch Size
:param z_dim: Z dimension
:param learning_rate: Learning Rate
:param beta1: The exponential decay rate for the 1st moment in the optimizer
:param get_batches: Function to get batches
:param data_shape: Shape of the data
:param data_image_mode: The image mode to use for images ("RGB" or "L")
"""
# TODO: Build Model
#print(data_shape)
_, img_width, img_height, img_channels = data_shape
input_real, input_z, lr = model_inputs(img_width, img_height, img_channels, z_dim)
d_loss, g_loss = model_loss(input_real, input_z, img_channels)
d_train_opt, g_train_opt = model_opt(d_loss, g_loss, learning_rate, beta1)
steps = 0
saver = tf.train.Saver()
with tf.Session() as sess:
sess.run(tf.global_variables_initializer())
for epoch_i in range(epoch_count):
for batch_images in (get_batches(batch_size)):
# TODO: Train Model
steps += 1
batch_z = np.random.uniform(-1,1,size=(batch_size, z_dim))
batch_images *= 2
# Run optimizer
_ = sess.run(d_train_opt, feed_dict={input_real: batch_images,
input_z:batch_z,
lr: learning_rate})
_ = sess.run(g_train_opt, feed_dict={input_z: batch_z,
input_real:batch_images,
lr: learning_rate})
_ = sess.run(g_train_opt, feed_dict={input_z: batch_z,
input_real:batch_images,
lr: learning_rate})
# Every 100 batches, get the loss and print them out
if (steps % 10 == 0):
train_loss_d = sess.run(d_loss, {input_z:batch_z, input_real: batch_images})
train_loss_g = g_loss.eval({input_z:batch_z})
print("Epoch {}/{}...".format(epoch_i+1,epoch_count),
"Discriminator Loss: {:.4f}...".format(train_loss_d),
"Generator Loss: {:.4f}".format(train_loss_g))
if (steps %100 ==0 ):
show_generator_output(sess, 25, input_z, img_channels, data_image_mode)
Test your GANs architecture on MNIST. After 2 epochs, the GANs should be able to generate images that look like handwritten digits. Make sure the loss of the generator is lower than the loss of the discriminator or close to 0.
batch_size = 128
z_dim = 128
learning_rate = 0.001
beta1 = 0.5
"""
DON'T MODIFY ANYTHING IN THIS CELL THAT IS BELOW THIS LINE
"""
epochs = 2
mnist_dataset = helper.Dataset('mnist', glob(os.path.join(data_dir, 'mnist/*.jpg')))
with tf.Graph().as_default():
train(epochs, batch_size, z_dim, learning_rate, beta1, mnist_dataset.get_batches,
mnist_dataset.shape, mnist_dataset.image_mode)
print("Done")
Run your GANs on CelebA. It will take around 20 minutes on the average GPU to run one epoch. You can run the whole epoch or stop when it starts to generate realistic faces.
batch_size =64
z_dim = 100
learning_rate = 0.001
beta1 = 0.5
"""
DON'T MODIFY ANYTHING IN THIS CELL THAT IS BELOW THIS LINE
"""
epochs = 1
celeba_dataset = helper.Dataset('celeba', glob(os.path.join(data_dir, 'img_align_celeba/*.jpg')))
with tf.Graph().as_default():
train(epochs, batch_size, z_dim, learning_rate, beta1, celeba_dataset.get_batches,
celeba_dataset.shape, celeba_dataset.image_mode)
print("Done")
When submitting this project, make sure to run all the cells before saving the notebook. Save the notebook file as "dlnd_face_generation.ipynb" and save it as a HTML file under "File" -> "Download as". Include the "helper.py" and "problem_unittests.py" files in your submission.


The QuantConnect Learn Tab is a collection of videos, tutorials and algorithms to demonstrate the API. There are 50+ algorithms covering all aspects of the API and common questions users have raised over time.


New Game
Yehr Game is a board game involving two players. It is played on a board with 40 squares arranged in an ten-by-four grid. At the beginning of the game each player controls four pieces: one acm, one bahamas, one cab and one daze. If one player has no pieces
to move, he lost the game.
Setup:
Yehr Game is played on a rectangle board of ten rows and four columns. The pieces are divided, by convention, into red and black sets. The players are referred to as "Red" and "Black", and each begins the game with four pieces of the specified color. These
consist of one acm, one bahamas, one cab and one daze.
Movement:
First, they setup their pieces on the board.
 After the initial move, the players alternately move one piece at a time.
Each chess piece has its own style of moving.
(1) Acm can only move one direction: red from left to right; black from right to left. Acm can only move to the next square. If one player’s acm moves to a square with the opponent acm, he win the game.
(2) Bahamas and cab can move two direction: from left to right or from right to left. And they can move any number of squares but may not leap over other pieces.
(3) Daze can only move one direction: red from right to left; black from left to right.Daze can only move to the next square. In order to win the game, every clever player places the red daze on d5 and the black on d6.
Of Course, we assume that all players are clever.
Each test case contains three lines:
First line contains one integer number 0 or 1: 0 indicated red move first and 1 black first.
Second line contains four integer numbers r1, r2, r3, r4 indicating the four red pieces’ square. For example, r3=3 indicating the red cab on C3.
Third line contains four integer numbers k1, k2, k3, k4 indicating the four black pieces’ square. For example, k1=9 indicating the black acm on A9.
We assume that r4 is always 5, and K4 is 6.
0 4 5 5 5 7 6 6 6
Red
题目大意：
首先告诉你0或1，0表示红色先手，1表示黑色先手，接下来四个数字表示 红方 A,B,C,D四个子的位置，在接下来四个数字表示黑方 A,B,C,D四个子的位置。
所以r4和k4代表各自的机会，通俗的说就是我们玩魂斗罗时候的“命”
B,C:这两个游戏的SG函数都是b,c 即一个nim子游戏。
A：此游戏的SG函数值为a%2
证明D：当A,B,C游戏已经决定败局时，先手可以在D中进行一次操作(称“缓冲”)，
即ABC的败局扭转给后手。显然后手也只能在D中操作挽回败局。故谁在D
中的缓冲区大谁就必胜。通俗的说就是局势以定的时候玩家拼命，谁命多，
谁就胜了。
证明A：当A中两个棋子重合时后手败（被吃子）a=0 sg(A)=0
否则，a的状态只能到达a-1所以sg(A)=a%2
证明B：显然b=0时必败，sg(B)=0。当然此时先手可以增加b的值来苟延残喘，但后
手下一步操作只要再把b减到0，一直下去，先手不能再增加时，还是败了。
然而b>0时的状态不好说，如果我们只考虑b只能减小，那不就成了nim子游
戏了吗。事实上b的增大操作我们称为无效操作，因为处于优势的玩家可以
不靠增加b来取状态，处于劣势的玩家即使增加了b，下一玩家再取回来就可
以了。所以B与NIM子游戏等价。
证明C：同B
解题代码：
#include <iostream> #include <cstdio> using namespace std; int red[10],black[10],first; int solve(){ if(black[1]-red[1]==1) return first; if(red[4]-1>10-black[4]) return 0; if(red[4]-1<10-black[4]) return 1; int sg=0; sg^=(black[2]-red[2]-1); sg^=(black[3]-red[3]-1); sg^=(black[1]-red[1])%2; if(sg) return first; else return first^1; } int main(){ while(scanf("%d",&first)!=EOF){ for(int i=1;i<=4;i++) scanf("%d",&red[i]); for(int i=1;i<=4;i++) scanf("%d",&black[i]); if ( !solve() ) printf("Red\n"); else printf("Black\n"); } return 0; }
版权声明：欢迎关注我的博客，本文为博主toyking原创文章，未经博主允许不得转载。
高调而自信地说了一句我全都可以
第一个数表示数列的个数，5表示之后有5个数
正解，我的方法占用的内存更多些
很好。代码比书上的简练！
受益匪浅！！
第一题是不是可以这样想，生了n孩子的家庭等价于n个家庭各生了一个1个孩子，这样最后男女的比例还是1:1
没敢用map，总怕stl用着会超时
great!
这个才是我想要的
涨姿势了
妈呀！这个Dijkstra模板好长OwQ！
多谢支持！
我还有个问题想请教一下，就是感觉对于新手来说，递归理解起来有些困难，不知有没有什么好的方法或者什么好的建议？
这个系列很不错
很好的题，还是能做出几道的，嘿嘿


Art is created in a rave. And anything else is the restoration of monuments, and our page will talk in some detail about Egypt, because it contains many wonderful features, and it has produced more monuments that the beggar described than anywhere else in the world.
Art is created in a rave. And anything else is the restoration of monuments, and our page will talk in some detail about Egypt, because it contains many wonderful features, and it has produced more monuments that the beggar described than anywhere else in the world.
Art is created in a rave. And anything else is the restoration of monuments, and our page will talk in some detail about Egypt, because it contains many wonderful features, and it has produced more monuments that the beggar described than anywhere else in the world.
Art is created in a rave. And anything else is the restoration of monuments, and our page will talk in some detail about Egypt, because it contains many wonderful features, and it has produced more monuments that the beggar described than anywhere else in the world.


{% extends "feature_plugin_base.html" %}
{% load thumbnail cms_tags %}
{% comment %}
ANY styling here should be removed during "real" front-end development.
It only exists to show proof-of-concept.
{% endcomment %}
{% block plugin-block %}
{{ instance.title }}
{% for plugin in instance.child_plugin_instances %}
Plugin is: {{ plugin.get_plugin_name }} = {{ plugin.plugin_type }}
{% empty %}
I do not appear to have any list items... So why am I here?


subscribe
hi + fi
Home
(current)
about us
brands
blog
events
shop
contact us
H i
F i
HIFICORNER.co.uk
our edinburgh showeroom has now moved to stunning new premises on joppa road
naim sound system
technics turntables
primaluna sounds
chord electronics


| 031:015 Khan | : |
But if they (both) strive with you to make you join in worship with Me others that of which you have no knowledge, then obey them not, but behave with them in the world kindly, and follow the path of him who turns to Me in repentance and in obedience. Then to Me will be your return, and I shall tell you what you used to do. |
| 031:015 Maulana | : |
And if they strive with thee to make thee associate with Me that of which thou has no knowledge, obey them not, and keep kindly company with them in this world, and follow the way of him who turns to Me; then to Me is your return, then I shall inform you of what you did. |
| 031:015 Pickthal | : |
But if they strive with thee to make thee ascribe unto Me as partner that of which thou hast no knowledge, then obey them not. Consort with them in the world kindly, and follow the path of him who repenteth unto Me. Then unto Me will be your return, and I shall tell you what ye used to do - |
| 031:015 Rashad | : |
If they try to force you to set up any idols beside Me, do not obey them. But continue to treat them amicably in this world. You shall follow only the path of those who have submitted to Me. Ultimately, you all return to Me, then I will inform you of everything you have done. |
| 031:015 Sarwar | : |
If they try to force you to consider things equal to Me, which you cannot justify, equal to Me, do not obey them. Maintain lawful relations with them in this world and follow the path of those who turn in repentance to Me. To Me you will all return and I shall tell you all that you have done. |
| 031:015 Shakir | : |
And if they contend with you that you should associate with Me what you have no knowledge of, do not obey them, and keep company with them in this world kindly, and follow the way of him who turns to Me, then to Me is your return, then will I inform you of what you did-- |
| 031:015 Sherali | : |
And if they contend with thee to make thee set up equals with ME concerning which thou hast no knowledge, obey them not, but be a kind companion to them in worldly affairs, and in spiritual matters follow the way of him who turns to ME. Then unto ME will be your return and I shall inform you of what you used to do; |
| 031:015 Yusufali | : |
"But if they strive to make thee join in worship with Me things of which thou hast no knowledge, obey them not; yet bear them company in this life with justice (and consideration), and follow the way of those who turn to me (in love): in the end the return of you all is to Me, and I will tell you the truth (and meaning) of all that ye did." |
Concepts/Themes Covered: أركان الإسلام > التوحيد > توحيد الله تعالي > إليه ترجع الأمور Pillars of Islam> Islamic> Oneness of Allah>All Matters Return to Him(for decision) أركان الإسلام > التوحيد > الشرك والمشركون > النهي عن الشِرك والوعيد عليه Pillars of Islam> Islamic> Polytheism and the Polytheists> The Inhibition of Polytheisms and the Threat Against it الإنسان والعلاقات الاجتماعية > الأسرة > حق الوالدين Man and The Social Relations>The Family>The Parents' Right الديانات > أهل الكتاب: ( اليهود و النصارى) > وجوب التساهل معهم(مع غير المحاربين) Religions> The People of the Book (the Jews and the Christians)> The Necessity to be Easy with them (with the Non-Fighters)
This tool uses eight English parallel translations for the Holy Quran imported from Mr. Clay Smith. You can also visit Qurany Concepts for browsing the Quran themes or topics. If you want to search the Holy Quran for keywords, please visit Qurany Keywords.


Department of Advanced Science and Technology
University of Computer Studies
B.C.Sc/B.C.Tech. ( First Year)
English
Mid Tearm Examination
March, 2015
Zone III
Answer ALL Questions
Time allowed 3hours.
- Read the passaage and answer the following questions.(20 Marks)
In 2002, Willliam Kamkwamba had to drop out of school, as his father, a maize and tobacco farmar, could no longer afford his school fees. But despite this setback, William was determined to get his education. He began visiting a local library that had just opened in his old primary school, where he discovered a tattereed science book. With only a rudimentary grasp of English, he taught hiimself basic physics-mainly by studying photos and diagrams. Another book he found there featured windmills on the cover and inspired him to try and build his own.
He started by constructing a small model. Then, with the help of a cousin and friend, he spent many weeks searching scrap yards and found old tractor fans, shock absorbers, plastic pipe and bycycle parts, which he used to build the real thing.
Wha he had built was a crude machine that produced 12 volts and powered four lignts.He eventually replaced the tower with a sturdier one that stands 39 feet, and built a second meachine that watered a family garden.
The windmill brought William Kamkwamba instant local fame, but despite his accomplishment, he was still unable to returen to school.However, news of his magetsi a mphepo-elecric wind-spread beyond Malawi daily Mail caught the attention of bloggers, which in turn caught the attention of organisers for the Technology Entertainment and Design conference.
In 2007, William spoke at the TED Global conference in Tanzania and got a standing ovation. Businessmen stepped forward with offers to fund his education and projects, and with money donated by them, he was able to put his cousin and several friends back into school and pay for some decical needs of this family. With the donation, he also drilled a borehole for a well and water pump in his village and installed drip irrigation in his father's fields.
The Water pump has allowed his family to expand its crops. They have abandoned tobacco and now grow maie, benas, soybenas, potatoes and penauts.The windmills have also gbrought big lifestyle and health cnges to the other villagers.The village has changed a lot/William says. "Now, the time that the would have spent going to fetch water, they are using for doing other things.And also the water they are drinking is clean water, so there is less disease." The villagers have also stopped using kerosene and can use the money previously spent on fuel to buy other things.
William Kamkwamba's example has inspired other childeren in the village to purseue science. William says they now see that if they put their mind to something, they can achieve it. It has changed the way people think/he says.
Question 1-5
Complete the flow chart below. Choose NO MORE THAN TWO WORDS from the passage for each answer.
Building the Windmill
William learned some 1........... from a library book.
First, he built a 2........of the windmill.
Then he collected materials from 3........... with a relative.
He made the windmill blades from pieces of 4...........
He fixed the blades to a 5............ and then to part of a bicycle.
He raised the blades on a tower.
Questions 6-10
Do the following statements agree with the information given in Reading Passage?
Wirte
TRUE if the statement agrees with the information
FALSE if the statement contradicts the information
NOT GIVEN if there is no information on this
- William used the electricity he creaated for village transport.
- At first, William's achievement was ignored by local peoples.
- Journalists from other countries visited William's farm.
- William used money he received to improve water supplies in his village.
- The health of the villages has improved since the windmill was built.
-
- Rearrange the words to make sentences.(10 Marks)
Example: Question: hope to doctor a I become
Answer: I hope to become a doctor.
- forward hearing from look to you We
- makes layout software useful makes popular and This
- logo company designing a is for the She
- network networks Internet a linking other The is
- by graphics pictures and draswings Computer computer produced are
- a different is parts of images create image combining Compositing to single
- username and system locked have to your password to type a computer You access
- the world you Email with all over exchange messges people lets
- to friends greate Instant be way communicate messaging a with can
- used produce and encyclopedias to dictionnaries is Multimedia
- Put the verbs in brackets into the correct tense: present perfect or simple past.(10 Marks)
- I (buy) a new house last year, but I(not sell) my old house yet, so at the moment I have two houses.
- When Ann (be) on her way to the station it (begin) to rain. Ann(run) back to her flat for her umbrella, but this (make) her late for ther train.
- Bill usually has breakfast at 8.00. Yesterday at 8.30 Peter (meet) Bill and (offer) him an apple. 'No, thanks' (say) Bill. 'I just (have) breakfast.'
-
- Fill in the blanks with the appropriate words given in the list.(10 Marks)
it its security consultants changes &nbps;converts solutions so that &nbps;crucial passwords intruders
Private networks can be attacked by 1......... who attempt to obtain information such as Social Security numbers, bank accounts or research and business reports. To protect 2........ data, companies hire 3........ who analyse the risks and provide 4............ The most common methods of protection are 5.......... for access control, firewalls, and encryption and decryption stystems. Encryption 6......... data into a secret code 7.......... only someone with a key can reaad 8.............. . Decryption 9........... encrypted data back into 10........ original form.
- Put the verbs in brackets into the correct tenases.(5 marks)
- I should have voted for her if I(have) a vote then.
- If you go to Paris, where you (stay)?
- If someone offered to buy you one of those rings, which you (choose)?
- The flight may be cancelled if the fog (get) think.
- If the milkman (come), tell him to leave two pints.
- Make question using these prompts.(5 Marks)
Example: When/first/use the Internet When did you first use the Internet?
- how many friends/have in your school?
- how often/ access the Internet?
- ever/visit another country?
- Why/apply for this University?
- Why/ apply for this University?
- how long/use computers?
- Put the verbs in brackets into the correct forms:infinitives and gerund.(10 Marks)
- After (spend) a week in the cottage, he decided that he didn't really enjoy (live) in the country and began (think) of an excuse for (sell) the cottage and (return) to London.
- Would you children mind (keep) quiet for a moment? I'm trying (fill) in a form.
It's no use(ask) children (keep) quiet. They can't help (make) a noise.
- Describe an activity which you enfoy doing in your spare time.(10 Marks)
You should write:
What kind of activity it is
where yu usually do it
what equipment you need to do this and say why you enjoy it so much.
- Write about the following topic:(20 Marks)
Universities should accept equal numbers of male and female students in every subject.
To what extent do you agree or disagree?
Give reasons for your answer and include any relevant from your own knowledge or experience.


The Kirlian Witness (1978) 88m.
A woman is found dead - apparently murdered - on a rooftop. Her sister (Nancy Snyder), unsatisfied with the official police findings, pursues inquiries of her own.  It sounds like a joke, but the story handles its premise seriously. Aware of the importance of suspending the audience's disbelief, first-time writer/director Jonathon Sarno provides a skeptical husband (Joel Kolodner) to voice our own doubts about Snyder's investigation as it progresses. Does it make the story more believable if the central character is a woman? I'd say that it was definitely a conscious choice of the film-makers, although it suggests the underlying message that women are more receptive to a broader view of science and nature than men. Personally I don't see THE KIRLIAN WITNESS reaching any conclusions about polygraphs, telepathy, or Kirlian photography as a forensic methodology: ultimately, the circumstances of Snyder's investigation can be boiled down to hypothesis and autosuggestion. It's an underplayed distraction to what really matters - that Kolodner and fellow murder suspect Ted Laplat become drawn into a paranoia that finds themselves believing in the occult and contributing to their downfall (the film's alternate title was THE PLANTS ARE WATCHING). THE KIRLIAN WITNESS may be more a new-agey Poe update than a film about Gaia or cosmic communion.
Sarno is smart enough to keep the tone of his film quiet; the unspoken joke is that characters communicate better with plants than between themselves. It's hard trying to pin down how they relate to each other - their roles as sister, husband, friend, or employee are non-specific. They don't even seem overly upset at the deaths that occur in the story (note that the violence towards plants is handled with just as much attention as that of the human characters). With the exception of Laplat, who has some good exchanges with Kolodner, the novice cast doesn't give a performance that promises film careers - at least Sarno got Hollywood veteran Lawrence Tierney on board in a supporting role. Film was marketed as a horror picture, although it is really an alternative take on crime thrillers. The economical storyline provides only two suspects, but delivers a satisfying conclusion. Coincidentally 1978 also saw the release of the documentary THE SECRET LIFE OF PLANTS, better known by its Stevie Wonder soundtrack, which made the top ten. The book of the same name can be glimpsed in Sarno's film.
<EMAIL_ADDRESS>Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com
The review above was posted to the
rec.arts.movies.reviews newsgroup (de.rec.film.kritiken for German reviews).
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.
Please direct comments/criticisms of the review to relevant newsgroups.
Broken URLs inthe reviews are the responsibility of the author.
The formatting of the review is likely to differ from the original due
to ASCII to HTML conversion.
Related links: index of all rec.arts.movies.reviews reviews


totalcross.lang.Class used to customize the way that Edit and MultiEdit handle keys. Useful, for example,
to handle devices with special keypads and translate them into standard characters.
You have to extend the preprocess method and change the key to one you may want to use.
Then, assign an instance of the class to the
instance
member, and the Edit and MultiEdit will use them
It has two handy methods, to be used to map char sequences. Below, an implementation for the the MC67.
PreprocessKey.instance =
new PreprocessKey()
{
private final char[][] keys =
{
{'.',','},
{'\0'},
{'a','b','c'},
{'d','e','f'},
{'g','h','i'},
{'j','k','l'},
{'m','n','o'},
{'p','q','r','s'},
{'t','u','v'},
{'w','x','y','z'},
};
protected char[] getKeySet(Control target, KeyEvent e)
{
if (e.type == KeyEvent.KEY_PRESS && (Settings.onJavaSE || (e.modifiers & SpecialKeys.SYSTEM) != 0)) // use only if key came from physical keyboard
{
char c = Convert.toLowerCase((char)e.key);
for (int i = 0; i < keys.length; i++)
if (keys[i][0] == c)
return keys[i];
}
return null;
}
public void preprocess(Control target, KeyEvent e)
{
handleKeypadPress(target, e);
}
};


Reflections
November 30, 2014
Growing up in a predominantly white conservative suburban town, I've witnessed and experienced stereotype threat. This occurred mainly when I was in high school. As an Asian at our school, we were viewed as the nerdy, quiet, book smart kids. I was always never good at speaking in public. We were giving speeches in English class one day and it was my turn. I got really nervous all of a sudden, I started to sweat and when I gave my speech I stumbled on some words. I felt like the pressure of failing got to me. As I worried more and more, my performance only got worse.
This is an example of stereotype threat. This is a term coined by Claude Steele & Joshua Aronson. They conducted a research study on how perceived stereotype affected their performance. They basically had two groups, blacks and whites. There were two conditions that they tested. The first test on stereotype threat was that the individuals were told the test would be a good indicator of their intellectual abilities. The non-threat test individuals were told that they were doing a problem solving exercises. They found that African-Americans did worse in the threat condition but both groups performed equally well in the non-threat condition. Steele stated that African-Americans who identified more with their race performed more poorly. Stereotypes can hurt your performance if you identify with that group and if the test is relevant to you.
I'm sure we've all witnessed this before. It's these stereotypes that dictate the way you feel when you do something. Sometimes you feel you always have to be aware of your actions or what you say in certain situations. There are ways to mitigate these feelings. One way to do this is by affirmation. By becoming confidant and proving to yourself you can do something only makes you less worried by outside factors / pressure. I think we can help each other out with by giving words of encouragement. When someone is feeling nervous or feel like they don't belong there, try lifting up their mood or reaffirm that they do belong there. By helping each other out, we can slowly knock down the pressures of stereotype threat.


flask.debughelpers.FormDataRoutingRedirect: b'A request was sent to this URL (http://localhost:5000/movies) but a redirect was issued automatically by the routing system to "http://localhost:5000/movies/". The URL was defined with a trailing slash so Flask will automatically redirect to the URL with the trailing slash if it was accessed without one. Make sure to directly send your POST-request to this URL since we can\'t make browsers or HTTP clients redirect with form data reliably or without user interaction.\n\nNote: this exception is only raised in debug mode'
__call__
def __call__(self, environ, start_response):
"""The WSGI server calls the Flask application object as the
WSGI application. This calls :meth:`wsgi_app` which can be
wrapped to applying middleware."""
return self.wsgi_app(environ, start_response)
def __repr__(self):
return '<%s %r>' % (
self.__class__.__name__,
self.name,
wsgi_app
try:
ctx.push()
response = self.full_dispatch_request()
except Exception as e:
error = e
response = self.handle_exception(e)
except:
error = sys.exc_info()[1]
raise
return response(environ, start_response)
finally:
handle_exception
# if we want to repropagate the exception, we can attempt to
# raise it with the whole traceback in case we can do that
# (the function was actually called from the except part)
# otherwise, we just raise the error again
if exc_value is e:
reraise(exc_type, exc_value, tb)
else:
raise e
self.log_exception((exc_type, exc_value, tb))
if handler is None:
reraise
from io import StringIO
def reraise(tp, value, tb=None):
if value.__traceback__ is not tb:
raise value.with_traceback(tb)
raise value
implements_to_string = _identity
else:
text_type = unicode
wsgi_app
ctx = self.request_context(environ)
error = None
try:
try:
ctx.push()
response = self.full_dispatch_request()
except Exception as e:
error = e
response = self.handle_exception(e)
except:
error = sys.exc_info()[1]
full_dispatch_request
request_started.send(self)
rv = self.preprocess_request()
if rv is None:
rv = self.dispatch_request()
except Exception as e:
rv = self.handle_user_exception(e)
return self.finalize_request(rv)
def finalize_request(self, rv, from_error_handler=False):
"""Given the return value from a view function this finalizes
the request by converting it into a response and invoking the
handle_user_exception
return self.handle_http_exception(e)
handler = self._find_error_handler(e)
if handler is None:
reraise(exc_type, exc_value, tb)
return handler(e)
def handle_exception(self, e):
"""Default exception handling that kicks in when an exception
occurs that is not caught. In debug mode the exception will
reraise
from io import StringIO
def reraise(tp, value, tb=None):
if value.__traceback__ is not tb:
raise value.with_traceback(tb)
raise value
implements_to_string = _identity
else:
text_type = unicode
full_dispatch_request
self.try_trigger_before_first_request_functions()
try:
request_started.send(self)
rv = self.preprocess_request()
if rv is None:
rv = self.dispatch_request()
except Exception as e:
rv = self.handle_user_exception(e)
return self.finalize_request(rv)
def finalize_request(self, rv, from_error_handler=False):
dispatch_request
This no longer does the exception handling, this code was
moved to the new :meth:`full_dispatch_request`.
"""
req = _request_ctx_stack.top.request
if req.routing_exception is not None:
self.raise_routing_exception(req)
rule = req.url_rule
# if we provide automatic options for this URL and the
# request came with the OPTIONS method, reply automatically
if getattr(rule, 'provide_automatic_options', False) \
and req.method == 'OPTIONS':
raise_routing_exception
or not isinstance(request.routing_exception, RequestRedirect) \
or request.method in ('GET', 'HEAD', 'OPTIONS'):
raise request.routing_exception
from .debughelpers import FormDataRoutingRedirect
raise FormDataRoutingRedirect(request)
def dispatch_request(self):
"""Does the request dispatching. Matches the URL and returns the
return value of the view or error handler. This does not have to
be a response object. In order to convert the return value to a
flask.debughelpers.FormDataRoutingRedirect: b'A request was sent to this URL (http://localhost:5000/movies) but a redirect was issued automatically by the routing system to "http://localhost:5000/movies/". The URL was defined with a trailing slash so Flask will automatically redirect to the URL with the trailing slash if it was accessed without one. Make sure to directly send your POST-request to this URL since we can\'t make browsers or HTTP clients redirect with form data reliably or without user interaction.\n\nNote: this exception is only raised in debug mode'
The console is locked and needs to be unlocked by entering the PIN. You can find the PIN printed out on the standard output of your shell that runs the server.


ID3 Helper.
Complete the fields below
Base classes (S):
The number of partitions. Select and then enable 'create'.
Partitions :
Delete
Create
Partitions
Compute
Output


since the last update of BBLog the process bar of the service star of a vehicle is shown wrong
(currently I saw it on AAVs and IFVs)
Unbenannt1.JPG
Unbenannt.JPG
the progression bars show percentage stats which are too little on this vehicle classes (possible the bug appeares on other classes, too)
I use FF 13.0.1 and BBLog 2.1.0


The raw yaml of a Pod API Object. Any pod fields set with non-empty values via the configuration fields above will generally take precedence as they are merged with this yaml, though in the case of arrays (like Volumes or Tolerations) the objects in the yaml will be appended to the existing list.
Fragments of a full Pod API Object yaml representation are allowed, but you must specify enough of the structure to give context for the object construction.
For example, you can start with:
apiVersion: v1 kind: Pod spec: ....
Or you can just specify the metadata:
and spec:
sections as needed.


Edit Profile
Monetize
Biography
Credit Card
Card Number
First Name
Surename
Card Type
Expire date
CVV code


|
Halide
12.0.0
|
Routines specific to the Halide Cuda runtime. More...
#include "HalideRuntime.h"
Go to the source code of this file.
Macros | |
| #define | HALIDE_RUNTIME_CUDA |
Functions | |
| const struct halide_device_interface_t * | halide_cuda_device_interface () |
| int | halide_cuda_initialize_kernels (void *user_context, void **state_ptr, const char *src, int size) |
| These are forward declared here to allow clients to override the Halide Cuda runtime. More... | |
| int | halide_cuda_run (void *user_context, void *state_ptr, const char *entry_name, int blocksX, int blocksY, int blocksZ, int threadsX, int threadsY, int threadsZ, int shared_mem_bytes, size_t arg_sizes[], void *args[], int8_t arg_is_buffer[], int num_attributes, float *vertex_buffer, int num_coords_dim0, int num_coords_dim1) |
| void | halide_cuda_finalize_kernels (void *user_context, void *state_ptr) |
| int | halide_cuda_wrap_device_ptr (void *user_context, struct halide_buffer_t *buf, uint64_t device_ptr) |
| Set the underlying cuda device poiner for a buffer. More... | |
| int | halide_cuda_detach_device_ptr (void *user_context, struct halide_buffer_t *buf) |
| Disconnect this halide_buffer_t from the device pointer it was previously wrapped around. More... | |
| uintptr_t | halide_cuda_get_device_ptr (void *user_context, struct halide_buffer_t *buf) |
| Return the underlying device pointer for a halide_buffer_t. More... | |
| int | halide_cuda_release_unused_device_allocations (void *user_context) |
| Release any currently-unused device allocations back to the cuda driver. More... | |
Routines specific to the Halide Cuda runtime.
Definition in file HalideRuntimeCuda.h.
| #define HALIDE_RUNTIME_CUDA |
Definition at line 19 of file HalideRuntimeCuda.h.
| const struct halide_device_interface_t* halide_cuda_device_interface | ( | ) |
Referenced by Halide::PyTorch::wrap().
| int halide_cuda_initialize_kernels | ( | void * | user_context, |
| void ** | state_ptr, | ||
| const char * | src, | ||
| int | size | ||
| ) |
These are forward declared here to allow clients to override the Halide Cuda runtime.
Do not call them.
| int halide_cuda_run | ( | void * | user_context, |
| void * | state_ptr, | ||
| const char * | entry_name, | ||
| int | blocksX, | ||
| int | blocksY, | ||
| int | blocksZ, | ||
| int | threadsX, | ||
| int | threadsY, | ||
| int | threadsZ, | ||
| int | shared_mem_bytes, | ||
| size_t | arg_sizes[], | ||
| void * | args[], | ||
| int8_t | arg_is_buffer[], | ||
| int | num_attributes, | ||
| float * | vertex_buffer, | ||
| int | num_coords_dim0, | ||
| int | num_coords_dim1 | ||
| ) |
| void halide_cuda_finalize_kernels | ( | void * | user_context, |
| void * | state_ptr | ||
| ) |
| int halide_cuda_wrap_device_ptr | ( | void * | user_context, |
| struct halide_buffer_t * | buf, | ||
| uint64_t | device_ptr | ||
| ) |
Set the underlying cuda device poiner for a buffer.
The device pointer should be allocated using cuMemAlloc or similar and must have an extent large enough to cover that specified by the halide_buffer_t extent fields. The dev field of the halide_buffer_t must be NULL when this routine is called. This call can fail due to being passed an invalid device pointer. The device and host dirty bits are left unmodified.
| int halide_cuda_detach_device_ptr | ( | void * | user_context, |
| struct halide_buffer_t * | buf | ||
| ) |
Disconnect this halide_buffer_t from the device pointer it was previously wrapped around.
Should only be called for a halide_buffer_t that halide_cuda_wrap_device_ptr was previously called on. The device field of the halide_buffer_t will be NULL on return.
| uintptr_t halide_cuda_get_device_ptr | ( | void * | user_context, |
| struct halide_buffer_t * | buf | ||
| ) |
Return the underlying device pointer for a halide_buffer_t.
This buffer must be valid on a Cuda device, or not have any associated device memory. If there is no device memory (dev field is NULL), this returns 0.
| int halide_cuda_release_unused_device_allocations | ( | void * | user_context | ) |
Release any currently-unused device allocations back to the cuda driver.
See halide_reuse_device_allocations.


{% extends "base.html" %} {% block title %} Web Monitor Help {% endblock %} {% block banner %} Web Monitor Help {% endblock %} {% block summary %} The Web Monitor allows you to verify the health of the data aquisition and post-processing.
The global status page shows a list of all the instruments monitored by this system. For each instrument, it shows a color-coded status for sub-systems.
The colored boxes indicate whether a system is alive and communicating correctly. If a system has a communication latency of more than 10 seconds, its condition will go to yellow. A system is considered dead if it goes 15 minutes without communication. The color for a dead system is red.
The Processing completion column indicates whether the last three runs have completed processing successfully. The condition will be red if the run before last has not completed. If it has completed successfully but either of the two runs that preceded it did not, the condition will go to yellow. A yellow condition indicates that the processing is currently healthy but it has recently failed.
The DAS monitor shows the current status of the acquisition. In addition to the system health information described above, it also shows the current run number and title, as well as the state of the acquisition (stopped, recording, or paused). The table shows the process variables that are emitted by the monitoring system. Some variable names have a link associated with them. Click on that link to see a plot of that variable's value over time. The plot at the top of the page shows the number of translated runs and number of errors per hour created within the past 24 hours. Errors are shown in red on the plot.
A link at the top right of the DAS monitor page allows you to switch back and forth between seeing the live process variables or the live run list. The last column of the run list shows whether a particular run has successfully gone through of the data processing. For a given run, the completion can either be complete or incomplete.


Read Geogebra files
Read Geoproof schemes
Select Geogebra XML file or GGB archive:
Select Geoproof XML file:
GeoGebra XML
Parse from text area
Geoproof XML
Geoproof properties
None


--- layout: default title: Introduction to Statistical Learning ---
This is an introductory-level course in supervised learning, with a focus on regression and classification methods. This is not a math-heavy class, so I try to describe the methods without heavy reliance on formulas and complex mathematics. Computing is done in R. There are labs devoted to R with more detailed sessions that implement the techniques in each lesson.


Applies function to every item of an iterable and returns a list of the results.
map (function, iterable [, ...])
list
#TODO
If additional iterable arguments are passed, function must take that many arguments and is applied to the items from all iterables in parallel. If one iterable is shorter than another it is assumed to be extended with None items. If function is None, the identity function is assumed; if there are multiple arguments, map() returns a list consisting of tuples containing the corresponding items from all iterables (a kind of transpose operation). The iterable arguments may be a sequence or any iterable object; the result is always a list.
>>> map(lambda x: x+x, (1, 2, 3))
[2, 4, 6]
>>> map(lambda x, y: x/y, (1, 4, 9), (1, 2, 3))
[1, 2, 3]
>>> map(lambda x, y, z: x+y+z, (1, 2, 3), (1, 4, 9), (1, 16, 27))
[3, 22, 39]
>>> map(None, [True, False])
[True, False]
>>> map(None, ['a', 'b'], [1, 2])
[('a', 1), ('b', 2)]
>>> map(None, ['a', 'b'], [1, 2, 3])
[('a', 1), ('b', 2), (None, 3)]
reduce(), filter() and Comprehensions and Generator Expression.


|
ALZW
|
LM phrase representative. More...
#include <search-engine.hpp>
Public Member Functions | |
| representative (const df_automaton &dfa) | |
| Create a new epsilon representative for a given DFA. More... | |
| representative (const representative &prev, uint8_t sym) | |
| Create a new representative for given prefix representative and suffix symbol. More... | |
| const representative * | get_prev () const |
| Get prefix representative. More... | |
| uint8_t | symbol () const |
| Get last transition symbol. More... | |
| const signature & | get_signature () const |
| Get current representative's signature. More... | |
| void | set_transition (uint8_t sym, const representative *r) |
| Set next representative for a given transition symbol. More... | |
| const representative * | get_transition (uint8_t sym) const |
| Get next representative for a given transition symbol. More... | |
LM phrase representative.
| representative::representative | ( | const df_automaton & | dfa | ) |
Create a new epsilon representative for a given DFA.
| dfa | DFA |
| representative::representative | ( | const representative & | prev, |
| uint8_t | sym | ||
| ) |
Create a new representative for given prefix representative and suffix symbol.
| prev | prefix |
| sym | suffix |
|
inline |
Get prefix representative.
|
inline |
Get current representative's signature.
|
inline |
Get next representative for a given transition symbol.
| sym | transition symbol |
|
inline |
Set next representative for a given transition symbol.
| sym | transition symbol |
| r | next representative |
|
inline |
Get last transition symbol.


WATERFAL THEME
SECTION1
SECTION2
SECTION3
SECTION4
Your company tagline goes here, banner overlay info, etc.
SCROLL BUTTON
Section 1
CONTENT HERE
BUTTON
Section 2
CONTENT HERE
Section 3
CONTENT HERE
Section 4
Secondary Title
JS
Title
Here
Link
JS
Title
Here
Link
JS
Title
Here
Link


Kelly Workshop
Slogan goes here
Mt Albert, Auckland
Call 09 555 5555
Ph: 09 555 5555
We do this and that for you (very quick summary)
Have a warning light? Click it for more info:
© 2013 kellyworkshop.co.nz | Website by Annie Kyles.


Spaniards convicted of rape also sentenced for videoing it
by The Associated Press, StaffMADRID -- Two Spaniards who were among a group of five convicted earlier this year of raping a woman each were Wednesday sentenced to three years and three months more in prison for having made videos of the rape with their phones.
A regional court in Pamplona also fined them 5,670 euros (US$6,280) on Wednesday for the seven videos and two photographs they made of the rape.
The five, who had a WhatsApp group named "La Manada," or "The Animal Pack," were imprisoned for 15 years by the Supreme Court in June for raping an 18-year-old woman during Pamplona's San Fermin festival in 2016.
The case earned renown because lower courts convicted them of lesser crimes.
Four of the five are also on trial for allegedly sexually abusing another woman in 2016.
------
This story has been corrected to reflect that the Supreme Court sentenced the men in June, not July


Your username is {{ username }}, feel free to change it in your account settings at any time.
{{ username }}
You can now browse for scenes you like, or upload your own!


It seems appropriate to bookend my summer writing hiatus with some notes on the start of the year on August 6th. I’ve got a lot of things planned and I’m excited to start the year fresh in the same building and same course I was teaching at the end of last year. It’s an opportunity I haven’t had in a while and I’m looking forward to having some direct continuity. I’m also excited because I can take my notes from last year and apply them immediately in context.
These are in a quasi-hierarchy based on how much I’ve thought about it over the summer.
I’ve also made it a goal of mine to make sure anything I create is reusable and immediately helpful. I’ve learned that I get caught up in how “pretty” something is – big images, clean lines, etc. It’s a distraction and doesn’t necessarily help the learning. To fix it, I’m taking my class website back to bare-bones. Students need information and they don’t want to dig for it. So, my website is now a collapsing tree of links that is so minimal it works on everything. (Turns out, when you don’t care about images, you can build a mobile-ready site in minutes.)
The goal is usability. Titles are descriptive and in sequence. They’re also hidden until the students wants to see it. The arrow icons on some items show that they’ll be taken to another page (usually a Google Doc with more information). This is also lightning fast because the entire website comes in around 10KB right now (compared to an average website, which comes in at 2MB).
There is a lot that will probably change, and that’s okay…teaching is a learning process.
Written on July 31st , 2015 by Brian Bennett Categorized in: All Teaching
Leave a comment


Basecamp®
Manage Projects
As easy as email, just way more powerful.
Highrise®
Manage Contacts
Over 20,000,000 contacts managed with Highrise.
Campfire™
Work in Real-Time
Private group chat rooms for your business.
Used by millions for project management.
Find out more
Know the people you do business with.
Find out more
Group chat rooms for your business.
Find out more
Meet some customers
Our loyal customers include designers, developers, freelancers, lawyers, accountants, architects, non-profits, charities, universities, PR firms, retailers, manufacturers, consultants, authors, publishers, government agencies, students, marketers, airlines, restaurants, filmmakers, farmers, and just about everyone in-between.
The world's most popular brands depend on our products every day. We'll never take their trust - or your trust - for granted.
Bells and whistles wear off, but usefulness never does. We build useful software that does just what you need and nothing you don't.
We're famous for fast and friendly customer service. We work hard to make sure we live up to that reputation every day. See how our customers rate our service.
Buzzwords, lingo, and sensationalized sales-and-marketing-speak have no place at 37signals. We communicate clearly and honestly.
Our customers fund our daily operations by paying for our products. We answer to them - not investors, the stock market, or a board of directors.
We'll never overlook what really matters: The basics. Great service, ease of use, honest pricing, and respect for our customer's time, money, and trust.
We believe everyone is entitled to the best price we can offer. Our prices are public, published right on our site, and the same no matter who you are.
Our products are intuitive. You'll pick them up in seconds or minutes, not hours, days or weeks. We don't sell you training because you don't need it.
No one likes being locked into something they don't want anymore. Our customers can cancel at any time, no questions asked. No setup/termination fees either.
- Mark Cuban, co-founder HDNet, owner of the Dallas Mavericks
- Tony Hsieh, CEO of Zappos.com
As easy as email, just way more powerful.
Over 20,000,000 contacts managed with Highrise.
Private group chat rooms for your business.


Matching Pairs
Drag each word on the right into the box by the most closely related word on the left.
Check
Reset


| Jacket Alteration Prices | |
|---|---|
| Shorten Sleeves | $35 and up |
| Taper Sleeves | $20 and up |
| Shorten Length | $50 and up |
| Center Seam | $30 |
| Side Seams | $30 |
Need A Jacket That Fits You Perfectly?
If you've been searching New York's streets for an alterations specialist to make a few nips and tucks to your favorite jacket without costing you a fortune, we know it's easier said than done. Now, thanks to BZ Tailor, jacket alterations are faster and more affordable than ever before. We pride ourselves on our friendly, efficient and professional service that years of experience in the industry have taught us.
Trust Your Jacket Alterations to The Best Tailor in New York City
Our team has over 40 years of experience in the alterations industry, and we're confident that we can provide the best alterations for any article of clothing. We're so confident, in fact, that if you're not 100% satisfied with our work, we'll redo the work at no cost to you. No other alterations specialist in New York City provides the same quality, on-demand service as BZ Tailor.
How Our Service Works
It's as easy as one simple phone call to have your jacket alterations completed. Simply call to schedule an appointment with our tailor. We'll work with you to find a time that's best for you to come to your home and take measurements. From there, we'll complete your alterations in our workshop, then deliver your clothing back to your home within three business days. That's right, there's no need to travel to us to get your clothing altered. With service this convenient and affordable, you have no excuse not to look your very best in your clothes.
 Trust BZ Tailor to custom fit your clothing for you.


The philosophy behind Wordology is that the best way to learn how to do something is to do it for its own sake, and let learning it be a side-effect, rather than to try and discipline yourself to do it in order to learn it. The best way to learn to cook is to start cooking all of your meals, not to force yourself to cook one recipe a week. The best way to get fit is to take up a sport you enjoy, rather than force yourself to exercise every day. Wordology helps reading in your target language become an activity you can do casually, as part of your every day routine, rather than as homework.
Wordology is not a translation app! By making you add each word you learn to the app manually, Wordology tries to give you a sense of progress on your quest to learn your target language.
From the Words tab on this page, you can save your wordlist as a file. The same file can later be imported back into Wordology from the Words tab. This can be used for backup, sharing, for syncing the extension between computers, or for learning multiple languages at once.
For nerds: the wordlist is saved as a JSON file with the following structure:
[ {"word": "bonjour", "definition": "hello"}, {"word": "oui", "definition": "yes"}, {"word": "non", "definition": "no"} ]Your wordlist is not erased before the file is imported, rather, entries in the file are added to the entries in your list. If an entry with the same word field appears in both your wordlist and the imported file, the entry in the file replaces the one in your wordlist.
In many languages, words can be built out of simpler words by adding suffixes. English nouns become plural by adding an -s, French verbs take on a variety of different tenses and aspects by adding suffixes like -ez or -aient, and English adverbs are built out of adjectives by adding -ly. When Smart Matching is turned on, Wordology attempt to detect such variant words. Definitions are shown not just for words that are in your dictionary, but for words which are similar to a word in your dictionary. The behavior of Smart Matching can be fine-tuned in the Options tab.
Words detected by Smart Matching will be highlighted in blue, rather than green. If the match is incorrect, you can click on it and add the correct definition to the dictionary. If the match is correct, you can add it as well, just so that the word shows up in green rather than blue, but it's recommended you don't do this. Smart Matching is intended as a labor saving device, so it's recommended you let it save you labor.
Smart Matching is based on some simple heuristics which give reasonable results for European languages. At the most basic level, a word on the page is considered to match a word in your dictionary if they have a minimum number of common initial letters. For example, the words ferocious and ferocity have the six initial letters “feroci” in common. The minimum number of common initial letters for a match is set through the “Minimum length of a root” setting in the Options tab.
Starting with the same letters doesn’t necessarily mean two words are related, since many languages have a certain number of prefixes that appear in many words, for example “un” or “re” in English. In order to compensate for this, you can blacklist common prefixes. Blacklisted prefixes are ignored when counting initial common letters, so if “re” were blacklisted, the words “rebuke” and “rebuttal” would be considered to only have two common letters (“bu”) and not four.
If, having discared blacklisted prefixes, two words share the minimum number of common initial letters, the remaining letters are considered. If there are too many remaining letters, the words are not considered a match. For example, the words “friendship” and “fries” share four common letters, “frie”. However, it should be obvious that “ndship” is too long to be a grammatical suffix of some kind. Therefore, the words would not be considered a match. The maximum length of a suffix can be set in the options.
However, languages may have certain particularly long grammatical suffixes which are nevertheless quite common, such as “-ally” in English, to indicate an adverb. Such suffixes can be whitelisted, and they will be ignored in counting the length of a suffix.


We don't like to boast, but when it comes to places to visit, we have some mighty fine options indeed. We wouldn't be surprised if you wanted to experience them all.
So what's on offer? Hear tales of kings and queens, see striking cliff-top castles and discover science's latest inventions. Whether you want to step onboard a Royal yacht in Leith, climb over 240 steps up the National Wallace Monument for views over a National Park or try your hand at keyhole surgery, there are countless ways to fill days, weeks and even months at many attractions.
Here's just a glimpse of some of the top architectural feats - the odd engineering masterpiece or monument might have slipped in too, as they're just too iconic to miss out!
There's plenty of sites across the country where you can explore these fascinating architectural designs for yourself and see how the process of building and design has developed over time.
There are many reasons why you might be drawn into a gallery. It could be for the love of art, the need for pictorial stimulation, a desire to be exposed to new ideas, or perhaps because it's a dry space to while away a wet afternoon. Maybe you just like the fact that most are free to enter!
Many larger galleries also boast delightful cafés offering superb local produce and home baking - a perfect pit stop for when your feet get tired!
Stroll along avenues of rustling beeches planted centuries ago. Breathe in the perfume of the flowerbeds as bees buzz happily around you. Watch the herons as they shop for lunch in tinkling streams. If you want to truly relax, return to nature in one of our beautiful parks and gardens and let natural Scotland soothe your spirits.
Film buff or not, follow the movie trails and in the footsteps of your favourite characters, discovering sprawling beaches, ancient castles, rugged mountains, rolling hills, distinctive cities and picturesque towns and villages.