Module druid.scroll
Component to handle scroll content.
Scroll consist from two nodes: scroll parent and scroll input Scroll input the user input zone, it's static Scroll parent the scroll moving part, it will change position. Setup initial scroll size by changing scroll parent size. If scroll parent size will be less than scroll_input size, no scroll is available. For scroll parent size should be more than input size
Functions
| init(scroll_parent, input_zone) | Component init function |
| scroll_to(vector3[, is_instant]) | Start scroll to target point |
| scroll_to_percent(vector3[, is_instant]) | Start scroll to target scroll percent |
| init(index[, skip_cb]) | Scroll to item in scroll by point index |
| set_points(points) | Set points of interest. |
| set_inert(state) | Enable or disable scroll inert. |
| on_point_move(callback) | Set the callback on scrolling to point (if exist) |
| set_border(border) | Set the scroll possibly area |
| get_scroll_percent() | Return current scroll progress |
Tables
| Events | Component events |
| Fields | Component fields |
| Style | Component style params |
Functions
- init(scroll_parent, input_zone)
-
Component init function
Parameters:
- scroll_parent node Gui node where placed scroll content. This node will change position
- input_zone node Gui node where input is catched
- scroll_to(vector3[, is_instant])
-
Start scroll to target point
Parameters:
- vector3 point target point
- is_instant bool instant scroll flag (optional)
Usage:
scroll:scroll_to(vmath.vector3(0, 50, 0))
scroll:scroll_to(vmath.vector3(0), true)
- scroll_to_percent(vector3[, is_instant])
-
Start scroll to target scroll percent
Parameters:
- vector3 point target percent
- is_instant bool instant scroll flag (optional)
Usage:
scroll:scroll_to_percent(vmath.vector3(0.5, 0, 0))
- init(index[, skip_cb])
-
Scroll to item in scroll by point index
Parameters:
- index number Point index
- skip_cb bool If true, skip the point callback (optional)
- set_points(points)
-
Set points of interest.
Scroll will always centered on closer points
Parameters:
- points table Array of vector3 points
- set_inert(state)
-
Enable or disable scroll inert.
If disabled, scroll through points (if exist)
If no points, just simple drag without inertion
Parameters:
- state bool Inert scroll state
- on_point_move(callback)
-
Set the callback on scrolling to point (if exist)
Parameters:
- callback function Callback on scroll to point of interest
- set_border(border)
-
Set the scroll possibly area
Parameters:
- border vector3 Size of scrolling area
- get_scroll_percent()
-
Return current scroll progress
Returns:
-
vector3
Scroll progress
Tables
- Events
-
Component events
Fields:
- on_scroll druid_event On scroll move callback
- on_scroll_to druid_event On scroll_to function callback
- on_point_scroll druid_event On scrolltoindex function callback
- Fields
-
Component fields
Fields:
- node node Scroll parent node
- input_zone node Scroll input node
- zone_size vector3 Current scroll content size
- soft_size number Soft zone size from style table
- center_offset vector3 Distance from node to node's center
- is_inert bool Flag, if scroll now moving by inertion
- inert vector3 Current inert speed
- pos vector3 Current scroll posisition
- target vector3 Current scroll target position
- Style
-
Component style params
Fields:
- FRICT_HOLD number Multiplier for inertion, while touching
- FRICT number Multiplier for free inertion
- INERT_THRESHOLD number Scroll speed to stop inertion
- INERT_SPEED number Multiplier for inertion speed
- DEADZONE number Deadzone for start scrol in pixels
- SOFT_ZONE_SIZE number Size of outside zone in pixels (for scroll back moving)
- BACK_SPEED number Scroll back returning lerp speed
- ANIM_SPEED number Scroll gui.animation speed for scroll_to function


--- layout: main bodyClass: inquiries title: Inquiries h1: Want Brandon to write for you? ---
It should be obvious by now that I love writing. It may be the case that you need a writer. Maybe we can work something out.
I’m open to writing for just about any publication that would welcome my work or expertise. Just a few things to be aware of:
Still interested? Contact me and maybe we can work something out!
Yes, I do speaking too! I’ll talk on anything from professional skills for the web industry to design thinking for business people to mental health. If you’re interested, contact me and let’s talk. Oh, and points 1 and 2 above apply here too.
Maybe you’re just looking for someone to read over something you wrote or bounce a few ideas off of. Maybe you want to get started in writing but don’t know where to start. No problem—let’s chat. Contact me and let me know what you need help with. I can’t promise I’ll agree to every project, but I’m definitely open to a conversation or a few at the very least.
This isn’t what I typically do, but I might make an exception for interesting projects. Contact me if you think your project qualifies.


Unit testing in Chrome
ts_web_test_macro
ts_web_test_macro(tags, data)
ibazel wrapper for ts_web_test
This macro re-exposes the ts_web_test
rule with some extra tags so that
it behaves correctly under ibazel.
This is re-exported in //:defs.bzl
as ts_web_test
so if you load the rule
from there, you actually get this macro.
Attributes
tags |
standard Bazel tags, this macro adds a couple for ibazel |
data |
runtime dependencies
**kwargs: passed through to |
ts_web_test
ts_web_test(name, deps, data, srcs, bootstrap)
Runs unit tests in a browser.
When executed under bazel test
, this uses a headless Chrome browser for speed.
This is also because bazel test
allows multiple targets to be tested together,
and we don't want to open a Chrome window on your machine for each one. Also,
under bazel test
the test will execute and immediately terminate.
Running under ibazel test
gives you a "watch mode" for your tests. The rule is
optimized for this case - the test runner server will stay running and just
re-serve the up-to-date JavaScript source bundle.
To debug a single test target, run it with bazel run
instead. This will open a
browser window on your computer. Also you can use any other browser by opening
the URL printed when the test starts up. The test will remain running until you
cancel the bazel run
command.
Currently this rule uses Karma as the test runner, but this is an implementation detail. We might switch to another runner like Jest in the future.
Attributes
name |
A unique name for this rule. |
deps |
Other targets which produce JavaScript such as |
data |
Runtime dependencies |
srcs |
JavaScript source files |
bootstrap |
JavaScript files to include before the module loader (require.js). For example, you can include Reflect,js for TypeScript decorator metadata reflection, or UMD bundles for third-party libraries. |


var onProcessorErrorHandler: ((Throwable?) -> Boolean)?
A callback to invoke whenever a processor error is encountered. Returning true signals that the error was handled and a retry attempt should be made, if possible. This callback is not called on the main thread so any UI work would need to switch context to the main thread.


2.6. Heap Memory¶
2.6.1. Heap Memory¶
“Heap” memory, also known as “dynamic” memory, is an alternative to
local stack memory.
Local memory is quite automatic.
Local variables are allocated automatically when a function is called,
and they are deallocated automatically when the function exits.
Heap memory is different in every way.
The programmer explicitly requests that space be allocated,
using the new
operator in Java or C++.
This memory “block” will be of a particular size,
ususally determined automatically from the size of the object being
created.
That memory block (your object) continues to be allocated
until something happens that makes it go away.
In some languages (noteably, C and C++),
an object in heap memory only goes away when the programmer explicitly
requests that it be deallocated.
So the programmer has much greater control of memory, but with greater
responsibility since the memory must now be actively managed.
Dropping all references to a memory location without deallocating it
is a signficant source of errors in C/C++, and this is so common that
it has a name: memory leak.
(In fact, many commercial programs implemented in C++ have memory
leaks, that will eventually make them crash after being used for a
long time.)
Java removes this source of errors by handling memory deallocation
automatically, using garbage collection.
The downside is that garbage collection is a slow process that happens
at unpredictable times.
The advantages of heap memory are:
Lifetime. Because the programmer now controls exactly when memory is allocated, it is possible to build a data structure in memory, and return that data structure to the caller. This was never possible with local memory, which was automatically deallocated when the function exited.
Size. The size of allocated memory can be controlled with more detail. For example, a string buffer can be allocated at run-time that is exactly the right size to hold a particular string. With local memory, the code is more likely to declare a buffer of size 1000 and hope for the best. (See the StringCopy() example below.)
The disadvantages of heap memory are:
More Work. Heap allocation needs to arranged for explicitly in the code, which is just more work.
More Bugs. Because it’s now done explicitly in the code, on occasion the allocation will be done incorrectly leading to memory bugs. Local memory is constrained, but at least it’s never wrong.
Nonetheless, there are many problems that can only be solved with heap memory, so that’s the way it has to be.
The following are some important points about Garbage Collection.
Garbage collection is a mechanism that is invoked by the Java Virtual Machine to get ride of the unused heap memory objects. It removes every object that is not being used anymore by the running Java program. The result of this process is freeing up the unused memory so other new objects can use that piece of memory.
In other programming languages like C and C++, it is the responsibility of the programmer to take care of freeing up the memory from unused objects and arrays. Doing so consumes programmer’s time and increases code complexity. On the other hand, garbage collection makes programming easier by taking care of the memory management for the programmer.
Before removing an object from memory, garbage collection invokes the finalize() method of that object and gives an opportunity to perform any sort of cleanup required. If the programmer does not override this method, the default finializer method will be invoked (the method defined in the
Object
class).The Java Virtual Machine invokes garbage collection based on the size of the dynamically allocated memory from the heap. Garbage collection is slow, and hard to predict. This can be a problem for programs that have real-time performance constraints.
The following are some cases that make an object subject to be removed from heap memory by garbage collection:
When the programmer changes all references to an object to something else.
If the object is defined inside a block of code, and all references to that object are local. When excecution of that block is complete, the local variables are destroyed automatically, leaving the object in heap memory without any references. (So this is really a special case of rule (1).) Here is an example
void test(boolean found) { if (found) { // employee1 is a variable local to this if statement // but the Employee object is in heap memory. Employee employee1 = new Employee("John", 1000); // We can do things here with employee1, and its associated object Printout(employee1.name()); } // At this point, the only reference to the created object is out of scope // since employee1 was local to the if statement block. // So the Employee object will be eligible for garbage collection. }
void test(boolean found) { if (found) { // employee1 is a variable local to this if statement // but the Employee object is in heap memory. Employee employee1 = new Employee("John", 1000); // We can do things here with employee1, and its associated object Printout(employee1.name()); } // At this point, the only reference to the created object is out of scope // since employee1 was local to the if statement block. // So the Employee object will be eligible for garbage collection. }
Assume an object
A
contains a reference to another objectB
, andA
contains the only such reference toB
.  Here is an example.
// Date class to represent dates class Date { int day; int month; int year; // Date constructor public Date(int d, int m, int y) { day = d; month = m; year = y; } } // An Employee class that includes a Date class Employee { String name; Date dateOfBirth; // Employee constructor to initialize both name and date public Employee(String name , int d, int m, int y) { this.name = name; dateOfBirth = new Date(d, m, y); } } // Now let's test this code class Test { public static void main() { Employee empPtr = new Employee("Sam", 3, 9, 1983); // Now empPtr references an object that contains a reference to a Date object empPtr = null; // Now the Employee object is eligible for garbage collection. // So its Date object will also be eligible for garbage collection // because nothing else points to it. } }// Date class to represent dates class Date { int day; int month; int year; // Date constructor public Date(int d, int m, int y) { day = d; month = m; year = y; } } // An Employee class that includes a Date class Employee { String name; Date dateOfBirth; // Employee constructor to initialize both name and date public Employee(String name , int d, int m, int y) { this.name = name; dateOfBirth = new Date(d, m, y); } } // Now let's test this code class Test { public static void main() { Employee empPtr = new Employee("Sam", 3, 9, 1983); // Now empPtr references an object that contains a reference to a Date object empPtr = null; // Now the Employee object is eligible for garbage collection. // So its Date object will also be eligible for garbage collection // because nothing else points to it. } }
Before seeing the exact details, let’s look at a rough example of allocation and deallocation in the heap.
<IP_ADDRESS>. Allocation¶
The heap is a large area of memory available for use by the program.
The program can request areas, or “blocks”, of memory for its use
within the heap.
In order to allocate a block of some size, the program makes an
explicit request by calling the heap allocation operation.
In Java or C++, this is the new
operator.
The allocation function reserves a block of memory of the requested
size in the heap (usually, the size of the object that you want) and
returns a refernece to it.
Suppose a program makes three allocation requests to allocate memory
to hold three separate GIF images in the heap, each of which takes
1024 bytes of memory.
After the three allocation requests, memory might look like.
Each allocation request reserves a contiguous area of the requested size in the heap and returns a reference to that new block to the program. Since each block is always referred to by a reference, the block always plays the role of a “pointee” (Section 1) and the program always manipulates its heap blocks through references. The heap block references are sometimes known as “base address” pointers since by convention they point to the base (lowest address byte) of the block. In this example, the three blocks have been allocated contiguously starting at the bottom of the heap, and each block is 1024 bytes in size as requested. In reality, the heap manager can allocate the blocks wherever it wants in the heap so long as the blocks do not overlap and they are at least the requested size. At any particular moment, some areas in the heap have been allocated to the program, and so are “in use”. Other areas have yet to be committed and so are “free” and are available to satisfy allocation requests. The heap manager has its own, private data structures to record what areas of the heap are committed to what purpose at any moment. The heap manager satisfies each allocation request from the pool of free memory and updates its private data structures to record which areas of the heap are in use.
<IP_ADDRESS>. Deallocation¶
When the program is finished using a block of memory, in some languages the block must be explicitly deallocated. In such cases, the block will be marked unused. In Java, typically space is “made available” by not having any references to it. This allows Java garbage collection to know that this area must be cleaned. Garbage collection will implicitly free up the unused memory blocks in the heap. The heap manager updates its private data structures to show that the area of memory occupied by the block is free again and so may be re-used to satisfy future allocation requests.
After deallocation, the reference continues to point to the now
deallocated block.
The program can no longer reach the deallocated pointee.
In a language (like C++) with explicit memory deallocation and no
garbage collection, the programmer must make sure that he or she does
not try to follow the old reference to the deallocated block.
This is why the pointer is drawn in gray—the pointer is there,
but it must not be used.
Of course, in Java the code will have set the pointer to null
or
to point to somewhere else, so as to tell the garbage collection that
this object is now unused.
This is a big part of why Java references are safer to use than C++
pointers.
<IP_ADDRESS>. Programming the Heap¶
Programming the heap looks pretty much the same in most languages. The basic features are:
The heap is an area of memory available to allocate areas (“blocks”) of memory for the program.
There is some “heap manager” library code which manages the heap for the program. The programmer makes requests to the heap manager, which in turn manages the internals of the heap.
The heap manager uses its own private data structures to keep track of which blocks in the heap are “free” (available for use) and which blocks are currently in use by the program and how large those blocks are. Initially, all of the heap is free.
The heap may be of a fixed size (the usual conceptualization), or it may appear to be of a fixed but extremely large size backed by virtual memory. In either case, it is possible for the heap to get “full” if all of its memory has been allocated and so it cannot satisfy an allocation request. The allocation function will communicate this run-time condition in some way to the program—usually by raising an OutOfMemoryError run-time exception.
The allocation function requests a block in the heap of a particular size. The heap manager selects an area of memory to use to satisfy the request, marks that area as “in use” in its private data structures, and returns a reference to the heap block. The caller is now free to use that memory by following the reference. The block is guaranteed to be reserved for the sole use of the caller—the heap will not hand out that same area of memory to some other caller. The block does not move around inside the heap—its location and size are fixed once it is allocated.
The Java virtual machine invokes the garbage collection to remove any unused block of memory, free its space and return this space of memory to the heap free area for later re-use.
<IP_ADDRESS>. Arrays¶
In Java, array memory is allocated in the heap.
The size of the array memory block is the size of each element
multiplied by the number of elements.
So the following code heap allocates an array of 100 Fraction
objects in the heap, sets them all to 22/7, and deallocates the heap
array.
// Fraction class
class Fraction {
int numerator, denominator;
// Fraction constructor
public Fraction(int num, int den) {
numerator = num;
denominator = den;
}
}
// Test class
class TestHeapArray {
static void main() {
Fraction[] fracts;
int i;
int length = 100;
// allocate the array
fracts = new Fraction[length];
// use it like an array -- in this case set them all to 22/7
for (i = 0; i < length; i++) {
fracts[i] = new Fraction(22, 7);
}
// Remove access to the array, making it garbage.
// If the Fraction objects that were created are also garbage now.
fracts = null;
}
}
// Fraction class
class Fraction
int numerator, denominator;
// Fraction constructor
public Fraction(int num, int den) {
numerator = num;
denominator = den;
}
}
// Test class
class TestHeapArray {
static void main() {
Fraction[] fracts;
int i;
int length = 100;
// allocate the array
fracts = new Fraction[length];
// use it like an array -- in this case set them all to 22/7
for (i = 0; i < length; i++) {
fracts[i] = new Fraction(22, 7);
}
// Remove access to the array, making it garbage.
// If the Fraction objects that were created are also garbage now.
fracts = null;
}
}
In this example the array is dynamically allocated memory in two steps:
The first step when the array is created using
fracts = new Fraction[100];
. This line is used to allocate dynamic array of 100 references toFractions
. All references are initialized tonull
.The second step was inside the loop. Every loop iteration uses
new
to dynamically allocate an object of typeFraction
. The initial value of each object determined by the values sent to the Fraction constructor.
Heap memory provides greater control for the programmer—the blocks of memory can be requested in any size, and they remain allocated until they are no longer pointed to and recovered by the garbage collector. An object in heap memory can be passed back to the caller of a function, since it is not deallocated when that function exits. And it can be used to build linked structures such as linked lists and binary trees. The disadvantage of heap memory is that the program must make explicit allocation calls to manage the heap memory, and the program has to wait when the garbage collector runs. The heap memory does not operate automatically and conveniently the way local memory does.


| scale_linetype {ggplot2} | R Documentation |
Scale for line patterns
Description
Default line types based on a set supplied by Richard Pearson,
University of Manchester. Continuous values can not be mapped to
line types unless scale_linetype_binned()
is used. Still, as linetypes has
no inherent order, this use is not advised.
Usage
scale_linetype(..., na.value = "blank")
scale_linetype_binned(..., na.value = "blank")
scale_linetype_continuous(...)
scale_linetype_discrete(..., na.value = "blank")
Arguments
... |
Arguments passed on to discrete_scale
palette A palette function that when called with a single integer
argument (the number of levels in the scale) returns the values that
they should take (e.g., scales::hue_pal() ).
breaks One of:
-
NULL for no breaks
-
waiver() for the default breaks (the scale limits)
A character vector of breaks
A function that takes the limits as input and returns breaks
as output
limits One of:
-
NULL to use the default scale values
A character vector that defines possible values of the scale and their
order
A function that accepts the existing (automatic) values and returns
new ones
drop Should unused factor levels be omitted from the scale?
The default, TRUE , uses the levels that appear in the data;
FALSE uses all the levels in the factor.
na.translate Unlike continuous scales, discrete scales can easily show
missing values, and do so by default. If you want to remove missing values
from a discrete scale, specify na.translate = FALSE .
aesthetics The names of the aesthetics that this scale works with.
scale_name The name of the scale that should be used for error messages
associated with this scale.
name The name of the scale. Used as the axis or legend title. If
waiver() , the default, the name of the scale is taken from the first
mapping used for that aesthetic. If NULL , the legend title will be
omitted.
labels One of:
-
NULL for no labels
-
waiver() for the default labels computed by the
transformation object
A character vector giving labels (must be same length as breaks )
A function that takes the breaks as input and returns labels
as output
guide A function used to create a guide or its name. See
guides() for more information.
super The super class to use for the constructed scale
|
na.value |
The linetype to use for NA values.
|
Examples
base <- ggplot(economics_long, aes(date, value01))
base + geom_line(aes(group = variable))
base + geom_line(aes(linetype = variable))
# See scale_manual for more flexibility
# Common line types ----------------------------
df_lines <- data.frame(
linetype = factor(
1:4,
labels = c("solid", "longdash", "dashed", "dotted")
)
)
ggplot(df_lines) +
geom_hline(aes(linetype = linetype, yintercept = 0), size = 2) +
scale_linetype_identity() +
facet_grid(linetype ~ .) +
theme_void(20)
[Package
ggplot2 version 3.3.3
Index]


Classification cats' easy but Clasifacaiton JavaScrypt element's
diff9kult cuase JavaScrypt not writan by cats. Meouzer
What about the provocative statement that the reader has no idea on how to detect a String? Well its true!
You have no idea unless you have in great detail gone through some of the esoterics of JavaScript.
See section Detecting Built in Class Instances.
The fact that JavaScript doesn't provide such basic functionality as String detection or ArrayBuffer detection is evidence
that JavaScript has often gone down the wrong path in its youth. If JavaScript had been serious about data typing
this sort of situation would never had happened.
It's a commonly expressed thought that JavaScript is classless. This may be the reason why JavaScript doesn't provide for typing class instances. As we shall see, JavaScript had the means for full typing if the JavaScript architets had just been paying attention. That JavaScript needs robust typing like other languages should be obvious. If not, then consider the fact that it's only robust typing mechanisms that allow deep copying, serialization, and deserialization of complex JavaScript objects.
Since JavaScript lacks a robust typing system, we develop our own type() function. JavaScript has the typeof operator, but it only types primitives, functions, and the general object category. It for example doesn't type Booleans, or any other built in class. What about the instanceof operator? The problems with instanceof are enumerated.
In conclusion, instanceof fails miserably as a full typing mechanism.
The specifcation of the type() function is given below.
| The type() Type Function | |
|---|---|
| type(x) | x |
| "null" | A null primitive |
| "undefined" | An undefined primitive |
| "boolean" | A boolean primitive |
| "number" | A number primitive |
| "string" | A string primitive |
| "bigint" | A bigint primitive |
| "symbol" | A symbol primitive |
| "Date" | A class instance of Date |
| "RegExp" | A class instance of RegExp |
| "InternalError" | A class instance of InternalError |
| "Error" | A class instance of Error or proper cast to Error |
| "EvalError" | A class instance of Error or proper cast to Error |
| "RangeError" | A class instance of RangeError or proper cast to RangeError |
| "ReferenceError" | A class instance of ReferenceError or proper cast to ReferenceError |
| "SyntaxError" | A class instance of SyntaxError or proper cast to SyntaxError |
| "TypeError" | A class instance of TypeError or proper cast to TypeError |
| "URIError" | A class instance of URIError or proper cast to URIError |
| "Number" | A class instance of Number |
| "String" | A class instance of String |
| "Boolean" | A class instance of Boolean |
| "Array" | A class instance of Array |
| "Arguments" | A function's argument list |
| "Function" | A function |
| "Int8Array" | A class instance of Int8Array |
| "Uint8Array" | A class instance of Uint8Array |
| "Uint8ClampedArray" | A class instance of Uint8ClampedArray |
| "Int16Array" | A class instance of Int16Array |
| "Uint16Array" | A class instance of Uint16Array |
| "Int32Array" | A class instance of Int32Array |
| "Uint32Array" | A class instance of Uint32Array |
| "Float32Array" | A class instance of Float32Array |
| "Float64Array" | A class instance of Float64Array |
| "ArrayBuffer" | A class instance of ArrayBuffer |
| "DataView" | A class instance of DataView |
| "Map" | A class instance of Map |
| "Set" | A class instance of Set |
| "WeakMap" | A class instance of WeakMap |
| "WeakSet" | A class instance of WeakSet |
| "Object" | All elements not previously categorized in this table.
The complete list of such elements follows. The items overlap.
|
|
The native type is discussed later.
A data type is a named category of JavaScript elements. See Wikipedia: Data Type for more details.
How easy is it to determine in code the JavaScript data type of an arbitrary element x? The fact of the matter is that there is no currently known means of determination.
So we develop our own type() function, as seen in code listing 3, that returns the types of the instances of the various JavaScript data types. It is based on arcane code, which shows just how far JavaScript went off into the deep end of the theme "Let's not support basic infrastructure if we don't want to because who's going to notice anyway? Meouzer the snarky cat programming cat? Ha ha ha." However, Meouzer gets the last laugh as he gently barbecues the JavaScript committee in the most delicious way possible.
The typeof() function is good only at distinguishing between primitives, functions, and the remaining objects. The remaining infrastructure supporting typing solely resides in the instanceof operator, which is object based. That's not good enough because JavaScript data types, except for some primitives, are classes and classes have another idea for the concept of instance. It's therefore prudent to invent nomenclature to distinguish between object based instances and class based instances.
JavaScript lands the first punch since the name of the instanceof operator should be respected. If x instanceof X evaluates to true then x is an instance of the class/constructor X. What this means is that x derives from X.prototype.
 Exceptions are for the class/constructors Symbol and BigInt where use of new is not allowed. We define an X class instance to be a class instance of X. Every built in class Klass is a JavaScript data type because it is by definition the set of all class instances of its constructor and is therefore a named category of JavaScript objects.
For example, since Object.create(Boolean.prototype) derives from Boolean.prototype it is an instance of the Boolean class, but it's not a Boolean class instance. Now x = new Boolean(true) is a Boolean class instance. Since x is a result of the constructor call, x automatically has signed the contract that the constructor enforces and so is worthy of being called a Boolean class instance. Similarly Symbol() is a class instance of Symbol, and BigInt(7) is a BigInt class instance.
Now this is very simple but worth emphasizing. Take any built in class such as Boolean and then ask the following question. What is a Boolean? The only answer is that a Boolean is a class instance of Boolean. For example, no one would call Object.create(Boolean.prototype) a Boolean, but everyone would call new Boolean(true) a Boolean.
Before BigInt and Symbol came to be in ECMAScript-2015, you would laugh at the idea of a class constructor returning primitives.  Class instances of BigInt and Symbol are primitives. OK! The inheritance article with good reason argues that they are classes: but it could be wrong.
The general type of an object x is the name of the most derived built in class Klass for which x is an instance of Klass. Then to determine if x is a class instance of Klass one may method test the instance. That means one uses a method of Klass that throws an exception on instances that are not class instances. If x is a class instance of Klass then type(x) should be "Klass", but otherwise x is a mere instance and type(x) should be "Object". If there is no such built in class Klass for which x is an instance of, then type(x) should be "Object".
Determining the general type with instanceof is very inefficient since this involves testing x instanceof Klass against every built in class Klass. Also method testing instances is inefficient since it involves throwing and catching exceptions.
Fortunately, there is a bit of arcane code involving the native type of an object that completely eliminates the need for instanceof. It also largely eliminates the need for method testing.
For any element x, Object.prototype.toString.call(x) is a string that takes the form "[object nativeType]". So we can extract the native type as follows.
In ECMAScript-2009, the arcane nativeType() is a near typing of JavaScript's data types. In fact, a simple wrapper around nativeType() provides full typing.
The JavaScript committee, probably because they are a committee who didn't take minutes in their pre 2009 meetings, simply didn't realize how great the native type was, so from lack of attention to detail and not reading seven year old notes, and because they don't have cats, the committee seriously degraded the typing capabilities of nativeType() for ECMA-2015. So more work is required to obtain a typing wrapper. Worst of all, method testing is required for the following data types: ArrayBuffer, DataView, Map, Set, WeakMap, and WeakSet. These data types are called the quirk classes because the native type behaves so badly when they are involved.
We won't mention it further, but nativeType() and type() both type the host objects. For example nativeType(window) = type(window) = "Window" and nativeType(document) = type(document) = "HTMLDocument".
First use typeof() to type the primitives. Then to type the built in classes use the following table.
The instances column refers to mere instances, which are instances of the class but not class instances of the class.
|
Native Types of class instances, remaining instances, and the prototype (IE11 native type in red if different) (Edge native type in blue if different) |
|||||
|---|---|---|---|---|---|
| Group | Klass | Class instances | Klass.prototype | Instances | |
| Group 1 | Date | "Date" | "Object" | "Object" | |
| RegExp | "RegExp" | "Object" | "Object" | ||
| Int8Array | "Int8Array" | "Object" | "Object" | ||
| Error | "Error" | "Object" "Error" "Error" |
"Object" | ||
| RangeError | "Error" |
"Object" Error "Error" |
"Object" | ||
| Group 2 | Boolean | "Boolean" | "Boolean" | "Object" | |
| Number | "Number" | "Number" | "Object" | ||
| String | "String" | "String" | "Object" | ||
| Array | "Array" | "Array" | "Object" | ||
| Primitve Class | Symbol | "Symbol" | "Symbol" | "Symbol" | |
| BigInt | "BigInt" | "BigInt" | "BigInt" | ||
| Quirk Classes | ArrayBuffer | "ArrayBuffer" | "ArrayBuffer" | "ArrayBuffer" | |
| DataView | "DataView" "Object" |
"DataView" "Object" |
"DataView" "Object" |
||
| Set | "Set" "Object" |
"Set" "Object" |
"Set" "Object" |
||
| Map | "Map" "Object" |
"Map" "Object" |
"Map" "Object" |
||
| WeakSet | "WeakSet" | "WeakSet" | "WeakSet" | ||
| WeakMap | "WeakMap" "Object" |
"WeakMap" "Object" |
"WeakMap" "Object" |
||
| Int8Array is representative of all typed arrays. | |||||
| RangeError is representative of all error classes other than Error. | |||||
| IE11 does not define Symbol, BigInt, and WeakSet. | |||||
| Edge does not define BigInt | |||||
| The JavaScript committee and Microsoft together nearly made full typing impossible by the design of the native type for these classes. Only by sheer luck does method testing work for these classes, and so we barely escape living in a world without typing and infrasctruture that results from typing such as copying and deep copying. |
Believe it or not, you now have everything you need to code type(). There are three pertinent class entities to deal with: class instances, mere instances (which are instances but not class instances), and the class prototype. The type() function should map built in class instances to the name of the class, while mapping mere instances and the class prototype to "Object". Explanatory examples follow.
For the Int8Array class, nativeType() works perfectly as it yields the type across class instances, the class prototype, and mere instances: nativeType(x) = "int8Array" = type(x) if x is a class instance, but nativeType(x) = "Object" = type(x) if x is a mere instance or the prototype Int8Array.prototype.
For the Boolean class, nativeType() fails to distinguish between class instances and the prototype. If x is a Boolean class instance then nativeType(x) and nativeType(Boolean.prototype) are both "Boolean". However, type() code can simply ask if x is the prototype and if so return "Object".
For the Symbol class, all class instances x are primitives with typeof(x) being "symbol", which type(x) returns. When type() sees that the native type of some element x is "Symbol", type() knows that x is either Symbol.prototype or a mere instance of Symbol, whence "Object" is returned.
The native type significantly degrades for the Quirk classes of ECMA-2015.
For the ArrayBuffer class, nativeType(x) fails to distinguish between class instances, mere instances, and the class prototype: you always get "ArrayBuffer" for the native type. The type() function can again just ask if x is the prototype to return "Object". Then we need to distinguish between class instances of ArrayBuffer and mere instances of ArrayBuffer: this is done through method testing. x.byteLength will throw an exception if x is a mere instance, in which case type() returns "Object". Otherwise type() returns "ArrayBuffer".
The other quirk classes follow a discussion similar to that for ArrayBuffer except in IE11. In IE11 the trick that works is to use method testing as before but replacing nativeType(x) with x.__proto__.constructor.name. Another near escape!
The reader is invited to investigate what type() should do for the eight error classes.
OK!  If you don't have the time and just want to enjoy the show, then read on.
The typeof() function/operator is a good start on the road to the type() function.
| Data Types Recognized by the typeof Operator | ||
|---|---|---|
| Primitive Data Type | Categorization | Test x for Membership |
| null | The literal null or variable set to such | x === null |
| undefined | The literal undefined or variable set to such | typeof(x) == "undefined" |
| boolean | The literals true, false or variable set to such | typeof(x) == "boolean" |
| number | A literal number or variable set to such | typeof(x) == "number" |
| string | A literal string or variable set to such | typeof(x) == "string" |
| BigInt | A literal BigInt or variable set to such. Or a class instance of BigInt | typeof(x) == "bigint" |
| Symbol | A class instance of Symbol | typeof(x) == "symbol" |
| Object Data Type | Categorization | Test x for Membership |
| function | A function | typeof(x) == "function" |
| object | An object | typeof(x) == "function" || typeof(x) == "object" |
The typeof operator recognizes nine data type which are all inclusive: every element must be of one of these data types. They are mutually exclusive except for function and object because the latter contains the former.
There are two object data types: object, and function, which respectively refer to the set of all objects and the set of all functions Every function is in fact an object, so function is more specified than object. With these two additions, typeof is a typing function of the nine data types: it will return the most specific of the nine data types of an element.
If x is a function then typeof(x) is "function". However, if x is an object that is not a function then typeof(x) is "object".
In ECMAScript-2009, the arcane nativeType() is a near typing of JavaScript's data types. In fact, a simple wrapper otype() around nativeType() provides full typing.
The oType(x) function gives the "original type" of its argument x, which is determined at definition of x. Nothing, including atomic explosions, or change of the internal prototype of x can change the value of oType(x).
If you want otype(x) to be "Object" when x is the argument list of a function then delete the line referencing "Arguments".
| The otype() Type Function for ECMAScript-2009 | |
|---|---|
| otype(x) | x at time of definition |
| "null" | a null |
| "undefined" | an undefined |
| "boolean" | a boolean |
| "number" | a number |
| "string" | a string |
| "Date" | a class instance of Date |
| "RegExp" | a class instance of RegExp |
| "Error" | a class instance of Error |
| "Number" | a class instance of Number |
| "String" | a class instance of String |
| "Boolean" | a class instance of Boolean |
| "Array" | a class instance of Array |
| "Arguments" | a function's argument list |
| "Function" | a function |
| "Object" |
All elements not previously categorized in this table.
The complete list of such elements follows. The items overlap.
|
For example, otype(x) is "Error" precisely when x is originally defined as an Error class instance.
A modification of a class instance of a class X may no longer be a class instance of X.
During the reign of ECMAScript-2009, nativeType() and consequently its wrapper otype() were immutable, meaning that there was nothing one could do to change the value of nativeType(x) or otype(x) for any element x.
We want to modify otype() so that it respects proper casting: see Proper Casting. If x is a built in class instance then the only proper cast of x is x.__proto__ = Object.prototype. This cast is easy to detect and so ctype() is a barely visible modification of otype().
If you want ctype(x) to be "Object" when x is the argument list of a function then delete the line referencing "Arguments".
| The ctype() Type Function for ECMAScript-2009 | |
|---|---|
| ctype(x) | x |
| "null" | a null |
| "undefined" | an undefined |
| "boolean" | a boolean |
| "number" | a number |
| "string" | a string |
| "Date" | a class instance of Date |
| "RegExp" | a class instance of RegExp |
| "Error" | a class instance of Error |
| "Number" | a class instance of Number |
| "String" | a class instance of String |
| "Boolean" | a class instance of Boolean |
| "Array" | a class instance of Array |
| "Arguments" | a function's argument list |
| "Function" | a function |
| "Object" | All elements not previously categorized in this table.
The complete list of such elements follows.
|
As noted, ctype() respects (proper) casting. For example, if x = new Boolean(true) and x is cast to Object, then ctype(x) is "Object". If instead x were cast to Number then ctype(x) does not become "Number" nor is it required to do so since the cast is improper. No programmer ever has the rational to make an improper cast because doing so always results in a broken instance. ctype() has every right to do whatever it wants with improper casting. What ctype() actually does is to simply ignore improper casting. So the ctype of a Boolean cast to Number remains "Boolean".
Warning: otype() and ctype() are created for ECMA-2009. You can still use them today but must be aware that both will return erroneous information, in a browser specific way, for instances and prototypes of the ECMA-2015 quirk classes.
For example even today, the test ctype(x) == "String" is a valid detection test for Strings, and the test ctype(x) == "Int8Array" is a valid detection test for Int8Arrays even though Int8Array is a ECMA-2015 class.
However, the test test ctype(x) == "Set" is not a valid detection set for Sets, because Set is a quirks class. For instance, in Firefox if x is Object.create(Object.create(Set.prototype)) then ctype(x) is "Set" even though x is not a class instance of Set.
Impress your friends. Ask them how to test if an element x is a String.
They will surely tell you to use the instanceof operator. You can then amaze them by telling them that
they are dead wrong. You can then doubly amaze them by telling them that they will never find a correct test.
Look at the isKlass() functions in typing.js
and in particular look at the isString() function for the very best test for detecting a String
class instance.
By now the reader knows that a String and a class instance of String are synonymous. Also by now the reader knows the expression x instanceof String is useless because if it evaluates to true all you know is that x derives from String.prototype. For example x instanceof String evaluates to true if x is Object.create(Object.create(String.prototype)), which certainly isn't a String. Here x is two degrees from String.prototype.
Closely examining the isKlass() functions, the Native Types table, and the QuirksInstance object which provides method testing for detection of class instances of the quirks classes, should help prepare you for the next section.
ECMA-2015 adds quite a number of new built in classes. If the native type was handled as it was in ECMA-2009, then the ctype() function or a mild modification of it would work out of the box to provide full typing. However, instead the typing capabilities of the native type were so seriously degraded we end up with a somewhat complicated typing function, even though it is short.
Lines 2 and 3 return the recognized types of the primitives. It is a mistake by JavaScript that typeof(null) is "object" because null is a primitive, not an object. Thus we have to set the type of null to "null" by hand. Also of particular note, if x is a class instance of Symbol or BigInt then x is a primitive and "symbol" and "bigint" are respectively returned.
Starting on line 4 we know x is an object. If JavaScript had not engaged is so much ad-hoc randomness, we would just be able to return the native type.
On line 5, "Arguments" is returned if x is the argument list of a function. If instead you prefer "Object" to be returned then delete line 5.
Lines 6-8 checks for special cases where "Object" should be returned. The native type often does not distinguish between a class instance and the prototype: so if x is the prototype, "Object" is returned. Next if x has been cast to Object.prototype the cast is respected by returning "Object". If the __proto__ attribute is undefined then x is a null object and "Object" is returned. Now if the native type is "BigInt" or "Symbol" then x is an instance of BigInt or Symbol but not a class instance, whence "Object" is returned.
For lines 9 and 10, if the native type is "Error" then necessarily x is a class instance or the prototype of one of the following classes: Error, EvalError, InternalError, RangeError, ReferenceError, SyntaxError, TypeError, or URIError. If x is a prototype return "Object". Otherwise return the name of the class as determined by the name of the constructor.
Consider line 11 outside IE11. If QuirksInstance[t] is defined then the nativeType t corresponds to a quirk class, say Set. For Set, class instances, mere instances, and the prototype all have "Set" as the native type. The possibility that x is Set.prototype was weeded out on line 6. The method test QuirksInstance["Set"](x) returns true if x is a class instance of Set but false is x is a mere instance of Set. Thus line 11 returns "Set" or "Object" depending on whether x is a class instance or a mere instance. This discussion applies to the other quirk classes including ArrayBuffer.
Consider IE11. All possibilities for the quirks class ArrayBuffer have been taken care of on lines 6 and 11 as the nativeType works with ArrayBuffer like it does with the other browsers. Let's take a look at the quirk class Set. Class instances of Set, mere instances of Set, and Set.prototype all have native type "Object". If x is Set.prototype then code falls through line 13 so that "Object" is returned on line 14. If x is a Set class instance then ct is "Set", and on line 13 x passes the method test so ct = "Set" is returned. If x is a mere Set instance then either method testing fails on line 13 and "Object" is returned or code falls through line 13 and "Object" is returned on line 14.
Oh by the way! Line 11 can be deleted. Can you figure out why?
By direct coding of the type() function we mean that no prototyping is involved. For other direct ways of coding type() see Other Ways to Code type(). Direct ways are necessarily complicated because the native type behaves so badly in EMCA-2015. Do this and do that, test this and test that, and yada yada yada it's a Boolean. Typing built in class instances is too slow. By prototyping, most of the complexities go away, while Booleans, ArrayBuffers and the other built in class instances are quickly recognized as are the other objects derived from the built in class prototypes. Host objects are also quickly typed. So the whole world is quickly typed.
We for example don't create a Boolean.prototype.type() function because the name type could easily conflict with other libraries. Instead we prototype a Symbol. The symbol is typeSymbol = Symbol("type") and Boolean.prototype[typeSymbol]() is the function that types all objects derived from Boolean.prototype. Do this for all the other built in classes. Then the type() function will wrap all the prototyped versions.
The type() function is then especially simple.
Let's now see how prototyping typeSymbol goes with some examples.
Simply refer to the native type table for Booleans to get the following code.
nativeType() types correctly for mere instances and class instances of the Boolean class. However, nativeType() incorrectly types Boolean.prototype.
nativeType() correctly types RegExp.prototype, class instances of RegExp and mere instances of RegExp.
nativeType() incorrectly types URIError.prototype. An instance of URIError is a class instance of URIError precisely when the native type is "Error".
Return "bigint" precisely when a primitive. Otherwise, its an object and "Object" is returned.
The native type incorrectly types Map.prototype. The native type also incorrectly types class instances and mere instances. So we method test. An exception is thrown precisely when a mere instance.
The default implementation of typeSymbol. It does the right thing for host objects, and the remaining standard objects that don't derive from a built in class prototype.
Here the user is the programmer.
The userType() function is basically equivalent to the type() function. Here's the comparison. The call userType(x) will insure proper user/programmer defined data types are returned if found. Otherwise the calls userType(x) and type(x) return the same value.
A proper class/constructor is a class Klass for which Klass.prototype.constructor is Klass. A proper prototype is a prototype P for which P = P.constructor.prototype.
User defined derived classes tend not to be proper because the programmer usually doesn't bother to correctly set the constructor.
If the programmer doesn't bother to make some user class Klass proper by setting Klass.prototype.constructor = Klass, then some code in our library may not work as the programmer expects. Basically, improper classes are ignored.
In the next article we show how to decorate the userType() function to give more information suitable for use in stringify(x) which dumps the object x.
The problem with erroneous foobar class instance detection is not quite as bad as it sounds. For example let x = new foobar(...) and y = Object.create(foobar.prototype). Both x and y are instances of foobar one degree from foobar.prototype. However, there is no test that can determine that x is a foobar class instance and that y is not a foobar class instance. So both are reported as foobar class instances with a reporting error for y.
Now chances are that y will come from the class derivation process as in y = foobar.prototype = Object.create(foo.prototype) and where foobar.prototype.constructor is set to foobar. Then type(y) is "Object" and there is no reporting error.
Also y might be turned into an actual foobar class instance via foobar.call(y,...) in which case there is no reporting error for y.
If y = Object.create(foobar.prototype) is just left dangling, there may not be much use for y so with common programming practices, chances are there will be no reporting error because y wouldn't be created in such a way in the first place.
In summary, if foobar() is a proper programmer defined class then userType(z) returns "foobar" precisely when z is an instance of foobar one degree away from foobar.prototype, and z itself is not a proper prototype.
The host objects are window, document and the HTML elements, which are links, metas, scripts, styles, divs, ..., as seen by JavaScript. For example, as seen by JavaScript, a div is a class instance of HTMLDiv.
Now here's a warning that probably isn't necessary. We are not interested in ever examining the prototypes, derivations, or properties, of the top level host objects, and it's assumed the programmer will never apply isHostObject() to such objects.
The main problem with typing such objects mostly resides with IE11 where constructors of host objects are not functions. There are other browser inconsistencies that make typing such exotic objects problematical.
Be sure to look at the isKlass() functions at the end of typing.js. For any specified built in class Klass, an element x is a class instance of Klass precisely when isKlass(x) evaluates to true. We just give a few examples.
Our type() function respects proper casting of one class to another. Examples of proper casting follow.
The above two points list all possible proper casts between built in classes. Any other cast between classes must be sidewise, and therefore improper since it results in a broken object. For example if the Boolean class instance x = new Boolean(true) is cast to Number via x.__proto__ = Number.prototype then x is a broken Number.
No programmer ever has the rational to make an improper cast because doing so always results in a broken instance. Therefore the type() function can return whatever it wants with an object that has been improperly cast.
Let's go back in time to ECMAScript-2009, the version previous to ECMAScript-2015. The native type then was a great useful concept.
In the general version of EMCA, the only way to change the native type of an element is to cast the element. So immutability of the native type is equivalent to invariance of the native type with respect to casting.
It is very clear that prior to ECMAScript-2015, immutability of the native type was an iron clad principle made by intentional design. Either that, or the JavaScript committee enforced, in a comprehensive and consistent way across the full gamut of possibilities, something completely by dumb luck.
Immutability of the native type allows a typing function to detect improper casts and throw exceptions on such. In ECMAScript-2015, the native type is no longer immutable.
The great thing about ECMAScript-2009 was that the native type distinguished between class instances of Klass and mere instances of Klass where Klass is a built in class. The native type of the former is "Klass" while the native type of the latter is "Object". This is no longer true in ECMAScript-2015, where the native type behaves in an random ad-hoc manner.
Let's set straight some common misconceptions about objects. By definition an object is any element that is not a primitive. Small object is not a concept that derives from large Object in any way: These two concepts are very independent.
There is no Object class. The Object function, even though used with operator new, is not a constructor and in fact is both wacky and nearly useless.
Object certainly violates the internal prototype rule required of constructors, which says that when called with new the constructor must set the internal prototype of the return object to the functions prototype. It also often copies its argument rather than return a newly created object. Thus there is no class associated with the Object function: That's right, there is no Object class! Those who think/say otherwise ignore well established semantics on what it means to be a class in JavaScript.
The best one can do is to think of Object as a broken/quasi/pseudo/etc class. The only thing truly useful about Object is its prototype from which so many objects derive, and therefore inherit the many properties/methods of Object.prototype. JavaScript could easily have hidden or eliminated Object and exposed only its prototype. To maintain patterns involving class inheritance, JavaScript wanted Object.prototype to in fact be a prototype and so had to invent the Object function as a placeholder for an actual constructor.
So what does x instanceof Object mean? It means the same thing as if Object were any other function used as a constructor or not. It means that x derives from Object.prototype and nothing more. Even with a direct derivation where x.__proto__ is Object.prototype, x can not be a member of the non existing Object class.
There are objects that do not derive from Object.prototype: for example a null object such as Object.create(null). The set of all objects is partitioned into the standard objects and the null objects. The standard objects are Object.protoype and all objects deriving from it. The null objects are the objects neither being Object.prototype nor deriving from it.
It follows that x instanceof Object is not a test for x being an object. It fails for null objects x, and it fails for x = Object.prototype the most important object of all. However, it is a valid test for x being a standard object not equal to Object.prototype.
Meouzer says no, well maybe, and there might be one, but there isn't.
Line 3 says there might be an Arguments class. As a proto class it would be given by Arguments in line 4. However, line 5 says as proto classes any Arguments class is the same as Object.prototype. So there's not much new under the sun.
Since arguments derives directly from Object.prototype, it behaves similarly to a literal object with some dressing on it.


Injuries reported in rollover crash in town of Dane, dispatch says
by Logan RudeDANE, Wis. - A two-vehicle crash in the town of Dane has left an unknown number of people injured, according to Dane County dispatch.
Officials said a call for a crash at 6354 County Highway DM came in at 12:25 p.m.
One vehicle flipped in the crash, according to dispatch. Officials said the exact number of injuries is unclear.
Town of Dane firefighters and Lodi emergency medical services responded to the scene.


Summoner Basillia
Greetings, traveler. I am Basillia, a Summoner in the Ivory Tower. Good to see you.
This area is where I was born... I've been gone for thirty years and everything looks very different now. All that is here now are the scars left by the war with Gracia... The beautiful town of my childhood is all gone...
Quest


Log In
Sign Up
Login on QuickEvents
Email or UserName
Password
Forgot password?
Sign Up on QuickEvents
Email
User name
Password
Confirm Password


Age Verification
You must be 21 years or older to enter The Vapour Lounge.
Please confirm your age below.
In accordance with San Francisco municipal code, we are no longer able to ship orders to any San Francisco addresses. Any orders shipping to San Francisco will be automatically refunded. We apologize for the inconvenience.
By confirming that you are 21 or you are also consenting to our Terms & Conditions


A strong ability to problem solve which I have been constantly working on. In my current job, I have had the opportunity to participate in training sessions. Applying it is the tricky part, I have had to facilitate multiple problem solves and also review problem solves from other teams sent through to mine. My attention span can be quite limited when it comes to study. I have always had this problem with study so is something I need to work on.
I have set aside time, including time to rest/relax meaning I will be able to commit to this program. There will be weeks where I may fall a little behind but I do have this mapped out on my planner giving me time to catch up.
First resource to use is google. If that does not yield results, then I will use the foundation channel on slack or get into contact with my facilitator Ollie. Obviously move on to next section whilst waiting for a reply.
Somewhere I can go for help. Doesn’t have to give me the answer but can direct me to where the possible solutions can be found. Instead of a teacher, my expectation is that they mentor me so that I can do things for myself.
During foundations I will have no time for study on my roster days on. I work 12 hour shifts; need to rest and carry out life admin activities.
I am hoping to transition to a career in Web Development. I would like to be a great Web developer and also possibly even in design.
Yes, definitely not that great of a problem solver. But the rest hasn’t changed. I have found some motivation and the ability to get stuck into it when this course is my sole focus.
I should be able to keep on top of the material as I don’t really have any other commitments during this time. May have to do some work for my job at certain stages. I am quite use to working in teams and speaking in front of large groups but since this is a different environment it could be a challenge.
Development communication skills between others, not just the people I can easily get along with. Would be good to also develop leadership skills and influencing skills.
Provide great answers and deliver the material so that I can learn and get the best of this course. I don’t expect 24/7 response rates but would like responses to queries in a timely manner.
Contact the person via email/slack and arrange a meeting if required. I will set a weekly reflection of learning plan day on sat/sun. This will review what I’ve done and what I need to catch up on. If there is anything to catch up on, then put it in my schedule for the following few days.


TweetMap lets you easily embed
a live map on your site,
showing the latest tweets you want,
filtered by hashtags or usernames.
TweetMap lets you easily embed
a live map on your site,
showing the latest tweets you want,
filtered by hashtags or usernames.


THE CHROMIUM-OXYGEN-HYDROGEN EQUILIBRIUM IN LIQUID IRON
By
HSIN-MIN CHEN B. S., National Tsinghua University
1935
Submitted in Partial Fulfillment of the Requirements for the Degree of DOCTOR OF SCIENCE from the Massachusetts Institute of Technology
1945
Signature of Author Department of Metallurgy June 4, 1945 _
Signature of Professor in Charge of Research
' Signature of Chairman Department Committee on Graduate Students


This page is used to demonstrate the use of lunr with an index generated with mvw-search-index.
Use npm run serve
to rebuild the index.json
and serve this page.
class="to-be-indexed"
specified in the
command generating index.json
defined in the package.json
. This unique term is hence not
to be found: NotToBeFound.


I am equipped with wide variety of skills and experiences which can be beneficial for any type of businesses. I derive intelligence from raw data and build predictive models to help business owners make informed decisions. The followings are some of my past projects:


This demo shows how to use the NgbScrollSpyService.
NgbScrollSpyService
Highlights current example on this page:


Blog:
10/5/14
Arrays and Hashes
Arrays and hashes are both collections of objects. Arrays are simply a ordered list of objects. They are created by listing objects seperated by commas inside square brackets. For example an array of numbers:
numbers = [1, 2, 3]
Anything can be made into an array:
animals = [duck, cat, moose]
Arrays are integer indexed starting at 0. animals[1]
would return the second animal on our list cat
. animals[-1]
would return moose
as ther list loops into itself.
Hashes are also a way to organize objects. They do it a little differently though. Hashes are made up of key-value pairs. The indexing is done with created keys instead of integers. Hashes are made using curly brackets:
animals = {type => cat}
The keys and values can be anything you want.
animals = {type: "cat",
color: "black",
fur => "long"
}
Values in hashes can be called by refrencing the key:
animals[:color] => "black"


--- layout: archive title: Zulip Chat Archive permalink: /stream/113489-new-members/topic/cannot.20reduce.20.20application.20in.20pattern.20match.html ---
I'm trying to fill in the sorry
in the code below with h x
. I expect this to work but it says that
26:23: equation type mismatch, term h x has type f x = g x but is expected to have type k x st.s = k x st.t
even though I define k x st.s =def= f x
and k x st.t =def= g x
code:
universe ℓ universe ℓ' inductive st : Type | s : st | t : st inductive R : st → st → Type | r : R st.s st.t def fex {A : Type ℓ} {B : A → Type ℓ'} {f g : Π (x : A) , B x} (h : Π (x : A) , f x = g x) : ------------------------- (A → A) := have k : Π (x : A) (_ : st) , B x, from λ x h , match h with | st.s := f x | st.t := g x end, have l : Π (x : A)(b b' : st)(_ : R b b') , k x b = k x b', from λ x b b' r' , match b, b', r' with st.s, st.t, R.r := sorry -- h x end, show A → A, from λ x , x
Can someone tell me why it's not reducing?
use let
instead of have
okay, now I get a message saying I need to use set_option eqn_compiler.zeta true
and then it works fine
{% endraw %}Last updated: Apr 24 2020 at 19:02 UTC


Contents
- Add dependencies and download the data.
- Data overview.
- Call GLMestimatesingletrial with default parameters.
- Important outputs.
- Plot a slice of brain with GLMsingle outputs.
- Run a standard GLM.
- Compare GLMs.
- Calculate voxel split-half reliability.
- Plot split-half reliability.
- Compare visual voxel reliabilities between beta versions.
Add dependencies and download the data.
% Add path to GLMsingle addpath('./../') addpath(genpath('./../utilities')) % You also need fracridge repository to run this code % https://github.com/nrdg/fracridge.git % addpath('fracridge') clear clc close all outputdir = 'example1outputs'; % Download files to data directory if ~exist('./data','dir') mkdir('data') end if ~exist('./data/nsdcoreexampledataset.mat','file') % download data with curl system('curl -L --output ./data/nsdcoreexampledataset.mat https://osf.io/k89b2/download') end load('./data/nsdcoreexampledataset.mat') % Data comes from subject1, NSD01 session from NSD dataset. % https://www.biorxiv.org/content/10.1101/2<IP_ADDRESS>2340v1.full.pdf
Data overview.
clc whos % data -> consists of several runs of 4D volume files (x,y,z,t) where % (t)ime is the 4th dimention. In this example data consists of only a % single slice and has been prepared with a TR = 1s % ROI -> manually defined region in the occipital cortex. It is a binary % matrix where (x,y,z) = 1 corresponds to the cortical area that responded % to visual stimuli used in the NSD project. fprintf('There are %d runs in total.\n',length(design)); fprintf('The dimensions of the data for the first run are %s.\n',mat2str(size(data{1}))); fprintf('The stimulus duration is %.6f seconds.\n',stimdur); fprintf('The sampling rate (TR) is %.6f seconds.\n',tr);
Name Size Bytes Class Attributes ROI 145x186 215760 double data 1x12 388369344 cell design 1x12 69408 cell outputdir 1x15 30 char stimdur 1x1 8 double tr 1x1 8 double There are 12 runs in total. The dimensions of the data for the first run are [145 186 1 300]. The stimulus duration is 3.000000 seconds. The sampling rate (TR) is 1.000000 seconds.
figure(1);clf %Show example design matrix. for d = 1 imagesc(design{d}); colormap gray; drawnow xlabel('Conditions') ylabel('TRs') title(sprintf('Design matrix for run%i',d)) axis image end xticks(0:53:length(design{d})) set(gcf,'Position',[418 412 782 605])
% design -> Each run has a corresponding design matrix where each column % describes a single condition (conditions are repeated across runs). Each % design matrix is binary with 1 specfing the time (TR) when the stimulus % is presented on the screen. % In this NSD scan session there were 583 distinct images shown and hence % there are 583 predictor columns/conditions. Notice that white rectangles % are pseudo randomized and they indicate when the presentaion of each % image occurs. Note that in some runs not all images are shown, if a % column does not have a white rectangle it means that this image is % shown in a different run.
% Show an example slice of the first fMRI volume. figure(2);clf imagesc(data{1}(:,:,:,1)); colormap(gray); axis equal tight; c=colorbar; title('fMRI data (first volume)'); set(gcf,'Position',[418 412 782 605]) axis off c.Label.String = 'T2*w intensity'; set(gca,'FontSize',15)
Call GLMestimatesingletrial with default parameters.
% Outputs and figures will be stored in a folder (you can specify it's name % as the 5th output to GLMestimatesingletrial. Model estimates can be also % saved to the results variable which is the only output of % GLMestimatesingletrial % Optional parameters below can be assigned to a strucutre i.e % opt = struct('wantlibrary',1,'wantglmdenoise',1); Options are the 6th % input to GLMestimatesingletrial. % DEFAULT OPTIONS: % wantlibrary = 1 -> Fit HRF to each voxel % wantglmdenoise = 1 -> Use GLMdenoise % wantfracridge = 1 -> Use ridge regression to improve beta estimates % chunknum = 50000 -> is the number of voxels that we will process at the % same time. For setups with lower memory deacrease this number. % % wantmemoryoutputs is a logical vector [A B C D] indicating which of the % four model types to return in the output <results>. The user must be % careful with this, as large datasets can require a lot of RAM. If you % do not request the various model types, they will be cleared from % memory (but still potentially saved to disk). % Default: [0 0 0 1] which means return only the final type-D model. % wantfileoutputs is a logical vector [A B C D] indicating which of the % four model types to save to disk (assuming that they are computed). % A = 0/1 for saving the results of the ONOFF model % B = 0/1 for saving the results of the FITHRF model % C = 0/1 for saving the results of the FITHRF_GLMdenoise model % D = 0/1 for saving the results of the FITHRF_GLMdenoise_RR model % Default: [1 1 1 1] which means save all computed results to disk. % numpcstotry (optional) is a non-negative integer indicating the maximum % number of PCs to enter into the model. Default: 10. % fracs (optional) is a vector of fractions that are greater than 0 % and less than or equal to 1. We automatically sort in descending % order and ensure the fractions are unique. These fractions indicate % the regularization levels to evaluate using fractional ridge % regression (fracridge) and cross-validation. Default: % fliplr(.05:.05:1). A special case is when <fracs> is specified as a % single scalar value. In this case, cross-validation is NOT performed % for the type-D model, and we instead blindly use the supplied % fractional value for the type-D model. % For the purpose of this example we will keep all outputs in the memory. opt = struct('wantmemoryoutputs',[1 1 1 1]); if ~exist([outputdir '/GLMsingle'],'dir') [results] = GLMestimatesingletrial(design,data,stimdur,tr,[outputdir '/GLMsingle'],opt); % We assign outputs of GLMestimatesingletrial to "models" structure. Note % that results{1} contains GLM estimates from an ONOFF model, where % all images are treated as the same condition. These estimates could be % potentially used to find cortical areas that respond to visual % stimuli. We want to compare beta weights between conditions therefore we % are not going to store the ONOFF GLM results. models.FIT_HRF = results{2}; models.FIT_HRF_GLMdenoise = results{3}; models.FIT_HRF_GLMdenoise_RR = results{4}; else results = load([outputdir '/GLMsingle/TYPEB_FITHRF.mat']); models.FIT_HRF = results; results = load([outputdir '/GLMsingle/TYPEC_FITHRF_GLMDENOISE.mat']); models.FIT_HRF_GLMdenoise = results; results = load([outputdir '/GLMsingle/TYPED_FITHRF_GLMDENOISE_RR.mat']); models.FIT_HRF_GLMdenoise_RR = results; end
Important outputs.
% R2 -> is model accuracy expressed in terms of R^2 (percentage). % modelmd -> is the full set of single-trial beta weights (X x Y x Z x % TRIALS). Beta weights are arranged in a chronological order) % HRFindex -> is the 1-index of the best fit HRF. HRFs can be recovered % with getcanonicalHRFlibrary(stimdur,tr) % FRACvalue -> is the fractional ridge regression regularization level % chosen for each voxel. Values closer to 1 mean less regularization.
Plot a slice of brain with GLMsingle outputs.
% We are going to plot several outputs from FIT_HRF_GLMdenoise_RR GLM. slice = 1; val2plot = {'modelmd';'R2';'HRFindex';'FRACvalue'}; cmaps = {cmapsign2;hot;jet;copper}; figure(3);clf for v = 1 : length(val2plot) f=subplot(2,2,v); if contains('modelmd',val2plot{v}) imagesc(nanmean(models.FIT_HRF_GLMdenoise_RR.(val2plot{v})(:,:,slice),4),[-5 5]); axis off image; title('BETA WEIGHT (averaged across conditions)') else imagesc(models.FIT_HRF_GLMdenoise_RR.(val2plot{v})(:,:,slice)); axis off image; title(val2plot{v}) end colormap(f,cmaps{v}) colorbar set(gca,'FontSize',15) end set(gcf,'Position',[418 412 782 605])
Run a standard GLM.
% Additionally, for comparison purposes we are going to run a standard GLM % without HRF fitting, GLMdenoise or ridge regression regularization. We % will change the default settings by using the "opt" structure. opt.wantlibrary = 0; % switch off HRF fitting opt.wantglmdenoise = 0; % switch off GLMdenoise opt.wantfracridge = 0; % switch off ridge regression opt.wantfileoutputs = [0 1 0 0]; opt.wantmemoryoutputs = [0 1 0 0]; % By changing the 5th argument to NaN we are not creating an output folder % with the results and figures. if ~exist([outputdir '/GLMbaseline'],'dir') [ASSUME_HRF] = GLMestimatesingletrial(design,data,stimdur,tr,[outputdir '/GLMbaseline'],opt); models.ASSUME_HRF = ASSUME_HRF{2}; else results = load([outputdir '/GLMbaseline/TYPEB_FITHRF.mat']); models.ASSUME_HRF = results; end % We assign outputs from GLMestimatesingletrial to "models" structure. % Again, results{1} contains GLM estimates from an ONOFF model so we are % not going to extract it.
% Now, "models" variable holds solutions for 4 GLM models
disp(fieldnames(models))
'FIT_HRF' 'FIT_HRF_GLMdenoise' 'FIT_HRF_GLMdenoise_RR' 'ASSUME_HRF'
Compare GLMs.
% To compare the results of different GLMs we are going to calculate the % voxel-wise split-half reliablity for each model. Reliablity index % represents a correlation between beta weights for repeated presentations % of the same stimuli. In short, we are going to check how % reliable/reproducible are single trial responses to repeated images % estimated with each GLM type. % This NSD scan session has a large number of images that are just shown % once during the session, some images that are shown twice, and a few that % are shown three times. In the code below, we are attempting to locate the % indices in the beta weight GLMsingle outputs modelmd(x,y,z,trials) that % correspond to repated images. Here we only consider stimuli that have % been repeated once. For the purpose of the example we ignore the 3rd % repetition of the stimulus. % consolidate design matrices designALL = cat(1,design{:}); % compute a vector containing 1-indexed condition numbers in chronological % order. corder = []; for p=1:size(designALL,1) if any(designALL(p,:)) corder = [corder find(designALL(p,:))]; end end
% let's take a look at the first few entries corder(1:3) % Note that [375 497 8] means that the first stimulus trial involved % presentation of the 375th condition, the second stimulus trial involved % presentation of the 497th condition, and so on.
ans = 375 497 8
% In order to compute split-half reliability, we have to do some indexing. % we want to find images with least two repetitions and then prepare a useful % matrix of indices that refer to when these occur. repindices = []; % 2 x images containing stimulus trial indices. % the first row refers to the first presentation; % the second row refers to the second presentation. for p=1:size(designALL,2) % loop over every condition temp = find(corder==p); if length(temp) >= 2 repindices = cat(2,repindices,[temp(1); temp(2)]); % note that for images with 3 presentations, we are simply ignoring the third trial end end % let's take a look at a few entries repindices(:,1:3) % Notice that the first condition is presented on the 217th stimulus trial % and the 486th stimulus trial, the second condition is presented on the % 218th and 621st stimulus trials, and so on. fprintf('There are %i repeated images in the experiment \n',length(repindices)) % Now, for each voxel we are going to correlate beta weights describing the % response to images presented for the first time with beta weights % describing the response from the repetition of the same % image. With 136 repeated images R value for each voxel will correspond % to correlation between two vectors with 136 beta weights each.
ans = 217 218 19 486 621 124 There are 136 repeated images in the experiment
Calculate voxel split-half reliability.
model_names = fieldnames(models); model_names = model_names([4 1 2 3]); % We arrange models from least to most sophisticated (for visualization % purposes) vox_reliabilities = cell(1,length(models)); % Finally, let's compute some split-half reliability. We are going to loop % through our 4 models and calculate split-half reliability for each of % them for m = 1 : length(model_names) betas = models.(model_names{m}).modelmd(:,:,:,repindices); % use indexing to pull out the trials we want betas_reshaped = reshape(betas,size(betas,1),size(betas,2),size(betas,3),2,[]); % reshape to X x Y x Z x 2 x CONDITIONS vox_reliabilities{m} = calccorrelation(betas_reshaped(:,:,:,1,:),betas_reshaped(:,:,:,2,:),5); end
Plot split-half reliability.
% For each model we plot the results of reliablity as an overlay. figure(4);clf for m = 1 : length(model_names) vox_reliability = vox_reliabilities{m}; underlay = data{1}(:,:,:,1); ROI(ROI~=1) = NaN; overlay = vox_reliability; underlay_im = cmaplookup(underlay,min(underlay(:)),max(underlay(:)),[],gray(256)); overlay_im = cmaplookup(overlay,-0.5,0.5,[],hot(256)); mask = ROI==1; subplot(2,2,m); hold on imagesc(underlay_im); imagesc(overlay_im, 'AlphaData', mask); hold off colormap hot axis image off c = colorbar; c.Label.String = 'Split-half reliability (r)'; c.Ticks = [0 0.5 1]; c.TickLabels = {'-0.5';'0';'0.5'}; set(gca,'FontSize',15) title(model_names{m},'Interpreter','None') end set(gcf,'Position',[418 412 782 605])
Compare visual voxel reliabilities between beta versions.
figure(5);clf subplot(1,2,1); cmap = [0.2314 0.6039 0.6980 0.8615 0.7890 0.2457 0.8824 0.6863 0 0.9490 0.1020 0]; % For each GLM type we calculate median reliability for voxels within the % visual ROI and plot it as a bar plot. for m = 1 : 4 bar(m,nanmedian(vox_reliabilities{m}(ROI==1)),'FaceColor','None','Linewidth',3,'EdgeColor',cmap(m,:)); hold on end ylabel('Median reliability') legend(model_names,'Interpreter','None','Location','NorthWest') set(gca,'Fontsize',16) set(gca,'TickLabelInterpreter','none') xtickangle(0) xticks([]) ylim([0.1 0.2]) set(gcf,'Position',[418 412 782 605]) title('Median voxel split-half reliability of GLM models') subplot(1,2,1); vox_reliability = vox_reliabilities{4} - vox_reliabilities{1}; underlay = data{1}(:,:,:,1); ROI(ROI~=1) = NaN; overlay = vox_reliability; underlay_im = cmaplookup(underlay,min(underlay(:)),max(underlay(:)),[],gray(256)); overlay_im = cmaplookup(overlay,-0.3,0.3,[],cmapsign2); mask = ROI==1; subplot(1,2,2); hold on imagesc(underlay_im); imagesc(overlay_im, 'AlphaData', mask); hold off axis image colormap(cmapsign2) c = colorbar; c.Ticks = [0 0.5 1]; c.TickLabels = {'-0.3';'0';'0.3'}; title('change in nsdgeneral voxel reliability due to GLMsingle (r)') xlabel('plotting (FITHRF_GLMDENOISE_RR - ASSUMEHRF) reliabilities','Interpreter','none'); xticks([]) yticks([]) set(gca,'Fontsize',16) set(gcf,'Position',[36 343 1116 674])


Our Smart Thermostats keep your room between a comfortable temperature range and detect your presence for optimal comfort. No more waking up cold or sweating.
Total control of your room’s thermostat anywhere, anytime with the mobile app. With GPS enabled your room will adjust to your desired temperature quickly before arrival.
We like to tout comfort and convenience but we also like guests to be aware of the good they’re doing to help reduce energy waste. Every bit makes a difference!


{% extends 'main/base.html' %}
{% load staticfiles %}
{% block title %}Page not found!{% endblock %}
{% block navbar %}
{% endblock %}
{% block main %}
Uh oh! Something went wrong.
We encountered an internal server error, but don't worry. Head over to Github
and create an
issue describing the things you did which led to this error. We will fix it as soon as
possible.


Knowledge Graph Generator
Select domain:
Construction
Processes
Choose file:
Convert
Data converted successfully!


User Id is required
Password is required
User not exist
User name is required
Please give email in currect format
Minimum length 8
Confirm Password is required
Password Mismatch


JavaScript is disabled on your browser.
Skip navigation links
Overview
Package
Class
Use
Tree
Deprecated
Index
Help
Prev Letter
Next Letter
Frames
No Frames
All Classes
A
B
C
D
E
F
G
I
J
L
M
P
R
S
T
U
S
service
- Variable in class com.gcu.business.
BookBusinessService
service
- Variable in class com.gcu.business.
UserBusinessService
service
- Variable in class com.gcu.controllers.
ProductController
setAppId(int)
- Method in class com.gcu.models.
BookModel
setAuthor(String)
- Method in class com.gcu.models.
BookModel
setDataBusinessInterface(DataBusinessInterface<BookModel>)
- Method in class com.gcu.controllers.
ProductController
setDataInterface(DataInterface<BookModel>)
- Method in class com.gcu.business.
BookBusinessService
setDataSource(DataSource)
- Method in class com.gcu.data.
BookService
setDataSource(DataSource)
- Method in class com.gcu.data.
DataAccessObject
setEmail(String)
- Method in class com.gcu.models.
LoginCModel
setEmail(String)
- Method in class com.gcu.models.
UserModel
setFirstName(String)
- Method in class com.gcu.models.
UserModel
setISBN(String)
- Method in class com.gcu.models.
BookModel
setLastName(String)
- Method in class com.gcu.models.
UserModel
setMiddleInitial(String)
- Method in class com.gcu.models.
UserModel
setPassword(String)
- Method in class com.gcu.models.
LoginCModel
setPassword(String)
- Method in class com.gcu.models.
UserModel
setPasswordConfirmation(String)
- Method in class com.gcu.models.
RegisterUserModel
setPublisher(String)
- Method in class com.gcu.models.
BookModel
setTitle(String)
- Method in class com.gcu.models.
BookModel
setUserBusinessInterface(UserBusinessInterface)
- Method in class com.gcu.controllers.
UserController
setUserDataInterface(UserDataInterface)
- Method in class com.gcu.business.
UserBusinessService
setUsername(String)
- Method in class com.gcu.models.
UserModel
showUpdateUserForm(int, Model)
- Method in class com.gcu.controllers.
ProductController
A
B
C
D
E
F
G
I
J
L
M
P
R
S
T
U
Skip navigation links
Overview
Package
Class
Use
Tree
Deprecated
Index
Help
Prev Letter
Next Letter
Frames
No Frames
All Classes


Free and Open Source Software Community of Sri Lanka Institute of Information Technology..!
Learn more


Each time the frog plays, a number will be played shortly after. You then have to press that number, either on-screen, with the numbers across your keyboard from 1-9 or using the number pad to the right side of your keyboard however, fly noises will randomly play and a fly will fly across your screen. You get 2 points for hitting the frog and 1 for missing or leaving it too long. You get anywhere from 2 to 4 seconds, depending on the mode you choose and in the extra hard and extremely hard modes you have to whack the last number to play.
Back


Update your film
Home
add a film
update
Movie list
Movie name
Movie genre
Movie Rating
Director
release_date
Submit


Return to my programming portfolio.
Learn more about me.
Explore my skills and hobbies.
Reach out and contact me.
My resume will be coming to this page soon. For now, view my resume previously coded and published on GitHub Pages.


function [x,f,info] = lbfgsb( fcn, l, u, opts ) % x = lbfgsb( fcn, l, u ) % uses the lbfgsb v.3.0 library (fortran files must be installed; % see compile_mex.m ) which is the L-BFGS-B algorithm. % The algorithm is similar to the L-BFGS quasi-Newton algorithm, % but also handles bound constraints via an active-set type iteration. % % The minimization problem that is solves is: % min_x f(x) subject to l <= x <= u % % 'fcn' is a function handle that accepts an input, 'x', % and returns two outputs, 'f' (function value), and 'g' (function gradient). % % 'l' and 'u' are column-vectors of constraints. Set their values to Inf % if you want to ignore them. (You can set some values to Inf, but keep % others enforced). % % The full format of the function is: % [x,f,info] = lbfgsb( fcn, l, u, opts ) % where the output 'f' has the value of the function f at the final iterate % and 'info' is a structure with useful information % (self-explanatory, except for info.err. The first column of info.err % is the history of the function values f, and the second column % is the history of norm( gradient, Inf ). ) % % The 'opts' structure allows you to pass further options. % Possible field name values: % % opts.x0 The starting value (default: all zeros) % opts.m Number of limited-memory vectors to use in the algorithm % Try 3 <= m <= 20. (default: 5 ) % opts.factr Tolerance setting (see this source code for more info) % (default: 1e7 ). This is later multiplied by machine epsilon % opts.pgtol Another tolerance setting, relating to norm(gradient,Inf) % (default: 1e-5) % opts.maxits How many iterations to allow (default: 100) % opts.maxTotalIts How many iterations to allow, including linesearch iterations % (default: 5000) % opts.printEvery How often to display information (default: 1) % opts.errFcn A function handle (or cell array of several function handles) % that computes whatever you want. The output will be printed % to the screen every 'printEvery' iterations. (default: [] ) % opts.outputFcn Similar to 'errFcn', but will save the output to % the info.err variable. % % Stephen Becker<EMAIL_ADDRESS>% Feb 14, 2012 error(nargchk(3, 4, nargin, 'struct')) if nargin < 4, opts = struct([]); end % Matlab doesn't let you use the .name convention with structures % if they are empty, so in that case, make the structure non-empty: if isempty(opts), opts=struct('a',1) ; end function out = setOpts( field, default, mn, mx ) if ~isfield( opts, field ) opts.(field) = default; end out = opts.(field); if nargin >= 3 && ~isempty(mn) && any(out < mn), error('Value is too small'); end if nargin >= 4 && ~isempty(mx) && any(out > mx), error('Value is too large'); end opts = rmfield( opts, field ); % so we can do a check later end % [f,g] = callF( x ); if iscell(fcn) % the user has given us separate functions to compute % f (function) and g (gradient) callF = @(x) fminunc_wrapper(x,fcn{1},fcn{2} ); else callF = fcn; end n = length(l); if length(u) ~= length(l), error('l and u must be same length'); end x0 = setOpts( 'x0', zeros(n,1) ); x = x0 + 0; % important: we want Matlab to make a copy of this. % 'x' will be modified in-place if size(x0,2) ~= 1, error('x0 must be a column vector'); end if size(l,2) ~= 1, error('l must be a column vector'); end if size(u,2) ~= 1, error('u must be a column vector'); end if size(x,1) ~= n, error('x0 and l have mismatchig sizes'); end if size(u,1) ~= n, error('u and l have mismatchig sizes'); end % Number of L-BFGS memory vectors % From the fortran driver file: % "Values of m < 3 are not recommended, and % large values of m can result in excessive computing time. % The range 3 <= m <= 20 is recommended. " m = setOpts( 'm', 5, 0 ); % 'nbd' is 0 if no bounds, 1 if lower bound only, % 2 if both upper and lower bounds, and 3 if upper bound only. % This .m file assumes l=-Inf and u=+Inf imply that there are no constraints. % So, convert this to the fortran convention: nbd = isfinite(l) + isfinite(u) + 2*isinf(l).*isfinite(u); % Some scalar settings, "factr" and "pgtol" % Their descriptions, from the fortran file: % factr is a DOUBLE PRECISION variable that must be set by the user. % It is a tolerance in the termination test for the algorithm. % The iteration will stop when % % (f^k - f^{k+1})/max{|f^k|,|f^{k+1}|,1} <= factr*epsmch % % where epsmch is the machine precision which is automatically % generated by the code. Typical values for factr on a computer % with 15 digits of accuracy in double precision are: % factr=1.d+12 for low accuracy; % 1.d+7 for moderate accuracy; % 1.d+1 for extremely high accuracy. % The user can suppress this termination test by setting factr=0. factr = setOpts( 'factr', 1e7 ); % pgtol is a double precision variable. % On entry pgtol >= 0 is specified by the user. The iteration % will stop when % % max{|proj g_i | i = 1, ..., n} <= pgtol % % where pg_i is the ith component of the projected gradient. % The user can suppress this termination test by setting pgtol=0. pgtol = setOpts( 'pgtol', 1e-5 ); % Maximum number of outer iterations maxIts = setOpts( 'maxIts', 100, 1 ); % Maximum number of total iterations % (this includes the line search steps ) maxTotalIts = setOpts( 'maxTotalIts', 5e3 ); % Print out information this often: printEvery = setOpts( 'printEvery', 1 ); errFcn = setOpts( 'errFcn', [] ); outputFcn = setOpts( 'outputFcn', [] ); width = 0; if iscell( outputFcn ), width = length(outputFcn); elseif ~isempty(outputFcn), width = 1; end width = width + 2; % include fcn and norm(grad) as well err = zeros( maxIts, width ); % Make the work arrays wa = ones(2*m*n + 5*n + 11*m*m + 8*m,1); iwa = ones(3*n,1,'int32'); task = 'START'; iprint = 0; csave = ''; lsave = zeros(4,1); isave = zeros(44,1, 'int32'); dsave = zeros(29,1); f = 0; g = zeros(n,1); outer_count = 0; for k = 1:maxTotalIts % Call the mex file. The way it works is that you call it, % then it returns a "task". If that task starts with 'FG', % it means it is requesting you to compute the function and gradient, % and then call the function again. % If it is 'NEW_X', it means it has completed one full iteration. [f, task, csave, lsave, isave, dsave] = ... lbfgsb_wrapper( m, x, l, u, nbd, f, g, factr, pgtol, wa, iwa, task,iprint,... csave, lsave, isave, dsave ); task = deblank(task(1:60)); % this is critical! %otherwise, fortran interprets the string incorrectly if 1 == strfind( task, 'FG' ) % L-BFGS-B requests that we compute the gradient and function value [f,g] = callF( x ); elseif 1 == strfind( task, 'NEW_X' ) outer_count = outer_count + 1; % Display information if requested if ~mod( outer_count, printEvery ) fprintf('Iteration %4d, f = %5.2e, ||g||_inf = %5.2e', ... outer_count, f, norm(g,Inf) ); if isa( errFcn, 'function_handle' ) fprintf('; error %.2e', errFcn(x) ); elseif iscell( errFcn ) for j = 1:length(errFcn) fprintf('; err %.2e', errFcn{j}(x) ); end end fprintf('\n'); end err(outer_count,1) = f; err(outer_count,2) = norm(g,Inf); % Record information for the output, if requested % e.g. outputFcn = errFcn if isa( outputFcn, 'function_handle' ) err(outer_count,3) = outputFcn(x); elseif iscell( outputFcn ) for j = 1:length(outputFcn) err(outer_count,k+2) = outputFcn{j}(x); end end else break; end end info.err = err(1:outer_count,:); info.iterations = outer_count; info.totalIterations = k; info.lbfgs_message1 = task; info.lbfgs_message2 = csave; info.g = g; end % end of main function function [f,g] = fminunc_wrapper(x,F,G) % [f,g] = fminunc_wrapper( x, F, G ) % for use with Matlab's "fminunc" f = F(x); if nargin > 2 && nargout > 1 g = G(x); end end
Error using ==> lbfgsb at 52 Not enough input arguments.


Planning a trip to Brazil this fall! What are the best options for authentic restaurants in Rio de Janeiro?
Likes:
Cabin 9079 was a good cabin. It was just big enough for us, a family of 3. We liked the port hole so that we could see outside and then every now and then a character would go across the screen. There was a King sized bed with 2 night stands. There was a couch and above it was a pull down bed for our daughter to sleep each night. It was put up each morning and pulled down each night. There was plenty of storage areas! Even under the bed!! Our daughter loved the storage chest, she used it for her personal things. We liked that it had the pull curtain to separate our bed from the other part of the room. The TV moved, but was only watchable for our daughter because of the layout of the room. There was 2 bathroom areas. This was neat. We didn't like where the light switch was for them tho. Our room was kept clean the whole stay and that's a huge plus for us!! The King Bed was Very Comfortable and we loved the silky sheets!! We slept great each night without any noises!!
Likes:
Comments: 5It was an astonishing reversal of perception. The geologic mystery of the canyon is how the south-trending Colorado River made a sudden turn westward to carve its way, cross-grained, through four plateaus. This is also more or less what happened culturally. Intellectuals cut against existing aesthetics to make a place that looked nothing like pastorals or alpine mountains into a compelling spectacle. Unlike most great features, the Grand Canyon is invisible until you stand on its rim. You aren’t drawn to it as to a river’s source or a mountain’s peak. You have to seek it out, and then cope with its visual revelation. It simply and suddenly is.
Likes:
Comments: 410/10 would recommend
Likes:
Comments: 5


LOGO
Toggle navigation
About
Contact
Sign Up
Login
The Image Gallary
A bunch of beautiful images that i didn't take.


[% include 'third-party-scripts.html' %]
Perfkit Dashboard Administration
Create
Upload
Open
More from this owner
Copy
Download
Rename
Edit owner
Delete
Edit config
All dashboards
Owned by me


22
1 Yahweh gave this message about Jerusalem, about the valley where Yahweh showed me this vision.
Why is everyone foolishly running up to their flat rooftops?
2 Everyone in the city seems to be shouting.
There are a lot of corpses in the city,
but they were not killed by their enemies' swords.
They did not die in battles;
instead, they died from diseases and hunger.
3 All the leaders of the city fled.
But then they were captured because they did not have bows and arrows to defend themselves.
Your soldiers tried to flee while the enemy army was still far away,
but they also were captured.
4 That is why I said, "Allow me to cry alone;
do not try to comfort me about my people being slaughtered."
5 Yahweh, Commander of the angel armies, has chosen a time when there will be a great uproar, soldiers marching, and people being terrified
in the valley where I received this vision.
It will be a time when our city walls will be battered down
and the people's cries for help will be heard in the mountains.
6 The armies from Elam and Kir in Media will attack,
driving chariots and carrying shields.
7 Our beautiful valleys will be filled with our enemies' chariots,
and the men who drive the chariots will stand outside our city gates.
8 God will cause the walls that protect the cities in Judah to fall down.
You people of Jerusalem will run to get the weapons that are stored in the building called "the Hall of the Forest."
9 You will see that there are many breaks in the walls of Jerusalem.
You will store water in the lower pool in the city.
10 You will inspect the houses in Jerusalem,
and some of them you will tear down to use the stones to repair the city wall.
11 Between the walls of the city you will build a reservoir to store water from the old pool.
But you will never request help from the one who made the city;
you have never depended on Yahweh, who planned this city long ago.
12 Yahweh, Commander of the angel armies, told you to weep and mourn;
he told you to shave your heads and to wear rough sackcloth
to show that you were sorry for the sins that you had committed.
13 But instead of doing that, you were happy and celebrated;
you slaughtered cattle and sheep
in order to cook their meat and eat it and drink wine.
You said, "Let us eat and drink all that we want to,
because it is possible that we will die tomorrow!"
14 So Yahweh, Commander of the angel armies, revealed this to me: "I will never forgive my people for sinning like this!"
15 Yahweh, Commander of the angel armies, said this to me: "Go to Shebna, the official who supervises the workers in the palace, and give this message to him:
16 'Who do you think you are?
Who gave you the authority to build a beautiful tomb where you will be buried,
chiseling it out of the rocky cliff high above this valley?'"
17 You think that you are a great man, but Yahweh is about to hurl you away.
It will be as though he had seized you,
18 rolled you into a ball,
and thrown you away in a large distant land.

 He will be like a father to the people of Jerusalem and all the other towns in Judah.
22 I will give to him authority over what happens in the palace where King David lived; when he decides something, no one will be able to oppose it; when he refuses to do something, no one will be able to force him to do it.
23 I will cause his family to be greatly respected, because I will put him firmly in his position as supervisor of the workers in the palace, like a nail that is firmly hammered into a wall.
24 Others will enable him to have much responsibility, with the result that all the members of his family, even the most insignificant ones, will be honored.
25 Yahweh, Commander of the angel armies, also says, "Shebna is like a peg that is firmly fastened to the wall. But there will be a time when I will remove him from his position; he will lose his power, and everything that he promoted will fail." That will surely happen because Yahweh has said it.