Change Log: 2.079.0
Download D 2.079.0
released Mar 01, 2018
Compiler changes
- Argument mismatch errors have been improved
- The deprecation period of using the result of comma expression has ended
- Function parameters with default values are now allowed after variadic template parameters
- The delete keyword has been deprecated.
- The deprecation period of the -dylib flag on OSX has ended. Use -shared
- Experimental @nogc Exception throwing with -dip1008
- A compiler trait used to detect if a function is marked with @disable has been added.
- Fix Issue 17630 - selective imports find symbols in private imports of other modules
- Fix issue 17899 - Allow delegates to be initialised at compile time
- Fix Issue 18053 - mangle long/ulong as int64_t/uint64_t
- Fix Issue 18219 - Private import inside struct leaks symbols when used as VarDeclaration types
- Fix issue 18361 - Ddoc ability to opt-out of automatic keyword highlighting in running text
- D ABI change on Win32 and OSX targets
- HexString literals are deprecated.
- Added the -i command line option to automatically include imports
- Added -Xi=<name> to include more fields in the JSON output
- Lambda comparison using __traits(isSame, ...)
- Windows: Visual C++ and the Windows SDK are no longer required to build 64-bit executables
- Using D with no/minimal/custom runtime implementation in a pay-as-you-go fashion
- macOS deployment target was increased to 10.9
- Deprecate the use of selectively imported private members
- .ptr on arrays can no longer be used in @safe code
Runtime changes
Library changes
- std.format with strings passed during compile-time has been optimized
- Changed std.conv.hexString to return an immutable string literal
- Nullable!C.nullify no longer calls .destroy when C is a class or interface
- std.algorithm.iteration.substitute was added
- divMod was added to std.bigint.
- getDigit Was Added To std.bigint
- std.exception.enforce can now be used as an eponymous template to create your own enforce function
- import std.experimental.all as a global convenience import
- Replace std.experimental.allocator.IAllocator with std.experimental.allocator.RCIAllocator
- Replace std.experimental.allocator.ISharedAllocator with std.experimental.allocator.RCISharedAllocator
- readText now checks BOMs
- fold is added to std.parallelism.TaskPool
- nullSink was added to std.range
- std.range.slide (a fixed-size sliding window range) was added
- std.string.strip now accepts a string of characters to be stripped
- isSomeString and isNarrowString are now false for enums
- toString Can Now Use Output Ranges
List of all bug fixes and enhancements in D 2.079.0.
Compiler changes
- Argument mismatch errors have been improved
dmd now shows which argument failed to match a parameter with an explanatory error message.
void fill(ref char[16] buf, char c); void main() { fill("1234567890123456", '*'); const char[16] s; fill(s, '*'); }
Output:
fillchar.d(5): Error: function fillchar.fill(ref char[16] buf, char c) is not callable using argument types (string, char) fillchar.d(5): cannot pass rvalue argument "1234567890123456" of type string to parameter ref char[16] buf fillchar.d(8): Error: function fillchar.fill(ref char[16] buf, char c) is not callable using argument types (const(char[16]), char) fillchar.d(8): cannot pass argument s of type const(char[16]) to parameter ref char[16] buf
Note: Currently this change doesn't apply when the function has overloads.
- The deprecation period of using the result of comma expression has ended
Comma expressions have proven to be a frequent source of confusion, and bugs. Using their result will now trigger an error message.
The comma operator (,) allows executing multiple expressions and discards the result of them except for the last which is returned.
int a = 1; int b = 2; bool ret = a == 2, b == 2; // true
It's also common to use the comma operator in for-loop increment statements to allow multiple expressions.
for (; !a.empty && !b.empty; a.popFront, b.popFront)
Hence, using the comma operator in for-loop increment statements is still allowed.
Corrective Action
If possible, split the comma operator in two statements. Otherwise use lambdas.
auto result = foo(), bar(); // split off in two statements foo(); auto result = bar(); // or use lambdas auto result = {foo(); return bar();}();
Rationale
The comma operator leads to unintended behavior (see below for a selection) Moreover it is not commonly used and it blocks the ability to implement tuples as a language feature using commas.
A selection of problems through the accidental use of the comma operator:
writeln( 6, mixin("7,8"), 9 ); // 6, 8, 9 struct Vec { this(T...)(T args) { ... } } // missing type name Vec v = (0, 0, 3); // Vec(3) int a = 0; int b = 2; if (a == 1, b == 2) { // will always be reached } void foo(int x, int y=0) {} foo((a, b)); // Oops, foo(b) is called synchronized (lockA, lockB) {} // multiple expressions aren't currently implemented, but it compiles due to the comma operator
- Function parameters with default values are now allowed after variadic template parameters
Function parameters with default values are now allowed after variadic template parameters and when IFTI is used, always take their default values. This allows using special tokens (eg __FILE__) after variadic parameters, which was previously impossible.
For example:
string log(T...)(T a, string file = __FILE__, int line = __LINE__) { return text(file, ":", line, " ", a); } assert(log(10, "abc") == text(__FILE__, ":", __LINE__, " 10abc"));
This should be preferred to the previous workaround, which causes a new template instantiation for every invocation:
string log(string file = __FILE__, int line = __LINE__, T...)(T a);
- The delete keyword has been deprecated.
See the Deprecated Features for more information.
Starting with this release, using the delete keyword will result in a deprecation warning.
As a replacement, users are encouraged to use destroy if feasible, or core.memory.__delete as a last resort.
- The deprecation period of the -dylib flag on OSX has ended. Use -shared
The deprecation period of the -dylib flag on OSX has ended.
dmd -dylib awesome_d_library.d
Use the -shared flag to generate a shared library:
dmd -shared awesome_d_library.d
- Experimental @nogc Exception throwing with -dip1008
DIP 1008 has been merged and it can be previewed under the experimental -dip1008 flag:
void main() @nogc { throw new Exception("I'm @nogc now"); }
rdmd -dip1008 app.d
- A compiler trait used to detect if a function is marked with @disable has been added.
Prior to this release is was impossible to filter out @disable functions without using __trait(compiles), which was less than ideal since false could be returned for other reasons.
Now, in metaprogramming code, @disable functions can be detected accurately, using __traits(isDisabled) and even in overload sets:
module runnable; struct Foo { import std.stdio; @disable static void foo() {__PRETTY_FUNCTION__.writeln;} static void foo(int v) {__PRETTY_FUNCTION__.writeln;} static void bar() {__PRETTY_FUNCTION__.writeln;} @disable static void bar(int v) {__PRETTY_FUNCTION__.writeln;} } void test(T)() { foreach (member; __traits(allMembers, T)) foreach (overload; __traits(getOverloads, T, member)) static if (!__traits(isDisabled, overload)) { static if (is(typeof(&overload) == void function())) overload(); else static if (is(typeof(&overload) == void function(int))) overload(42); } } void main(){test!Foo;}
prints:
void runnable.Foo.foo(int v) void runnable.Foo.bar()
- Fix Issue 17630 - selective imports find symbols in private imports of other modules
Selectively importing a symbol should work only if the symbol imported is defined or publicly imported in the imported module. Due to a compiler bug, selectively importing a symbol works even if the symbol is defined in a privately imported module in the imported module.
//a.d int bar; //b.d import a; //c.d import b : bar;
The above code will now result in a deprecation message which states that bar cannot be accessed since it is privately imported in b.
- Fix issue 17899 - Allow delegates to be initialised at compile time
delegates may now be initialised at module scope. This changes the effect of the fix for 13259 (turning the ICE that resulted into an error) making the follow legal:
void delegate() bar = (){};
The function pointer is set to the function of the delegate, the context pointer is set to null.
- Fix Issue 18053 - mangle long/ulong as int64_t/uint64_t
This is a breaking change (on OSX 64).
Due to the erratic implementation defined behavior of C++ name mangling, it was difficult to get D's long/ulong to portably match up with the corresponding C++ compiler.
By instead relying on how the corresponding C++ compiler mangled int64_t/uint64_t it makes the C++ side of the D<=>C++ interface much simpler.
For the current platforms dmd supports, only the OSX 64 bit mangling changes. In this case from 'm' to 'y'.
Note: int64_t and uint64_t are defined in stdint.h
- Fix Issue 18219 - Private import inside struct leaks symbols when used as VarDeclaration types
When implementing a struct which has a local private import the imported symbols are leaked if present in a VarDeclaration statement. For more information and examples see : https://issues.dlang.org/show_bug.cgi?id=18219
Symbols from the private import should not visible outside the struct scope. A deprecation is now issued when such cases are encountered
- Fix issue 18361 - Ddoc ability to opt-out of automatic keyword highlighting in running text
Currently, ddoc automatically highlights all occurrences of words in running text that coincide with the symbol or module being documented, or a parameter name of a function being documented. While convenient, it often caused unintended highlighting of normal words in text when module, function, or parameter identifiers coincide with normal words. This led to a proliferation of prefixing words with _ in order to suppress this behaviour.
Now a better solution has been implemented to completely opt-out of this feature via the DDOC_AUTO_PSYMBOL, DDOC_AUTO_KEYWORD, and DDOC_AUTO_PARAM macros, which are used for all such automatically-highlighted words in running text. Occurrences of module, function, or parameter names inside code blocks are not included. By default, these macros simply redirect to DDOC_PSYMBOL, DDOC_KEYWORD, and DDOC_PARAM, but the user can now redefine these macros so that they simply expand to the word itself without any highlighting:
DDOC_AUTO_PSYMBOL = $0 DDOC_AUTO_KEYWORD = $0 DDOC_AUTO_PARAM = $0
Furthermore, whenever a word is prefixed with _ to suppress automatic highlighting, it is now wrapped in the DDOC_AUTO_PSYMBOL_SUPPRESS macro. This is to provide users who wish to opt out of automatic highlighting an easy way to find all occurrences of these underscore prefixes so that they can be removed from the text. For example, they can redefine this macro to something highly-visible and easily searched for, such as:
DDOC_AUTO_PSYMBOL_SUPPRESS = FIXME_UNDERSCORE_PREFIX
and then search the generated documentation for the string FIXME_UNDERSCORE_PREFIX and delete the _ prefix from all corresponding parts of the documentation comment text.
- D ABI change on Win32 and OSX targets
The compiler has been updated to prefix all extern(D) symbols with an extra underscore where the platform expects one on all external symbols. This allows compiled code to work better with binutil programs, such as the ability to list symbols demangled inside a debugger.
This is an ABI breaking change and requires recompiling libraries.
- HexString literals are deprecated.
HexString literals are deprecated. Use std.conv.hexString instead.
- Added the -i command line option to automatically include imports
Added the command line option -i which causes the compiler to treat imported modules as if they were given on the command line. The option also accepts "module patterns" that include/exclude modules based on their name. For example, the following will include all modules whose names start with foo, except for those that start with foo.bar:
dmd -i=foo -i=-foo.bar
The option -i by itself is equivalent to:
dmd -i=-std -i=-core -i=-etc -i=-object
- Added -Xi=<name> to include more fields in the JSON output
Added -Xi=<name> to include more fields in the JSON output. Currently there are 4 fields that can be included: "compilerInfo", "buildInfo", "modules" and "semantics", i.e.
dmd -Xi=compilerInfo -Xi=buildInfo -Xi=semantics -Xi=modules
will generate a JSON file with the following:
{ "compilerInfo" : { "binary" : "<filename-of-compiler-binary>", "version" : "<compiler-version>", "supportsIncludeImports" : true, }, "buildInfo" : { "config" : "<config-filename>", "cwd" : "<cwd-during-build>", "importParths" : [ "<import-path1>", "<import-path2>", // ... ] }, "semantics" : { "modules" : [ { "name" : "<module-name>", "file" : "<module-filename>", "isRoot" : true|false }, // more module objects... ] }, "modules" : [ // an array of the syntax data for all the modules, // this is the same array that would be generated // for a JSON file with no -Xi=<field> options ] }
If JSON is generated without any -Xi= options then the old format is used. The old format is the same data that would appear in the new "modules" field.
Also note that the compiler can now be invoked with no source files as long as at least one JSON field is provided, i.e.
dmd -Xi=compilerInfo
This is an experimental command-line flag and will be stabilized in the next release.
- Lambda comparison using __traits(isSame, ...)
It is now possible to compare two lambda functions, under certain constraints, using __traits(isSame, lamda1, lambda2). In order to correctly compare two lambdas, the following conditions must be satisfied:
- the lambda function arguments must not have a template instantiation as an explicit argument type. Any other argument types (basic, user-defined, template) are supported.
- the lambda function body must contain a single expression (no return statement) which contains only numeric values, manifest constants, enum values and arguments. If the expression contains local variables, function calls or return statements, the function is considered uncomparable.
These limitations might be lifted in the next release version.
Whenever a lambda is considered uncomparable, the __traits(isSame, ...) expression in which it's used will return false, no matter what other lambda is used in the comparison.
- Windows: Visual C++ and the Windows SDK are no longer required to build 64-bit executables
The Windows installer now adds platform libraries built from the MinGW definitions and a wrapper library for the VC2010 shared C runtime. When building COFF object files with -m64 or -m32mscoff and no Visual Studio installation is detected or no platform libraries are found these will be used as replacements. If the Microsoft linker is not found, the LLVM linker LLD will be used.
- Using D with no/minimal/custom runtime implementation in a pay-as-you-go fashion
DMD has been further decoupled from the runtime so it is now easier and more convenient to use D without the runtime in a pay-as-you-go fashion. This will be of interest to users wishing to incrementally or partially port D to new platforms, users targeting bare-metal or resource constrained platforms, and users wishing to use D as a library from other languages without the runtime.
Prior to this release, if one attempted to compile a simple D application that made no use of any runtime features, the compiler would have emitted a number of errors about a missing object.d, a missing Error class, missing TypeInfo, and missing ModuleInfo, among others.
Starting with this release, one can now create a library for use from another language, requiring only the .d source file that implements that library, and an empty object.d file
Example 1
module object
module math; extern(C) int add(int a, int b) { return a + b; }
dmd -conf= -lib math.d size math.a text data bss dec hex filename 0 0 0 0 0 math.o (ex math.a) 20 0 0 20 14 math_1_129.o (ex math.a)
Also, starting with this release, one can now create very small executables with a minimal runtime implementation.
Example 2
DMD auto-generates a call to _d_run_main which, in turn, calls the user-defined main function. DMD automatically generates a call to g++ which links in the C runtime.
module object; private alias extern(C) int function(char[][] args) MainFunc; private extern (C) int _d_run_main(int argc, char** argv, MainFunc mainFunc) { return mainFunc(null); // assumes `void main()` for simplicity }
module main; void main() { }
dmd -conf= -defaultlib= -fPIC main.d object.d -of=main size main text data bss dec hex filename 1403 584 16 2003 7d3 main
Example 3
Manually generated call to main. No C runtime.
module object; extern(C) void __d_sys_exit(long arg1) { asm { mov RAX, 60; mov RDI, arg1; syscall; } } extern void main(); private extern(C) void _start() { main(); __d_sys_exit(0); }
module main; void main() { }
dmd -c -lib main.d object.d -of=main.o ld main.o -o main size main text data bss dec hex filename 56 0 0 56 38 main
Usage of more advanced D features (e.g. classes, exceptions, etc...) will require runtime implementation code, but they can be implemented in a pay-as-you-go fashion.
- macOS deployment target was increased to 10.9
The compiler has been updated to use 10.9 and link with libc++ on OSX. This is due the shared libstdc++ library from older versions of macOS having compatibility issues with the headers included in a modern XCode.
The minimum required version of running the compiler is now Mac OS X Mavericks (10.9).
- Deprecate the use of selectively imported private members
The specification states that a private member is visible only from within the same module. Prior to this release, due to a bug, private members were visible through selective imports from other modules, violating the specification. Beginning with this release, accessing private members from outside the module in which they are declared will result in a deprecation message.
- .ptr on arrays can no longer be used in @safe code
The deprecation period for using .ptr on arrays in @safe ended. The following now triggers an error instead of a deprecation:
@safe ubyte* oops(ubyte[] arr) { return arr.ptr; }
Use &arr[0] instead:
@safe ubyte* oops(ubyte[] arr) { return &arr[0]; }
Note that this only applies to SafeD - in @system code .ptr may still be used:
@system ubyte* oops(ubyte[] arr) { return arr.ptr; }
Runtime changes
- core.memory.__delete has been added
core.memory.__delete allows easy migration from the deprecated delete. __delete behaves exactly like delete:
bool dtorCalled; class B { int test; ~this() { dtorCalled = true; } } B b = new B(); B a = b; b.test = 10; __delete(b); assert(b is null); assert(dtorCalled); // but be careful, a still points to it assert(a !is null);
For example, on a Posix platform you can simply run:
sed "s/delete \(.*\);/__delete(\1);/" -i **/*.d
Users should prefer object.destroy` to explicitly finalize objects, and only resort to core.memory.__delete when object.destroy would not be a feasible option.
- The garbage collector is now lazily initialized on first use
The runtime now lazily initializes the GC on first use, thus allowing applications that do not use the GC to skip its initialization.
Library changes
- std.format with strings passed during compile-time has been optimized
Giving std.format.format a string as a template parameter allows the type correctness of the parameters to be checked at compile time:
import std.format : format; auto s1 = format!"%d"(4); // works fine auto s2 = format("%d"); // runtime exception auto s3 = format!"%d"(); // compile time error
Now, using this overload also allows std.format to make an educated guess at the length of the resulting string, reducing the total number of reallocations made to the output buffer.
import std.format : format; auto s1 = format!"%02d:%02d:%02d"(10, 30, 50); // known for certain to be 8 chars long auto s2 = format!"%s %d"("Error Code: ", 42); // Makes an educated guess
Longer format strings benefit the most from this change.
- Changed std.conv.hexString to return an immutable string literal
std.conv.hexString now returns an immutable string literal rather than an array of ubytes. This is more in keeping with the documentation that says it is a replacement for the deprecated x"deadbeef" string literal syntax.
The benefits of this change are:
- behavior consistency with the documentation
- the hexString template instantiations no longer appear in the generated object file
- the generated object file no longer contains references to TypeInfo and various druntime functions
- it is now compatible with -betterC mode
In some cases, code did rely on it being an array, and a cast will fix the issue:
// now an error: enum ubyte[8] input = hexString!"c3 fc 3d 7e fb ea dd aa";
// add cast to fix: enum ubyte[8] input = cast(ubyte[8]) hexString!"c3 fc 3d 7e fb ea dd aa";
- Nullable!C.nullify no longer calls .destroy when C is a class or interface
Previously, when .nullify is called on a Nullable!C where C is a class or interface, the underlying object is destructed immediately via the .destroy function. This led to bugs when there are still references to the object outside of the Nullable instance:
class C { int canary = 0xA71FE; ~this() { canary = 0x5050DEAD; } } auto c = new C; assert(c.canary == 0xA71FE); Nullable!C nc = nullable(c); nc.nullify; assert(c.canary == 0xA71FE); // This would fail
The .nullify method has been fixed so that it no longer calls .destroy on class or interface instances, and the above code will now work correctly.
- std.algorithm.iteration.substitute was added
std.algorithm.iteration.substitute yields a lazy range with all occurrences of the substitution patterns in r replaced with their substitution:
import std.algorithm.comparison : equal; import std.algorithm.iteration : substitute; // substitute single elements assert("do_it".substitute('_', ' ').equal("do it")); // substitute multiple, single elements assert("do_it".substitute('_', ' ', 'd', 'g', 'i', 't', 't', 'o') .equal("go to")); // substitute subranges assert("do_it".substitute("_", " ", "do", "done") .equal("done it")); // substitution works for any ElementType int[] x = [1, 2, 3]; auto y = x.substitute(1, 0.1); assert(y.equal([0.1, 2, 3])); static assert(is(typeof(y.front) == double));
If the substitution parameters are known at compile-time, the faster template overload can be used:
import std.algorithm.comparison : equal; import std.algorithm.iteration : substitute; // substitute subranges of a range assert("apple_tree".substitute!("apple", "banana", "tree", "shrub").equal("banana_shrub")); // substitute elements in a range assert("apple_tree".substitute!('a', 'b', 't', 'f').equal("bpple_free")); // substitute values assert('a'.substitute!('a', 'b', 't', 'f') == 'b');
- divMod was added to std.bigint.
std.bigint.divMod calculates both the quotient and the remainder in one go:
void divMod(const BigInt dividend, const BigInt divisor, out BigInt quotient, out BigInt remainder) pure nothrow { auto a = BigInt(123); auto b = BigInt(25); BigInt q, r; divMod(a, b, q, r); assert(q == 4); assert(r == 23); assert(q * b + r == a); }
- getDigit Was Added To std.bigint
std.bigint.getDigit gives the ulongs or uints that make up the underlying representation of the BigInt.
import std.bigint; auto a = BigInt("1000"); assert(a.getDigit(0) == 1000); auto b = BigInt("2_000_000_000_000_000_000_000_000_000"); assert(b.getDigit(0) ==<PHONE_NUMBER>820579328); assert(b.getDigit(1) == 108420217);
- std.exception.enforce can now be used as an eponymous template to create your own enforce function
std.exception.enforce now mirrors the behavior of std.exception.enforceEx and can be used as an eponymous template:
import std.conv : ConvException; alias convEnforce = enforce!ConvException; assertNotThrown(convEnforce(true)); assertThrown!ConvException(convEnforce(false, "blah"));
With this change, std.exception.enforce is a strict superset of std.exception.enforceEx, which will be deprecated in 2.079.
- import std.experimental.all as a global convenience import
std.experimental.all allows convenient use of all Phobos modules with one import:
import std.experimental.all; void main() { 10.iota.map!log.sum.writeln; }
For short scripts a lot of imports are often needed to get all the modules from the standard library. With this release it's possible to use import std.experimental.all for importing the entire standard library at once. This can be used for fast prototyping or REPLs:
import std.experimental.all; void main() { 6.iota .filter!(a => a % 2) // 0 2 4 .map!(a => a * 2) // 0 4 8 .tee!writeln .sum .writefln!"Sum: %d"; // 18 }
As before, symbol conflicts will only arise if a symbol with collisions is used. In this case, static imports or renamed imports can be used to uniquely select a specific symbol.
The baseline cost for import std.experimental.all is less than half a second (varying from system to system) and work is in progress to reduce this overhead even further.
- Replace std.experimental.allocator.IAllocator with std.experimental.allocator.RCIAllocator
Motivation:
Keep track of references to allocators so they don't escape, dangle, and cause undefined behavior.
From now on, RCIAllocator will be used instead of the old IAllocator interface. std.experimental.allocator.allocatorObject can be used to build a RCIAllocator out of a custom allocator.
import std.experimental.allocator.mallocator : Mallocator; RCIAllocator a = allocatorObject(Mallocator.instance); auto b = a.allocate(100); assert(b.length == 100); assert(a.deallocate(b));
- Replace std.experimental.allocator.ISharedAllocator with std.experimental.allocator.RCISharedAllocator
Motivation:
Keep track of references to allocators so they don't escape, dangle, and cause undefined behavior.
From now on, RCISharedAllocator will be used instead of the old ISharedAllocator interface. std.experimental.allocator.sharedAllocatorObject` can be used to build a RCISharedAllocator out of a custom allocator.
import std.experimental.allocator.building_blocks.free_list : SharedFreeList; import std.experimental.allocator.mallocator : Mallocator; shared SharedFreeList!(Mallocator, chooseAtRuntime, chooseAtRuntime) sharedFL; shared RCISharedAllocator sharedFLObj = sharedAllocatorObject(sharedFL); auto b = sharedFLObj.allocate(100); assert(b.length == 100); assert(sharedFLObj.deallocate(b));
- readText now checks BOMs
std.file.readText now checks for a BOM. If a BOM is present and it is for UTF-8, UTF-16, or UTF-32, std.file.readText verifies that it matches the requested string type and the endianness of the machine, and if there is a mismatch, a std.utf.UTFException is thrown without bothering to validate the string.
If there is no BOM, or if the BOM is not for UTF-8, UTF-16, or UTF-32, then the behavior is what it's always been, and UTF validation continues as per normal, so if the text isn't valid for the requested string type, a std.utf.UTFException will be thrown.
In addition, before the buffer is cast to the requested string type, the alignment is checked (e.g. 5 bytes don't fit cleanly in an array of wchar or dchar), and a std.utf.UTFException is now throw if the number of bytes does not align with the requested string type. Previously, the alignment was not checked before casting, so if there was an alignment mismatch, the cast would throw an Error, killing the program.
- fold is added to std.parallelism.TaskPool
std.parallelism.TaskPool.fold is functionally equivalent to TaskPool.reduce except the range parameter comes first and there is no need to use tuple for multiple seeds.
static int adder(int a, int b) { return a + b; } static int multiplier(int a, int b) { return a * b; } // Just the range auto x = taskPool.fold!adder([1, 2, 3, 4]); assert(x == 10); // The range and the seeds (0 and 1 below; also note multiple // functions in this example) auto y = taskPool.fold!(adder, multiplier)([1, 2, 3, 4], 0, 1); assert(y[0] == 10); assert(y[1] == 24); // The range, the seed (0), and the work unit size (20) auto z = taskPool.fold!adder([1, 2, 3, 4], 0, 20); assert(z == 10);
- nullSink was added to std.range
std.range.nullSink is a convenience wrapper for std.range.NullSink and creates an output range that discards the data it receives. It's the range analog of /dev/null.
import std.csv : csvNextToken; string line = "a,b,c"; // ignore the first column line.csvNextToken(nullSink, ',', '"'); line.popFront; // look at the second column Appender!string app; line.csvNextToken(app, ',', '"'); assert(app.data == "b");
- std.range.slide (a fixed-size sliding window range) was added
std.range.slide allows to iterate a range in sliding windows:
import std.array : array; import std.algorithm.comparison : equal; assert([0, 1, 2, 3].slide(2).equal!equal( [[0, 1], [1, 2], [2, 3]] )); assert(5.iota.slide(3).equal!equal( [[0, 1, 2], [1, 2, 3], [2, 3, 4]] )); assert(iota(7).slide(2, 2).equal!equal([[0, 1], [2, 3], [4, 5]])); assert(iota(12).slide(2, 4).equal!equal([[0, 1], [4, 5], [8, 9]])); // set a custom stepsize (default 1) assert(6.iota.slide(1, 2).equal!equal( [[0], [2], [4]] )); assert(6.iota.slide(2, 4).equal!equal( [[0, 1], [4, 5]] )); // allow slide with less elements than the window size assert(3.iota.slide!(No.withPartial)(4).empty); assert(3.iota.slide!(Yes.withPartial)(4).equal!equal( [[0, 1, 2]] ));
- std.string.strip now accepts a string of characters to be stripped
New overload functions of std.string.strip, std.string.stripLeft and std.string.stripRight accepts a string of characters to be stripped instead of stripping only whitespace.
import std.string: stripLeft, stripRight, strip; assert(stripLeft("www.dlang.org", "w.") == "dlang.org"); assert(stripRight("dlang.org/", "/") == "dlang.org"); assert(strip("www.dlang.org/", "w./") == "dlang.org");
- isSomeString and isNarrowString are now false for enums
Previously, enums whose base type was a string type were true for std.traits.isSomeString and std.traits.isNarrowString. Occasionally, this was useful, but in general, it was a source of bugs, because code that works with strings does not necessarily work with enums whose base type is a string, making it easy to write code where an enum would pass the template constraint and then the template would fail to compile. For instance, enums of base type string are false for std.range.primitives.isInputRange. As such, it really doesn't make sense for std.traits.isSomeString and std.traits.isNarrowString to be true for enums.
For some code, this will be a breaking change, but most code will either be unaffected, or it will then fail with enums at the template constraint instead of inside the function. So, the risk of code breakage is minimal but does exist. Other code will now be able to remove stuff like !is(T == enum) from its template constraints, since that is now part of std.traits.isSomeString and std.traits.isNarrowString, but it will continue to compile with the now unnecessary check for enums.
Code that uses std.traits.isSomeString or std.traits.isNarrowString in a template constraint and has no other conditions which would prevent enums from passing the constraint but then would fail to compile inside the template if an enum were passed to it will now fail to compile at the template constraint instead of inside the template. So, such code is fixed rather than broken.
The rare code that does break because of these changes is code that uses std.traits.isSomeString or std.traits.isNarrowString in a template constraint or static if and does not use other conditions to prevent enums from passing and actually has code in the template which compiles with both strings and enums with a base type of string. Such code will need to be changed to use std.traits.OriginalType, std.conv.asOriginalType, or std.traits.StringTypeOf instead. e.g. for enums to pass the constraint, instead of
auto foo(S)(S str) if (isSomeString!S) { ... }
the code would be
auto foo(S)(S str) if (isSomeString!(OriginalType!S)) { ... }
As a rule of thumb, generic code should either disallow implicit conversions and force the caller to do the conversion explicitly (which generally is the least error-prone approach), or it should force the conversion to the desired type before the parameter is used in the function so that the function is definitely operating on the desired type and not just on one that implicitly converts to it and thus will work regardless of whether the argument was the exact type or implicitly converted to it.
However, great care should be taken if the implicit conversion will result in slicing the parameter or otherwise referring to its address, since that makes it very easy for a reference to local memory to escape the function, whereas if the conversion is done at the call site, then the slicing is done at the call site, so the dynamic array is still valid when the function returns. Fortunately, enums with a base type of string do not have that problem, but other types which implicitly convert to dynamic arrays (such as static arrays) do have that problem, which is a big reason why it's generally recommended to not have generic functions accept types based on implicit conversions.
It is recommended that if a function is supposed to accept both strings and types which implicitly convert to a string type, then it should explicitly accept dynamic arrays but be templated on the element type. e.g.
auto foo(C)(C[] str) if (isSomeChar!C) { ... }
That way, any implicit conversions are done at the call site and do not introduce @safety problems inside the function. It also tends to result in template constraints which are shorter and more easily understood.
- toString Can Now Use Output Ranges
The standard library has been modified to recognize and use toString overloads that accept output ranges when such overloads exist.
import std.range.primitives; import std.stdio; struct MyType { void toString(W)(ref W writer) if (isOutputRange!(W, char)) { put(writer, "Custom toString"); } } auto t = MyType(); writeln(t); // writes "Custom toString"
This has several benefits for the user. First, this design is much friendlier to inlining than the toString(scope void delegate(const(char)[]) sink) method of toString. Second, this cuts down on memory usage, as characters are placed right into the output buffers of functions like std.format.format. Third, because toString is now a template, can be marked @safe via inference much more often.
All previous forms of toString will continue to work.
List of all bug fixes and enhancements in D 2.079.0:
DMD Compiler regressions
- Bugzilla 17605: [REG2.066.0] __traits(compiles, closure) adds link-time reference to _d_allocmemory
- Bugzilla 17970: shared struct destructor doesn't compile anymore
- Bugzilla 18030: Segmentation fault with __traits(getProtection) on template function.
- Bugzilla 18093: [Reg 2.071] MSCOFF: dmd crashes when overriding a C++ method in a mixin template
- Bugzilla 18097: [REG2.077] Unittest function is undefined identifier
- Bugzilla 18296: [Reg2.078.1] invalid code with coverage and copy construction
- Bugzilla 18322: void fun(string file=__FILE_FULL_PATH__)() returns relative path (pointing to nowhere)
- Bugzilla 18430: isSame is wrong for non global lambdas
- Bugzilla 18469: [REG 2.079-b1] Segfault when trying to get type of __dtor.opCall
- Bugzilla 18480: [Reg 2.079] dmd hangs with self-alias declaration
DMD Compiler bugs
- Bugzilla 8207: OS X: Should extern(D) symbols include another underscore?
- Bugzilla 8687: Variadic templates do not work properly with default arguments
- Bugzilla 9433: Deprecate delete
- Bugzilla 12511: static overloaded function is not accessible
- Bugzilla 12901: Assignments to outside members in in/out contracts shouldn't be allowed
- Bugzilla 14147: Compiler crash on identical functions in a single module
- Bugzilla 14907: DMD crash when using template name as a default value of template's typed argument
- Bugzilla 15777: Premature expansion of overload set in tuples
- Bugzilla 16042: Identifier on template arguments should consider eponymous member lookup
- Bugzilla 17437: Incorrect range check when implicitly converting integer literals to float/double
- Bugzilla 17570: Misleading error message illegal conditional function definition
- Bugzilla 17625: Confusing error message for private functions in different modules
- Bugzilla 17630: selective imports find symbols in private imports of other modules
- Bugzilla 17663: header generation (-H) is broken with public override of private default
- Bugzilla 18014: DMD test suite fails to link on Linux distros where PIC/PIE is enforced
- Bugzilla 18057: [ICE] Segmentation fault (stack overflow) in Expression::ctfeInterpret()
- Bugzilla 18083: -w doesn't work for the ddoc build
- Bugzilla 18143: in/out contracts should be implicitly 'this' const
- Bugzilla 18190: [asan] heap-buffer-overflow in Module.load.checkModFileAlias
- Bugzilla 18212: Usage of cfloat,cdouble,cfloat,ifloat,idouble,ireal shouldn't trigger an error in deprecated code
- Bugzilla 18218: __traits(isDeprecated, creal) should return true
- Bugzilla 18219: Private import inside struct leaks symbols when used as VarDeclaration types
- Bugzilla 18225: Wrong condition in VRP
- Bugzilla 18232: Union methods fail to initialize local variables to .init
- Bugzilla 18243: selective import + overload = private visibility
- Bugzilla 18261: Linkage information isn't part of the json output
- Bugzilla 18312: string concatenation with -betterC fails with linker errors
- Bugzilla 18335: The D_ObjectiveC version identifier is not printed in verbose mode
- Bugzilla 18364: header file generation doesn't print the package name in package(XXX)
- Bugzilla 18367: dmd should not segfault on -X with libraries, but no source files
- Bugzilla 18429: alias this enum causes segmentation fault
- Bugzilla 18468: cannot use synchronized {} in @safe code
DMD Compiler enhancements
- Bugzilla 6549: Implement contracts without implementation.
- Bugzilla 11529: Unclear error message when rvalue is passed as `ref'
- Bugzilla 11714: Improve error message for wrongly initialized thread-local class instances
- Bugzilla 13855: Allow multiple selective imports from different modules in a single import statement
- Bugzilla 16492: support @nogc in debug{} blocks
- Bugzilla 17899: Cannot initialise contextless delegate at compile time
- Bugzilla 18053: Use stdint.h mangling for int64_t/uint64_t when mangling D long/ulong
- Bugzilla 18149: Add a compiler trait to detect if a function is @disable
- Bugzilla 18273: Better C: wrong exit code from main()
- Bugzilla 18361: Ddoc: support ability to opt out of automatic keyword highlighting in text
- Bugzilla 18427: Symbol FOO is not visible because it is privately imported => compiler should show how to import it
Phobos regressions
- Bugzilla 18114: [Reg 2.078] regex performance regression
- Bugzilla 18316: std.net.curl.SMTP.mailTo fails to compile
Phobos bugs
- Bugzilla 7054: format() aligns using code units instead of graphemes
- Bugzilla 10879: std.variant Variant/Algebraic: Can't store static arrays > 32(/16) bytes
- Bugzilla 15157: std.experimental.allocator.building_blocks docs
- Bugzilla 15391: Problems loading libcurl.so and running datetime unittest on NixOS package build
- Bugzilla 17832: std.random.choice cannot be used with other random generators
- Bugzilla 18092: Can't combine take and takeExactly
- Bugzilla 18124: std.regex.RegexMatch's front property is under-documented
- Bugzilla 18153: deprecate public symbols ByLine, ByRecord, ByChunk
- Bugzilla 18224: BigInt modulo uint must return long.
- Bugzilla 18229: Misleading documentation of std.process.environment.get
- Bugzilla 18259: allocatorObject's CAllocatorImpl should store the passed allocator within
- Bugzilla 18278: writef documentation 404 error
- Bugzilla 18285: std.algorithm.comparison.cmp for strings with custom predicate compares lengths wrong
- Bugzilla 18286: std.algorithm.comparison.cmp for string with custom predicate fails if distinct chars can compare equal
- Bugzilla 18288: std.algorithm.comparison.cmp for wide strings should be @safe
- Bugzilla 18299: std.datetime.date.cmpTimeUnits does not throw a DateTimeException
- Bugzilla 18328: algorithm.startsWith can compare narrow string lengths in more circumstances
- Bugzilla 18349: std/math.d(543,33): Deprecation: integral promotion not done for -x
- Bugzilla 18384: std.net.isemail is slow to import due to regex
- Bugzilla 18397: Poor implementation of std.conv.hexString results in unintended bloat
- Bugzilla 18434: BigInt gcd asserts when one argument is zero.
- Bugzilla 18492: DLang STL links are broken
Phobos enhancements
- Bugzilla 5489: std.typecons tuples dynamically iterable
- Bugzilla 10828: datetime toString functions should accept sink
- Bugzilla 11084: std.algorithm.scan
- Bugzilla 11555: std.algorithm.reverse should return the just-reversed range
- Bugzilla 11747: Better error message with @disabled toString
- Bugzilla 13632: Second argument for std.string.strip
- Bugzilla 14767: Support CTFE of BigInt under x86
- Bugzilla 15949: Improve readtext handling of byte order mark (BOM)
- Bugzilla 17249: Make BigInt data visible (not modifiable!)
- Bugzilla 17440: Nullable.nullify() resets referenced object
- Bugzilla 18086: BigInt DivMod
- Bugzilla 18096: Add fold() to std.parallelism
- Bugzilla 18116: to!wchar([string, dstring]), and to!char([wstring, dstring]) don't compile
- Bugzilla 18152: std.format.formattedRead should work with rvalues.
- Bugzilla 18186: std.array.replaceSlice should be usable in @safe
- Bugzilla 18214: TemplateOf should return void for non-templated symbols
- Bugzilla 18217: Don't repeatedly call unpredictableSeed to initialize rndGen
- Bugzilla 18230: multiwayUnion sets wrong pred lambdas
- Bugzilla 18239: std.experimental.allocator fillWithMemcpy could use memset when T.sizeof==1
- Bugzilla 18280: std.algorithm.comparison.cmp for non-strings should call opCmp only once per item pair
- Bugzilla 18329: std.algorithm.startsWith & endsWith can sometimes statically determine decoding unnecessary
Druntime regressions
- Bugzilla 15482: new uuid.d forbids to link statically with other libraries
Druntime bugs
- Bugzilla 18240: core.stdc.wchar_ wmemset, etc. should be pure
- Bugzilla 18247: core.stdc.math functions that never set errno should be pure
- Bugzilla 18279: rt.util.utf does not properly reserve buffer in toUTF16/toUTF16z
- Bugzilla 18300: core.demangle demangling of really long symbol fails
- Bugzilla 18409: DScanner SEGFAULTS on CircleCI
- Bugzilla 18531: core.exception.RangeError@src/core/demangle.d(216): Range violation
dlang.org bugs
- Bugzilla 13844: core.stdc.config isn't listed in the docs
- Bugzilla 14475: man page is outdated
- Bugzilla 16490: Usage of attributes in inline asm blocks is not documented
- Bugzilla 18306: No compliation errors shown when running modified examples
- Bugzilla 18319: std.exception: enforce example does not compile
- Bugzilla 18341: Documentation for std.array.split is confusing/incorrect
- Bugzilla 18355: [Areas of D usage]
dlang.org enhancements
- Bugzilla 17998: Document Options for install.sh
- Bugzilla 18202: Show TOC overview in the dlang specification pages
- Bugzilla 18337: https://dlang.org/spec/operatoroverloading.html missing opIn/opIn_r
- Bugzilla 18379: [404 Not Found] Foundation Donate page not found
- Bugzilla 18383: Front page blog section is only partially filled.
Tools bugs
- Bugzilla 18208: demangle RangeError@src/core/demangle.d(230)
Installer bugs
- Bugzilla 15131: curl.lib is not available in 32 bit mscoff format
- Bugzilla 18510: [Beta 2.079] lld-link.exe fails to open obj file in subpath
Contributors to this release (78)
A huge thanks goes to all the awesome people who made this release possible.
- acehreli
- aG0aep6G
- aldacron
- Alexandru Jercaianu
- Ali Akhtarzada
- Ali Çehreli
- Andrei Alexandrescu
- Andrey Penechko
- Andy Smith
- Aravinda VK
- Arun Chandrasekaran
- Atila Neves
- Basile Burg
- Bastiaan Veelo
- BBasile
- Brad Roberts
- carblue
- Daniel Kozak
- Diederik de Groot
- dmdw64
- Dragos Carp
- Duncan Paterson
- Eduard Staniloiu
- Elias Batek
- H. S. Teoh
- Héctor Barreras Almarcha [Dechcaudron]
- Iain Buclaw
- Jack Stouffer
- Jacob Carlborg
- jacob-carlborg
- jercaianu
- jmh530
- Joakim Noah
- Johan Engelen
- Johannes Pfau
- Jonathan M Davis
- Jonathan Marler
- Joseph Rushton Wakeling
- Kai Nacke
- kinke
- Lance Bachmeier
- Lucia Mcojocaru
- Luís Marques
- Manuel Maier
- Markus F.X.J. Oberhumer
- Martin Nowak
- Mathias Baumann
- Mathis Beer
- MetaLang
- Michael Parker
- Mike Franklin
- Mike Parker
- Nathan Sashihara
- Nicholas Lindsay Wilson
- Nicholas Wilson
- Nick Treleaven
- Oleg Nykytenko
- Patrick Schlüter
- Paul Backus
- Petar Kirov
- Pradeep Gowda
- Radu Racariu
- Rainer Schuetze
- Razvan Nitu
- Sebastian Wilzbach
- shoo
- Simen Kjærås
- skl131313
- Stanislav Blinov
- Stefan Koch
- Steven Schveighoffer
- Thomas Mader
- Timothee Cour
- Tomáš Chaloupka
- Vladimir Panteleev
- Walter Bright
- Yannick Koechlin
- Yuxuan Shui


@include("/SysAuthOrganization/tree.html"){}
@include("/SysAuthOrganization/listContent.html"){}
@layout("/layouts/bk-base.html") {
部门管理
浏览


About Me
Proficient in React, Javascript, HTML, CSS, Mysql, Express,
MongoDB
Front-End Web Developer with a background in business development
powering my problem-solving skills. Recently earned a certificate in
Full Stack Development from the University of Oregon, with
proficiency in JavaScript, HTML5, CSS, and React. Known for being
easy to work with, and for my driving work ethic and innovative
problem-solving abilities. With each project, my aim is to best
engage my audience for an impactful user-experience.
I recently led a team of nine managers to increase production and
customer satisfaction which resulted in a bottom line increase of
1500% over 5 years.


PhD
Engineer, Arup, Advanced Technology and Research (AT+R)
Doctoral Dissertation Research: Performance-based engineering framework for vertical structures subjected to nonstationary wind loads from thunderstorm downbursts and tornadoes
Link to dissertation
Master's Thesis Research: Multi-physical quantification of damage due to swelling from alkali-silica reaction (ASR) gels in mortar bars
Link to thesis
Advisor: Professor, Tzuyang Yu, Ph.D.
Undergraduate Research: Vibration-based structural health monitoring of a multistory building using a cellular mobile device
Advisor: Professor, Tzuyang Yu, Ph.D.
I am very enthusiastic about basketball and the NBA. I have even developed a web-based application that allows users to quickly plot the stats of NBA players. Called BBALL STAT View (http://bballstatview.xyz/), the idea came from a desire to learn Python, reinforce my love for research, and immerse myself in basketball data. If you have any suggestions to the app, please do not hesitate to inform me. Also, if you like to play or watch basketball, please let me know!
I enjoy digesting the latest tech news including computer and mobile hardware.


Apache Beam Execution Model
The Beam model allows runners to execute your pipeline in different ways. You may observe various effects as a result of the runner’s choices. This page describes these effects so you can better understand how Beam pipelines execute.
Processing of elements
The serialization and communication of elements between machines is one of the most expensive operations in a distributed execution of your pipeline. Avoiding this serialization may require re-processing elements after failures or may limit the distribution of output to other machines.
Serialization and communication
The runner might serialize elements between machines for communication purposes and for other reasons such as persistence.
A runner may decide to transfer elements between transforms in a variety of ways, such as:
- Routing elements to a worker for processing as part of a grouping operation. This may involve serializing elements and grouping or sorting them by their key.
- Redistributing elements between workers to adjust parallelism. This may involve serializing elements and communicating them to other workers.
- Using the elements in a side input to a
ParDo
. This may require serializing the elements and broadcasting them to all the workers executing theParDo
. - Passing elements between transforms that are running on the same worker. This may allow the runner to avoid serializing elements; instead, the runner can just pass the elements in memory.
Some situations where the runner may serialize and persist elements are:
- When used as part of a stateful
DoFn
, the runner may persist values to some state mechanism. - When committing the results of processing, the runner may persist the outputs as a checkpoint.
Bundling and persistence
Beam pipelines often focus on “embarassingly parallel” problems. Because of this, the APIs emphasize processing elements in parallel, which makes it difficult to express actions like “assign a sequence number to each element in a PCollection”. This is intentional as such algorithms are much more likely to suffer from scalability problems.
Processing all elements in parallel also has some drawbacks. Specifically, it makes it impossible to batch any operations, such as writing elements to a sink or checkpointing progress during processing.
Instead of processing all elements simultaneously, the elements in a
PCollection
are processed in bundles. The division of the collection into
bundles is arbitrary and selected by the runner. This allows the runner to
choose an appropriate middle-ground between persisting results after every
element, and having to retry everything if there is a failure. For example, a
streaming runner may prefer to process and commit small bundles, and a batch
runner may prefer to process larger bundles.
Failures and parallelism within and between transforms
In this section, we discuss how elements in the input collection are processed in parallel, and how transforms are retried when failures occur.
Data-parallelism within one transform
When executing a single ParDo
, a runner might divide an example input
collection of nine elements into two bundles as shown in figure 1.
Figure 1: A runner divides an input collection into two bundles.
When the ParDo
executes, workers may process the two bundles in parallel as
shown in figure 2.
Figure 2: Two workers process the two bundles in parallel.
Since elements cannot be split, the maximum parallelism for a transform depends on the number of elements in the collection. In figure 3, the input collection has nine elements, so the maximum parallelism is nine.
Figure 3: Nine workers process a nine element input collection in parallel.
Note: Splittable ParDo allows splitting the processing of a single input across multiple bundles. This feature is a work in progress.
Dependent-parallelism between transforms
ParDo
transforms that are in sequence may be dependently parallel if the
runner chooses to execute the consuming transform on the producing transform’s
output elements without altering the bundling. In figure 4, ParDo1
and
ParDo2
are dependently parallel if the output of ParDo1
for a given
element must be processed on the same worker.
Figure 4: Two transforms in sequence and their corresponding input collections.
Figure 5 shows how these dependently parallel transforms might execute. The
first worker executes ParDo1
on the elements in bundle A (which results in
bundle C), and then executes ParDo2
on the elements in bundle C. Similarly,
the second worker executes ParDo1
on the elements in bundle B (which results
in bundle D), and then executes ParDo2
on the elements in bundle D.
Figure 5: Two workers execute dependently parallel ParDo transforms.
Executing transforms this way allows a runner to avoid redistributing elements between workers, which saves on communication costs. However, the maximum parallelism now depends on the maximum parallelism of the first of the dependently parallel steps.
Failures within one transform
If processing of an element within a bundle fails, the entire bundle fails. The elements in the bundle must be retried (otherwise the entire pipeline fails), although they do not need to be retried with the same bundling.
For this example, we will use the ParDo
from figure 1 that has an input
collection with nine elements and is divided into two bundles.
In figure 6, the first worker successfully processes all five elements in bundle A. The second worker processes the four elements in bundle B: the first two elements were successfully processed, the third element’s processing failed, and there is one element still awaiting processing.
We see that the runner retries all elements in bundle B and the processing completes successfully the second time. Note that the retry does not necessarily happen on the same worker as the original processing attempt, as shown in the figure.
Figure 6: The processing of an element within bundle B fails, and another worker retries the entire bundle.
Because we encountered a failure while processing an element in the input bundle, we had to reprocess all of the elements in the input bundle. This means the runner must throw away the entire output bundle since all of the results it contains will be recomputed.
Note that if the failed transform is a ParDo
, then the DoFn
instance is torn
down and abandoned.
Coupled failure: Failures between transforms
If a failure to process an element in ParDo2
causes ParDo1
to re-execute,
these two steps are said to be co-failing.
For this example, we will use the two ParDo
s from figure 4.
In figure 7, worker two successfully executes ParDo1
on all elements in bundle
B. However, the worker fails to process an element in bundle D, so ParDo2
fails (shown as the red X). As a result, the runner must discard and recompute
the output of ParDo2
. Because the runner was executing ParDo1
and ParDo2
together, the output bundle from ParDo1
must also be thrown away, and all
elements in the input bundle must be retried. These two ParDo
s are co-failing.
Figure 7: Processing of an element within bundle D fails, so all elements in the input bundle are retried.
Note that the retry does not necessarily have the same processing time as the original attempt, as shown in the diagram.
All DoFns
that experience coupled failures are terminated and must be torn
down since they aren’t following the normal DoFn
lifecycle .
Executing transforms this way allows a runner to avoid persisting elements between transforms, saving on persistence costs.


|
| static | getManyToOne ($instance, $member, $included=false, $useCache=NULL) |
| | Loads member associated with $instance by a ManyToOne relationship. More...
|
| |
| static | getOneToMany ($instance, $member, $included=true, $useCache=NULL, $annot=null) |
| | Assign / load the child records in the $member member of $instance. More...
|
| |
| static | getManyToMany ($instance, $member, $included=false, $array=null, $useCache=NULL) |
| | Assigns / loads the child records in the $member member of $instance. More...
|
| |
| static | affectsManyToManys ($instance, $array=NULL, $useCache=NULL) |
| |
| static | getAll ($className, $condition='', $included=true, $parameters=null, $useCache=NULL) |
| | Returns an array of $className objects from the database. More...
|
| |
| static | paginate ($className, $page=1, $rowsPerPage=20, $condition=null, $included=true) |
| |
| static | getRownum ($className, $ids) |
| |
| static | count ($className, $condition='', $parameters=null) |
| | Returns the number of objects of $className from the database respecting the condition possibly passed as parameter. More...
|
| |
| static | getOne ($className, $condition, $included=true, $parameters=null, $useCache=NULL) |
| | Returns an instance of $className from the database, from $keyvalues values of the primary key or with a condition. More...
|
| |
| static | getById ($className, $keyValues, $included=true, $useCache=NULL) |
| | Returns an instance of $className from the database, from $keyvalues values of the primary key. More...
|
| |
| static | connect ($offset, $dbType, $dbName, $serverName='<IP_ADDRESS>', $port='3306', $user='root', $password='', $options=[], $cache=false) |
| | Establishes the connection to the database using the past parameters. More...
|
| |
| static | startDatabase (&$config, $offset=null) |
| | Establishes the connection to the database using the $config array. More...
|
| |
| static | getDbOffset (&$config, $offset=null) |
| |
| static | isConnected ($offset='default') |
| | Returns true if the connection to the database is established. More...
|
| |
| static | setTransformerOp ($op) |
| | Sets the transformer operation. More...
|
| |
| static | closeDb ($offset='default') |
| | Closes the active pdo connection to the database. More...
|
| |
| static | setModelDatabase ($model, $database='default') |
| | Defines the database connection to use for $model class. More...
|
| |
| static | setModelsDatabases ($modelsDatabase) |
| | Defines the database connections to use for models classes. More...
|
| |
| static | getDatabase ($offset='default') |
| | Returns the database instance defined at $offset key in config. More...
|
| |
| static | getDatabases () |
| |
| static | start () |
| |
| static | remove ($instance) |
| | Deletes the object $instance from the database. More...
|
| |
| static | deleteAll ($modelName, $where) |
| | Deletes all instances from $modelName matching the condition $where. More...
|
| |
| static | delete ($modelName, $ids) |
| | Deletes all instances from $modelName corresponding to $ids. More...
|
| |
| static | insert ($instance, $insertMany=false) |
| | Inserts a new instance $instance into the database. More...
|
| |
| static | insertOrUpdateAllManyToMany ($instance) |
| | Met à jour les membres de $instance annotés par un ManyToMany. More...
|
| |
| static | insertOrUpdateManyToMany ($instance, $member) |
| | Updates the $member member of $instance annotated by a ManyToMany. More...
|
| |
| static | update ($instance, $updateMany=false) |
| | Updates an existing $instance in the database. More...
|
| |
| static | save ($instance, $updateMany=false) |
| |
| static | uGetAll ($className, $ucondition='', $included=true, $parameters=null, $useCache=NULL) |
| | Returns an array of $className objects from the database. More...
|
| |
| static | uCount ($className, $ucondition='', $parameters=null) |
| | Returns the number of objects of $className from the database respecting the condition possibly passed as parameter. More...
|
| |
| static | uGetOne ($className, $ucondition, $included=true, $parameters=null, $useCache=NULL) |
| | Returns an instance of $className from the database, from $keyvalues values of the primary key. More...
|
| |
| static | beginTransaction ($offset='default') |
| | Initiates a transaction. More...
|
| |
| static | commit ($offset='default') |
| | Commits a transaction. More...
|
| |
| static | commitToLevel ($transactionLevel, $offset='default') |
| | Commits nested transactions up to level $transactionLevel. More...
|
| |
| static | commitAll ($offset='default') |
| | Commits all nested transactions (up to level 0) More...
|
| |
| static | rollBack ($offset='default') |
| | Rolls back a transaction. More...
|
| |
| static | rollBackToLevel ($transactionLevel, $offset='default') |
| | Rolls back nested transactions up to level $transactionLevel. More...
|
| |
| static | rollBackAll ($offset='default') |
| | Rolls back all nested transactions (up to level 0) More...
|
| |
| static | callInTransaction ($callback, $offset,... $parameters) |
| | Call a callback with an array of parameters in a transaction. More...
|
| |
|
| static | getDb ($model) |
| |
| static | getConditionParser ($className, $keyValues) |
| |
| static | _affectsRelationObjects ($className, $classPropKey, $manyToOneQueries, $oneToManyQueries, $manyToManyParsers, $objects, $included, $useCache) |
| |
| static | prepareManyToMany (&$ret, $instance, $member, $annot=null) |
| |
| static | prepareManyToOne (&$ret, $instance, $value, $fkField, $annotationArray) |
| |
| static | prepareOneToMany (&$ret, $instance, $member, $annot=null) |
| |
| static | _initRelationFields ($included, $metaDatas, &$invertedJoinColumns, &$oneToManyFields, &$manyToManyFields) |
| |
| static | getIncludedForStep ($included) |
| |
| static | getDb ($model) |
| |
| static | getClass_ ($instance) |
| |
| static | getInstance_ ($instance) |
| |
| static | getValue_ ($instance, $member) |
| |
| static | getFirstKeyValue_ ($instance) |
| |
| static | _getOne ($className, ConditionParser $conditionParser, $included, $useCache) |
| |
| static | _getAll ($className, ConditionParser $conditionParser, $included=true, $useCache=NULL) |
| |
| static | getFieldList ($tableName, $metaDatas) |
| |
| static | _getAll ($className, ConditionParser $conditionParser, $included=true, $useCache=NULL) |
| |
| static | getIncludedForStep ($included) |
| |
| static | _initRelationFields ($included, $metaDatas, &$invertedJoinColumns, &$oneToManyFields, &$manyToManyFields) |
| |
| static | prepareManyToMany (&$ret, $instance, $member, $annot=null) |
| | Prepares members associated with $instance with a ManyToMany type relationship. More...
|
| |
| static | prepareOneToMany (&$ret, $instance, $member, $annot=null) |
| | Prepares members associated with $instance with a oneToMany type relationship. More...
|
| |
| static | prepareManyToOne (&$ret, $instance, $value, $fkField, $annotationArray) |
| | Prepares members associated with $instance with a manyToOne type relationship. More...
|
| |
| static | setToMember ($member, $instance, $value, $accessor) |
| |
| static | getAccessor ($member, $instance, $part) |
| |
| static | _affectsRelationObjects ($className, $classPropKey, $manyToOneQueries, $oneToManyQueries, $manyToManyParsers, $objects, $included, $useCache) |
| |
| static | _getAll ($className, ConditionParser $conditionParser, $included=true, $useCache=NULL) |
| |
| static | _getOne ($className, ConditionParser $conditionParser, $included, $useCache) |
| |
| static | uParse ($className, &$ucondition) |
| |
| static | uParseExpression ($className, $expression, &$expressionArray, &$condition, &$ucondition, &$aliases) |
| |
| static | getAnnotFieldsInRelations ($className) |
| |
| static | uGetExpressions ($condition) |
| |
Gateway class between database and object model.
This class is part of Ubiquity
- Author
- jcheron myadd.nosp@m.ress.nosp@m.mail@.nosp<EMAIL_ADDRESS>- Version
- 1.2.1
Definition at line 30 of file DAO.php.


1 March 2006
Between 28 March 2005 and 19 February 2006, 2406 cases of chikungunya have been notified by the 31 physicians from a sentinel network in La Réunion, including 333 cases reported during the week 13 to 19 February. Estimations from a mathematical model evaluate that 157 000 people may have been infected by chikungunya virus since March 2005 in La Réunion, including 22 000 persons during the week 13 to 19 February.
Since beginning of January, other countries in the south west Indian Ocean have reported chikungunya cases : Mayotte (924 cases) Mauritius (2553 cases including 1173 lab confirmed cases) and the Seychelles (4650 cases).
A WHO team from the Regional Office for Africa and headquarters has been deployed in the zone to assess the control measures under way in the different islands. The main preventive measure is to stop the proliferation of mosquitoes by reducing their breeding grounds. These include anti-vectoral activities and the destruction of domestic breeding sites, coupled with an extensive public health education campaign using mass media and community associations to sensitize the population about protective measures. Epidemiological surveillance and vectoral surveillance is also being reinforced.
The team has began discussions on a sub-regional strategy for surveillance and control of chikungunya and other arboviruses with national authorities.
For more information on vector control and the use of pesticides, please see the web site of WHOPES .
For more information about the disease and the outbreak in La Réunion, please see the web site of the Observatoire Régional de la Santé de La Réunion .


The Team
Shane Kelly, Carl Moser, Nathan Yee
Big Idea
We created a synthesizer that can play sinusoidal waves through a speaker of a user-specified frequency. A specially formatted file type can then be passed to the Arduino to command it to play certain notes in sequence, which create songs!
Background
The foundation of this project is creating a wave and outputting it with an Arduino's PWM pin. The most basic waveform is a square wave oscillating between values of 0 and 255. The Arduino’s Timer 2 (TCNT2) counts from 0 to 255 before overflowing and restarting its count at 0. The timer knows when to overflow by comparing its value to the value stored in the “Output Compare Register” (OCR1A). We can change the value at which TCNT2 overflows (and thus, the wave's frequency) by adjusting the register value stored in OCR1A.
When the calculated wave is played to a speaker, the wave will sound choppy because an Arduino can only simulate analog output values by slamming its PWM pin from 0 to 255 at different duty cycles. A DAC must be used to convert these digital waves to smooth analog waves - in our case we used a 1-bit DAC that low-passed the wave to smooth it out.
After a wave of a specified frequency can be played on the Arduino, then serial commands simply need to be sent to the Arduino to specify what frequencies should be played. Under the everything-is-a-file architecture, this can be accomplished by opening a serial port and writing the contents of a song file to the port.
Implementation
To implement the software for our 1-bit DAC we start by creating a wave table and populating it with sin wave amplitudes. These amplitudes represent the duty cycle of the PWM output.
int wave[LENGTH]; // Storage for waveform
for (int i=0; i<LENGTH; i++) { // Step across wave table
float v = (AMP*sin((PI2/LENGTH)*i)); // Compute value
wave[i] = (int) (v+OFFSET); // Store value as integer
Then we create an interrupt service routine to update the position in the wave table and the PWM's duty cycle:
ISR(TIMER2_COMPA_vect) { // Called when TCNT2 == OCR2A
static uint8_t index=0; // Points to each table entry
OCR1AL = wave[index++]; // Update the PWM output
__asm("NOP;NOP"); // Fine tuning
TCNT2 = 5; // Timing to compensate for ISR run time
}
We control the output frequency of our 1-bit DAC by setting the update time of our PWM signal, we modify the value of the Arduino register OCR2A according to the formula:
OCR2A = round((2000000.0 / LENGTH * (1.0 / freq))
Where 2000000.0 is the frequency of our timer in Mhz, LENGTH is the length of our wave table, and freq is the desired frequency. Note the use of round() as OCR2A must be an integer. Consequently, we are limited in frequency precision and some notes are out of tune.
It is also important to note that the highest frequency of synthesizer is limited as the difference between OCR2A and the interrupt timing offset (5) must greater than or equal to 1. In this case, the highest frequency we can play is:
Max Frequency = 2000000.0 / (LENGTH * OCR2A) = 2000000.0 / (256 * 6) = 1307 Hz
Where OCR2A - TCNT2 = 6 - 5 = 1
Once the Arduino generated an output wave from its PWM port, we ran the digital signal through a 1-bit DAC. Our DAC essentially acts as a low-pass filter, which smooths the jagged PWM signal in order to create a batter waveform to be played through a speaker.
To play a specified song on our Arduino synthesizer, we created a file type that stores a sequence of tone frequencies and tone durations. We then passed this information to the Arduino through serial. We took advantage of the small-C-tools architecture to translate information from a file/standard input to a specified serial port. The tool that we wrote to take care of this is stdinToSerial.c, which can have any file passed through it and have that file's contents be pushed to any serial port.
The last design decision that we made was to use Arduino's implementation of serial to be able to update the frequency. We attempted to implement a c version of serial communication using the serial registers directly. This caused an issue with all serial communication (even after uploading other code) with the arduino. We are not sure what exactly happened but we believe that a fuse bit within the arduino might have been changed during testing. Since we are not sure what caused the issue and did not want to risk breaking more arduinos, we decided to switch to Arduino's implementation because we knew that it would work.
Results
We have created an Arduino synthesizer that can be commanded to play a series of tones from an input file that specifies the frequency and duration of each sequential tone. The tones are played through a simple 1-bit DAC, which low-pass filters the output of the Arduino's PWM signals to create smooth waveforms.
The unfiltered signal outputted by the Arduino
The filtered signal outputted by the DAC (looks a bit weird because of the scale here)
Resources
Skill Builder: Advanced Arduino Sound Synthesis, Jon Thompson
Serial communications on an Arduino in C
Arduino port registers.
Usage
Playing song files using Arduino IDE
Upload code/arduino/arduino.ino
to the Arduino Uno using the Arduino IDE.
Once the Arduino code has been uploaded, send the desired song file to the serial port that the Arduino is currently connected to. The -f
option will set the song filename and the -p
option will set the serial port.
cd ../stdinToSerial
make
./stdinToSerial -f twinkleTwinkle.csv -p /dev/ttyACM0
Playing single tones with C using AVR-DUDE
Compile the Arduino code and upload it to the Uno.
cd code/arduino
bash compile.sh listing1


Ian Williams wins $100K Giller prize for 'Reproduction'
by Adina Bresge, The Canadian PressTORONTO -- Ian Williams has won the $100,000 Scotiabank Giller Prize for his debut novel "Reproduction."
Williams received the honour at a glittering Toronto gala Monday night.
"Reproduction" traces the ties that bind a cross-cultural chosen family in Williams' hometown of Brampton, Ont.
The tale begins when a sober-minded teenager from a small island nation and the listless heir to a German family fortune meet in the hospital room where their mothers lay dying.
From there, Williams unspools a narrative so entangled it strains against novelistic convention.
Jury members praised the Vancouver-based writer for his "masterful unfolding of unexpected connections and collisions between and across lives otherwise separated by race, class, gender and geography."
"Reproduction," published by Random House Canada, was a finalist for this year's Amazon First Novel Award.
Williams' short-fiction collection, "Not Anyone's Anything" won the Danuta Gleed Literary Award in 2012, and he's been a rising star in poetry circles. His 2013 collection, "Personals," was shortlisted for the Griffin Poetry Prize and the Robert Kroetsch Poetry Book Award.
Williams was the 2014-2015 writer-in-residence in the University of Calgary's distinguished writers programme, and has held numerous other fellowships and residencies.
He is currently a Griffin Poetry Prize trustee and associate professor of poetry in University of British Columbia's creative writing program.
Williams beat out titles by David Bezmozgis, Michael Crummey, Megan Gail Coles, Alix Ohlin and Steven Price.
Before the Giller winner was announced, a who's who of Canada's cultural scene walked the Giller red carpet at the Four Seasons Hotel Toronto.
Singer-songwriter and actress Jann Arden hosted the night's festivities, which were broadcast on CBC.
The six finalists were chosen from 117 submissions by a jury consisting of Canadian writers Donna Bailey Nurse, Randy Boyagoda and Jose Teodoro, Scottish-Sierra Leonean author Aminatta Forna and Bosnian-American author Aleksandar (Sasha) Hemon.
The Giller awards $100,000 annually to the author of the best Canadian novel or short story collection published in English, and $10,000 to each of the finalists.
Last year's winner was Esi Edugyan for "Washington Black."
This report by The Canadian Press was originally published Nov. 18, 2019.


Coffee drinkers have healthier gut microbiotas
by https://www.facebook.com/dunyanewsIslamabad (Online): New research suggests that heavy coffee drinkers have healthier compositions of bacteria in their guts.
More and more research is unpacking the health benefits of drinking coffee. Drinking just one cup may fight off unhealthy fat, ease inflammation associated with obesity, or even protect the brain into old age.
Furthermore, drinking at least three cups of coffee every day may keep arteries healthy and supple by preventing a calcium buildup and staving off the risk of clogging.
Coffee could also help fight off diabetes by improving blood sugar control and can keep the liver healthy and "happy."
But how exactly coffee yields all of these wonderful health benefits has remained somewhat of a mystery.
New research shines some light on the mechanisms behind coffee’s effects by looking at the links between coffee and the health of the gut microbiota.
Looking into the gut microbiota
Dr. Jiao and team set out to examine "the association between caffeine consumption and the composition and structure of the colonic-gut microbiota."
To do so, the scientists asked 34 participants to undergo a screening colonoscopy and endoscopy to confirm the health of their colons.
The researchers obtained 97 "snap-frozen colonic mucosa biopsies" from various segments of these individuals’ colons, extracted microbial DNA, and performed 16s rRNA sequencing analysis.
The effects of coffee on the gut
The analyses revealed that high caffeine consumers had high levels of the bacterial genera Faecalibacterium and Roseburia, but low levels of Erysipelatoclostridium — a "potentially harmful" bacterial genus.
The research team found these associations regardless of the participants’ age or the quality of their diets.
Although part of a normal healthy gut, excessive levels of Erysipelatoclostridium ramosum (E. ramosum) may be harmful.


Enter your email address below, and we'll email instructions for setting a new one.


Stay Healthy...
Orange is not just a tasty fruit, its more. Get to know the multiple health benefits of adding oranges in your daily diet
Buy NowOrange is not just a tasty fruit, its more. Get to know the multiple health benefits of adding oranges in your daily diet
Buy NowLorem ipsum dolor sit amet consectetur adipisicing elit.
Lorem ipsum dolor sit amet consectetur adipisicing elit.
Lorem ipsum dolor sit amet consectetur adipisicing elit.
Lorem ipsum dolor sit amet consectetur adipisicing elit.
Welcome to the Traidung fruits shop Where I trust the most
There are many different kinds of fruit here that you need


Oklahoma police say officer got Starbucks with 'PIG' on cups
GLENPOOL, Okla. (AP) -- An Oklahoma police chief says an officer bought Starbucks for 911 dispatchers working on Thanksgiving only to find that the word "PIG" was printed on the cups' labels.
The officer notified Kiefer Police Chief Johnny O'Mara, who called the store and spoke to a manager. O'Mara says they offered to reprint the computer-generated labels, but he took to social media and posted the photo. It has since gone viral.
The officer told KTUL-TV that the employee reached out to him personally and apologized, saying it was a joke.
Starbucks spokesperson Jory Mendes says the company is deeply sorry and has apologized to the officer who received the five cups.
Mory says the barista has been suspended pending the outcome of the internal investigation.
Last year, Starbucks closed stores and had employees undergo a anti-bias training after the arrest of two black men in a Philadelphia location. The coffee chain's executives met with Arizona officers earlier this year after six officers were asked to leave a store because a customer felt unsafe.


Beware the Minotaur is a 2D endless side scroller where players are given the task of surviving as long as possible against the dreaded Minotaur. Players are relentlessly chased by this crazed beast facing many other obstacles along the way. However, they will not go unrewarded. Those who can survive will find riches along the way which they can spend to make them stronger.
The player character will run at a constant speed with the Minotaur following closely behind. Players will need to jump from platforms and avoid obstacles to the best of their abilities. Failing to do so will result in a loss of speed, allowing the Minotaur to gain on them. If a player is caught by the minotaur the game is over and they may try again. Along the way players can collect coins which can be used to upgrade themselves giving them an advantage in the next run.
Pivotal Tracker was populated with stories so there was a clear goal in mind when it came to what the completed app should looked like.
After brainstorming the Beware the Minotaur and its gameplay I designed rough wireframes and a flow chart in Figma for the games UI
All sprites were gethered from the Unity Asset Store and GDM Market.


New in version 0.5.14 ():
New in version 0.5.13 (Dec. 13, 2013):
- Fixed a forward-compatibility bug that hid menu on newer devices.
- Added a preference setting to disable focus modes that don't work well on some devices.
- Upgraded to use Tesseract v3.03.
- Updated to retrieve newest version of Tesseract data files.
- Added new translation languages.
- Added new OCR languages: Afrikaans, Albanian, Azeri, Basque, Belarusian, Bengali,
Croatian, Estonian, Galician, Hebrew, Icelandic, Kannada, Macedonian, Malay, Malayalam,
Maltese, Swahili, Tamil, and Telugu.
New in version 0.5.12 (May 23, 2012):
- Fixed Bing translations.
- Upgraded to use Tesseract v3.02.
- Improved camera handling code.
- Added "share" option for recognized/translated text. Long-press text to use.
- Made compatibility fixes for Optimus V and Galaxy Tab devices.
- Added workaround for Android Issue 25321 for Android 4.0.x devices.
- Added support for x86-based devices.
New in version 0.5.11 (Apr. 11, 2012):
- Fixed a crash-causing bug on Android 4.0 devices.
- Added support for translating to Hindi.
- Added support for translating to Catalan using Bing Translator.
New in version 0.5.10 (Dec. 22, 2011):
New in version 0.5.9 (Nov. 14, 2011):
- Improved autofocus behavior.
- Added language-specific character blacklists/whitelists.
- Enabled Tesseract v3.01 page segmentation.
- Added default whitelist for English for new installs.
New in version 0.5.8 (Nov. 5, 2011):
- Upgraded to use Tesseract v3.01.
- Added Arabic (large device RAM required).
- Added Hindi.
- Added Thai.
- Enabled Cube OCR option for English.
New in version 0.5.7 (Oct. 26, 2011):
- Improved display of bounding boxes.
New in version 0.5.6:
- Added bounding boxes to continuous preview.
New in version 0.5.5:
- Added support for front camera only devices.
- Improved display of preview text.
- Removed light button.
New in version 0.5.4:
New in version 0.5.3:
- Fixed a light button bug.
- Minor user interface improvements.
New in version 0.5.2:
- Added translation capability to continuous preview.
- Added Bing as a translation option.
- Added a light button.
New in version 0.5.1:
New in version 0.5.0:
- Fixed display bug.
- Improved behavior of focus and autofocus.
- Improved handling of interrupted downloads.
New in version 0.4.9:
- Fixed bug that was causing intermittent crashing.
New in version 0.4.8:
New in version 0.4.7:
- Added some OCR engine config settings.
New in version 0.4.6:
- Made viewfinder resizeable.
- Fixed bug in language codes used for translation.
New in version 0.4.5:
- Completely reworked the camera handling code and the user interface.
- Added Continuous Recognition Mode.


This random name generator can be used for roleplaying games, video games, or wherever you need a name for a fictional chracter. Each style of name below is generated by assembling word-parts from a list of names. This code was originally written to generate random words for mkpasswd, a security tool. The names are chosen to represent a certain language or culture. For example for the American names, the 1990 US Census data was used,
{% endblock %}| {% block sidebar %} | {% endblock %}
{% for nameblock in nameblocks %}
{{nameblock.title}}{% for name in nameblock.names %}{{name}}{% endfor %} |


[gecode-users] Function optimization
Christian Schulte
cschulte at kth.se
Wed Jan 4 21:14:52 CET 2017
Hi,
This user’s mailing list is devoted to Gecode-specific questions and not general modeling questions, in particular not SAT modeling.
Please find a more appropriate forum for your questions.
Christian
--
Christian Schulte, <http://www.gecode.org/~schulte> www.gecode.org/~schulte
Professor of Computer Science, KTH, <mailto:cschulte at kth.se> cschulte at kth.se
Expert Researcher, SICS, <mailto:cschulte at sics.se> cschulte at sics.se
From: users-bounces at gecode.org [mailto:users-bounces at gecode.org] On Behalf Of Assia benziane
Sent: Wednesday, January 4, 2017 14:37
To: mailng list <users at gecode.org>
Subject: [gecode-users] Function optimization
Hello everyone, I've this Function: X1 +X2 +X3 =Y that I've to implement in gecode as a sat problem. It means that I've to reaffect values to variables so that the function is satisfied. Can anyone help me to model this problem in gecode.
Télécharger Outlook pour Android
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.gecode.org/pipermail/users/attachments/20170104/246b07f3/attachment.html>
More information about the users
mailing list


{% extends "base.html" %} {% block active3 %} class="active" {% endblock %} {% block content %}
This site was designed to produce accurate estimates of the photometric zeropoint offset between a set of observations (likely in units of instrumental magnitudes) and a few standard photometric systems (i.e. SDSS, APASS, USNOB1, 2-MASS). The zeropoint determines the connection between an astronomical image and a standard photometric system: for any single passband, m = -2.5 x log10(count rate) + zeropoint. For any image that includes sources with previously well-measured magnitudes in the passband, you can calculate the approximate zeropoint for the entire image by comparing those sources to their previously-measured magnitudes. Unfortunately you don't always have previously-calibrated observations of every field in the passband of interest. There are, however, a few catalogs that cover most of the sky in a select few passbands, and we can do a pretty good job estimating any given source's brightness in any other passband based on those catalogs.
In detail, we do this by cross-matching sources from the 2-MASS catalog to sources in the SDSS catalog (if within the SDSS footprint), the APASS all-sky catalog, and/or the all-sky USNO-B1 catalog, then determining (for each source) a best-fit stellar spectrum from the Pickles Stellar Atlas, and then producing synthetic photometry to augment the observed photometry in the catalogs. These photometric estimates can then be used on a per-source basis or used to calculate a systematic offset between observed count rates and magnitudes in a standard photometric, i.e. the photometric zeropoint. Note: u, g, r, i, z & y are reported as AB magnitudes, while J, H, K, B, V, R & I are Vega magnitudes.
Though the estimates for individual sources can, at worst, have errors as large
as 0.5 mag or more, we have worked to get the median offset for any ensemble of
sources as close to zero as possible.
For any field with more than a few tens of sources, the systematic errors of the median dominate
over statistical errors, and so we provide two important estimates of error: the photometric
error for each individual source (reported on the Results page and in downloaded catalogs)
and a characteristic offset of the median for a set of sources in each modeled passband, reported below.
The following discussion assumes a Gaussian error distribution, and all reported errors
represent deviations of 1σ (68% CL). Our error estimates make use of data from
UKIDSS and the
Stetson standard star fields,
in addition to SDSS, USNO-B1, APASS, and 2-MASS photometry.
Note that the errors are much smaller for mid-optical bands
(i, z, y, R, I) than the bluer bands - please be aware of the errors at the blue end!
The per-passband errors for each source were determined by producing a modeled catalog for fields with published photometry and comparing the estimated photometry to published photometry for each source, assuming published measurement errors are negligible compared to modeling errors. The 1σ error for each passband was averaged over several fields and parameterized as a function of model fit χ2. That parameterization is then used to estimate the error for any model as a function of χ2. Errors in modeled u, g, r, i, z, y were determined by comparing SDSS, UKIDSS, and modeled photometry for five arbitrary 1.0° fields in the SDSS Stripe 82 footprint (see plots below for field centers). Errors in modeled B, V, R, I were determined by comparing modeled photometry to Stetson photometry in five fields within SDSS Stripe 82, chosen for their size (L112, L113, L92, L95, PG0231).
| Band | 1σ error of the Median (mag) | Comparison Photometry |
| y | 0.03 | UKIDSS |
| I | 0.03 | Stetson |
| R | 0.05 | Stetson |
| V | 0.07 | Stetson |
| B | 0.07 | Stetson |
Histograms of the differences between modeled and observed y and I magnitudes for sources in 5 arbitrary fields. Models based upon SDSS and 2-MASS observations.
| Band | 1σ error of the Median (mag) | Comparison Photometry |
| y | 0.04 | UKIDSS |
| z | 0.05 | SDSS |
| R | 0.03 | Stetson |
| I | 0.02 | Stetson |
| u | 0.13 | SDSS |
Histograms of the differences between modeled and observed y and I magnitudes for sources in 5 arbitrary fields. Models based upon APASS and 2-MASS observations.
| Band | 1σ error of the Median (mag) | Comparison Photometry |
| y | 0.03 | UKIDSS |
| z | 0.07 | SDSS |
| i | 0.12 | SDSS |
| r | 0.18 | SDSS |
| g | 0.30 | SDSS |
| u | 0.34 | SDSS |
| I | 0.10 | Stetson |
| V | 0.24 | Stetson |
Histograms of the differences between predicted and true values for y, z, and I magnitudes for sources in 5 arbitrary fields. Models based upon USNO-B1 and 2-MASS observations.
This site provides mode 2 coverage of the entire sky and modes 0+1 coverage of more than 90% of the sky. The maps below show our coverage in detail.
This site offers an API as a webservice so that you can run interact with it programatically. Requests are sent as a URL over HTTP, and the results can be obtained in either JSON or a simple ASCII table format. The same three methods of operation are available through the API as through the main website, and the website interface can be used to examine the results of any API request made within the last day. Any posted files must be simple ASCII tables, with the first two columns RA and Dec (decimal degrees), and a third column of instrumental magnitudes (if using method 3). If the ignore_usnob flag is included, mode 2 results (described above) are excluded.
curl 'http://classy.astro.berkeley.edu/api?method=1&ra=200.&dec=20.&size=450.&response=ascii'
curl -F source_file=@YOUR_FILE 'http://classy.astro.berkeley.edu/api?method=2&response=ascii&ignore_usnob'
curl -F source_file=@YOUR_FILE 'http://classy.astro.berkeley.edu/api?method=3&band=y&response=ascii'
Each API response includes a string of numbers called the "Query ID", which looks something like "1360698575_1157" - this allows you to examine the results of any API call through the full web interface. To inspect the catalog, pass your Query ID as a URL query string to the Results page with the keyword 'sid'. Note: only works for queries made within the last day or so.
Example:http://classy.astro.berkeley.edu/results?sid=YOUR_QUERY_ID
This project gratefully uses several open-source software and web development tools:
If you have any questions about the codebase or the website, or if you have any comments or suggestions, simply shoot me an email: ishivvers (at) astro (dot) berkeley (dot) eduCodebase and site developed by Isaac Shivvers at UC Berkeley, with generous help and advice from everyone at the Center for Time Domain Informatics (Josh Bloom, Adam Morgan, Adam Miller, Chris Klein, Brad Cenko, Ori Fox, Dan Starr, Joey Richards).


"G" - Glider
"S" - Glider Gun
"L" - Simple Spaceship
"B" - Bat Spaceship
"P" - Pulsar
"R" - Random
"H" - Help
"D" - Drawer
"B" - Game of Life


Security best practices¶
There a number of actions you should take to ensure that your app is secure before you put it into production. The following is not an exhaustive list, but offers some common best practices you should consider following to keep your app secure when using the Usergrid.
Never use the ‘sandbox’ for a production app¶
By default, every new Nobackend account has an app named “sandbox” that is already created under your new organization. This app is no different than any other app that you might create, except that the Guest role has been given full permissions (that is, /** for GET, POST, PUT, and DELETE). This eliminates the need for a token when making application level calls, and can make it much easier to get your app up and running; however, it also means that any data in the sandbox application is completely unsecured.
As with any other app, you can secure the sandbox application by updating its roles and permissions. For more on working with permissions and roles, see [Using Permissions](using-permissions.html).
Review permissions in your apps¶
Prior to launching your app into a production environment, it is advisable to review all the roles and permissions you have set up, as well as the groups and users you have assigned those permissions and roles to. During development, you may find that you added various permissions which may or may not still be required once the app is complete. Review all permissions and delete any that are no longer required.
Prior to taking your app live, you should secure it by removing any unnecesary Guest permissions. (See [Using Permissions](using-permissions.html) for further information about setting permissions.) After you secure your the app, any calls to the API will need to include an OAuth token. Oauth tokens (also called access tokens) are obtained by the API in response to successful authentication calls. Your app saves the token and uses it for all future calls during that session. Learn more about access tokens in Authenticating users and application clients.
Edit the ‘default’ role¶
When preparing an application for production use, a good first step is to edit permission rules for the Default role. The permissions in this role will be applied to every user who authenticates with a valid access token.
For example, in the Default role, you will most likely first want to remove the permission rule that grants full access to all authenticated users:
GET,PUT,POST,DELETE:/users/me/**
Review test accounts If you created any test user or test administrator accounts during development, these should also be reviewed for relevancy and security. Delete any test accounts that are no longer needed. If these accounts are still needed, make sure that passwords have been secured to the standards required by your app.
Use https¶
Make sure that any calls you make to the API are done using the secure https protocol, and not the insecure http protocol.
If your app is a web app, that is, an app served by a web server, make sure that the app is served using https.
Acquire access tokens in a secure way¶
There are various methods for acquiring an access token (see [Authenticating users and application clients](authenticating-users-and-application-clients.html). One method is to use the application or organization level client secret-client id combination. This method should not be used in client applications (this is, apps that are deployed to a device, and which authenticate and make calls against the API).
That’s because a hacker could analyze your app (even a compiled, binary distribution of your app), and retrieve the secret-id combination. Armed with this information, an attacker could gain full access to the data in your account.
Instead, use application user credentials. This means that your app’s users should provide a username and password. Your app would use these to authenticate against the API and retrieve an access token.
The client secret-client id combination should be used only in secure, server-side applications where there is no possibility of a hacker gaining control of the credentials.
Treat mobile clients as untrustworthy¶
For mobile access, it is recommended that you connect as an application user with configured access control policies. Mobile applications are inherently untrusted because they can be easily examined and even decompiled.
Any credentials stored in a mobile app should be considered secure only to the Application User level. This means that if you don’t want the user to be able to access or delete data in your Nobackend application, you need to make sure that you don’t enable that capability through roles or permissions. Because most web applications talk to the database using some elevated level of permissions, such as root, it’s generally a good idea for mobile applications to connect with a more restricted set of permissions. For more information on restricting access through permission rules, see [Using Permissions](using-permissions.html).
| Entity | Example |
|---|---|
| User | Save the location of a user’s home as part of their
profile in the users collection to suggest upcoming
special events or activities located nearby, or to
display advertisements that are relevant based on the
user’s proximity to a business. |
| Device | Periodically save the location data returned from a
user’s device, then query the devices collection to
send offers and alerts to user’s that are located near
your business with a [push notification]
(../push-notifications/push-notifications-overview). |
| Activity | Create stronger social connections by associating a user
activity with the location where it occurred. The
activity can then be displayed to nearby friends and
family, or used to enrich the user’s activity stream |
| Asset | Save user photos with location data in the
asset collection to allow users to retrieve and sort
their memories based on when and where they happened |


--- title: Superman's A Baby, But He's Still Superman layout: post ---
Which means that the correct lesson the boy's parents could have taught him was what it is the boy does to make Superman think he can manipulate him, or even what it is about Superman that makes him act that way; but the one they went with, the one that will make him neurotic for the rest of his life, is that he's a winner.


When a DataPoint is written to with a new value, the event of recording a value can trigger a calculation. You can have multiple calculations triggered when a point receives a new value and when the resulting value of your formula is then stored in a target point. That in turn can trigger other events such as another calc, alerts etc.
Calculations are validated by the server when saves, and are disabled if such things as infinite loops are detected. you can have calcs, intelligence queries, summaries and so on cascade up to 10 steps before the server considers it a possible infinite loop and rejects it.
The formulas basic arithmetic will be executed and the resulting value will be recorded into the target point – all compression, alerts and other functionality will then be applied to the new value as if it was a newly recorded value.
A DataPoint can be a trigger, parameter or target for a formula.
If a point is a trigger and a new value is written to it the formula assigned to that data point will be executed.
After the formula executes successfully, the resulting double value is stored in the target point and all Record Value settings are processed (Such as Alerts, Compression etc)
To setup a calculation you need to create at least two DataPoint channels in Nimbits. A trigger point will trigger the calculation to be processed and the target point receives the result of the calculation. You can also setup up to three parameter points. They will have their current values inserted into the calculation at variables x, y and z. Typically, the trigger point is also the x variable, causing the current value of the trigger (the newly recorded value) to be inserted into a formula and recorded to the target point.
After creating your data points right click on the trigger point. You do not have to do anything to the target point. Select Calculation from the menu.
Here, you can select the target point and points that should be the x, y and z values in the formula if you need them. Again, typically the target point is used as an x variable in the formula. Nimbits will replace the x, y and z with the current value of the corresponding point's.
Enter a formula, ensuring the x, y and z are lower case. Click test to ensure everything is working.
Supported symbols are: , +, -, , /, ^, %, cos, sin, tan, acos, asin, atan, sqrt, sqr, log abs, neg x + y | add the points stored in the x and y settings together and recorded the result in the target sqrt(x) | Take the square root of x and store in the target.