(This article was originally published in PC AI magazine, Volume 7, Number 5 September/October 1993. The magazine can be reached at PC AI, 3310 West Bell Rd., Suite 119, Phoenix AZ, USA 85023 Tel<PHONE_NUMBER>, FAX:<PHONE_NUMBER>. It is an introduction to the language that attempts to bring out the practical benefits of the technical features of the language (unification, backtracking), rather than approaching it from a theoretical point of view.)
While I have since written a number of "useful" Prolog programs, I was first drawn to Prolog while I was in the middle of writing, for fun, an adventure game in 'C' on my first "personal" computer. I had started my 'C' program by building the basic tools needed for the game, which included a dynamic database to record the changing state of the game, and the ability to search for symbolic patterns in the state that indicated some action needed to be taken. The action was usually represented by a message to the user and a change of state of the game.
| Adventure Games, are games in which the developer creates a simulation of an environment, real or fanciful, that the user explores, usually with some objective in mind. It is generally full of puzzles that need to be solved in order to achieve the objective. |
As I was writing the utility functions for my game, I happened to go to a Boston Computer Society meeting where the speaker was discussing Prolog. I learned that all of the tools I was building were already integral components of the Prolog language.
Prolog has built-in dynamic memory allocation for storing the state of the game that was better than mine because it had an extremely flexible way of representing the data. It has a built-in pattern-matching capability (unification) that was more general and flexible than the pattern-matcher I was implementing, and it had a built-in search mechanism (backtracking). Further, the dynamic memory allocation didn't just store facts, but stored rules as well, so the "data" could embody its own intelligence.
Because of all of this procedural power built into the language, the code the programmer writes looks much more declarative. An application, such as my adventure game, winds up being reduced to an elegant set of logical declarations describing what the program does. (Developers often claim up to a 10-fold reduction in code size going to Prolog. See for example the PCAI article on KnowledgeWare's use of Prolog in the May/June 1993 issue.) For me, this was truly a fun way to program, capturing the essence of the joy of programming-building logical structures that perform interesting tasks.
While in retrospect, the power of Prolog for writing adventure games might be obvious, think of how many other applications contain elements of remembering program state, searching for pattern matches in that state and taking conditional actions based on them. Further, how many of us think of our programs in logical terms, declaratively at first, and then spend the time translating that into procedural code?
Because of the ubiquitousness of these conditions in applications, Prolog has the potential for making almost any application more fun to write than it would be in a conventional procedural language. The following sections look at a number of simple applications, showing how the built-in pattern matching (unification), search (backtracking), and dynamic memory allocation make for elegant expressions of applications in a logically pleasing, declarative fashion.

This is a skeleton adventure game in which the object is to go from the house, across the yard, to the duck pen to fetch a duck egg, being careful not to let the fox get any of the ducks.
+----------------------------------+ | woods (fox) | |----------------------------------| | duck pen | | | (ducks) | yard | | (egg) \ | |----------+ +-----------+ | | house | | | | | | (you) | +----------------------------------+
To begin with we use the dynamic database to define the initial state of the game. To do this we simply state the various bits of information using Prolog structures and rules. This is, in many senses, the essence of the design, for it defines the structure of the state that the rest of the program will manipulate.
location(egg, duck_pen). location(ducks, duck_pen). location(fox, woods). location(you, house).
nextto(duck_pen, yard, closed). nextto(yard, house, open). nextto(yard, woods, open).
connect(X, Y) :- nextto(X, Y, open). connect(X, Y) :- nextto(Y, X, open).
| Prolog Jargon - location, nextto and connect are called predicates.
Because location takes two arguments, it is said to have an arity of 2
and is described as location/2. Similarly we've defined nextto/3 and connect/2.
Each of the four statements ending in '.' for location/2 are called clauses,
so the location/2 predicate has four clauses. nextto/3 has three clauses
and connect/2 has two clauses. The clauses of location/2 and nextto/3 are
called facts; they are simple assertions of truth. The two clauses of connect/2
are called rules because they are conditional as indicated by the neck
symbol ':-' which can be read as the word 'if.'
The arguments of the predicates are either atoms, symbols to be matched identified by an initial lower case letter, variables that can match other symbols, identified by an initial upper case letter or strings which are enclosed in $'s. Unlike most other languages, variables in Prolog cannot be assigned values, instead they take on values as the result of unification. |
The Prolog statements defining location and nextto should be pretty obvious. The third predicate, connect is an example of a rule used as data. Two places are connected if they are either nextto(X, Y, open) or nextto(Y, X, open) In other words, you can get from X to Y or from Y to X if X is next to Y and open. The upper case X and Y are variables used in unification.
The definition of connect illustrates both unification and backtracking search. The specification of nextto(X, Y, open) in the first rule of connect serves as a pattern to be matched against the clauses of nextto/3. Depending on the values of X and Y, the backtracking search will continue to try clauses until one is found that matches the pattern.
| One of the major advantages of Prolog is code can be tested almost
immediately after being written. In this case, assume the source code file
is called 'ducks.pro'. The code is then loaded and tested in a Prolog interpreter
as follows. (The -> symbol means there might be more answers, the ';'
is the user requesting another answer.)
?- consult('ducks.pro'). |
To implement just the code we've written so far in some other language would require defining the data structures for the state, deciding whether to store them in pre-allocated or dynamically allocated memory, and writing a procedure to implement connect that walked the state information and used some pattern-matching code. While these types of programming challenges are fun as well, the resulting code would be visually dominated by the search and match routines with the result that the logic of the application would be hidden, much as the logic of a simple mathematical equation is hidden when it is coded in assembler.
Now that the basic state is defined, the commands that manipulate the state can be added. The fundamental operation in an adventure game is moving about, so we first implement a goto command that will move you from where you are to where you want to be, if you can get there.
| Prolog Jargon - The goto/1 predicate has two clauses. Both are rules, with a head before the neck symbol and a body after it. The body of the first goto/1 clause is composed of seven goals (separated by commas). Each of the goals is treated as a Prolog query, if the goal succeeds, then execution proceeds to the next goal, if a goal fails, then execution backtracks to the previous goal and tries to find another solution. A goal with a variable in it succeeds by binding the variable to whatever value is necessary for the goal to succeed, so in this case location(you, L) will bind L to wherever you happen to be at the time, initially the house. |
goto(X) :- location(you, L), connect(L, X), retract( location(you, L) ), assert( location(you, X) ), write($ You are in the $), write(X), nl. goto(X) :- write($ You can't get there from here. $), nl.
When we give Prolog the goal goto(X), where X might be one of the places in the game, such as the duck_pen, Prolog does a search for us. First it tries the first goto clause.  If connect fails, then the first clause of goto fails and the second clause is executed instead, writing its message to the user. The assert and retract statements are built into Prolog (as are the write and nl (newline) predicates.) They are used to dynamically modify the database, so that, in this case, location(you.. now reflects your new location.
(This ability of Prolog to dynamically define itself is a powerful capability considered by some to be dangerous. To avoid the danger, the same code can be written by storing all of the state information in one large Prolog variable so that the application never needs to use assert and retract to modify its state, but my background is database and I find the approach presented more readable and, well, logical.)
Other commands are similar, open(gate) and close(gate) change the state of nextto between the duck_pen and the yard. The '_' is what's called the anonymous variable, used for arguments whose values are not of interest at the time. It's use here causes the retract statements to say, in effect, retract the old nextto clause no matter whether it was open or closed.
open(gate) :- 1assert( nextto(duck_pen, yard, open ) ). close(gate) :- retract( nextto(duck_pen, yard, _) ), assert( nextto(duck_pen, yard, closed) ).
chase(ducks) has the affect of putting the ducks back in their pen, but it only works if you are in the yard with the ducks. take(X) removes a thing's location clause and replaces it with a you_have clause, thereby putting it in your possession. (Strings are represented in some Prologs by being bracketed by $ symbols.)
chase(ducks) :- location(ducks, yard), location(you, yard), retract( location(ducks, yard) ), assert( location(ducks, duck_pen) ), write($ The ducks are back in their pen. $), nl. chase(ducks) :- write($ No ducks here. $), nl. take(X) :- location(you, L), retract( location(X, L) ), assert( you_have(X) ), write($ You now have the $), write(X), nl. take(X) :- write($ There is no $), write(X), write($ here.$), nl.
The fun part of any adventure game is the various side effects, or demons. Here are two for this game. If you enter the duck pen, and the gate is open, then the ducks will go into the yard, and, the fox is in the woods waiting for the ducks to be accessible and unguarded.
ducks :- location(ducks, duck_pen), location(you, duck_pen), connect(duck_pen, yard), retract( location(ducks, duck_pen) ), assert( location(ducks, yard) ), write($ The ducks have run into the yard. $), nl. ducks.
fox :- location(ducks, yard), location(you, house), write($ The fox has taken a duck. $), nl. fox.
The main control loop is handled with a predicate that uses recursion to execute over and over again, until the end state is reached. The first go tests the end condition, and the second reads and executes a command, tries the demons and then does it all over again.
go :- done. go :- write($>> $), read(X), call(X), ducks, fox, go.
done :- location(you, house), you_have(egg), write($ Thanks for getting the egg. $), nl.
To run this program, simply consult it into a Prolog interpreter and type 'go'.
It works like this:
?- go.
>> goto(yard).  You can't get there from here. >> open(gate). >> goto(duck_pen). You are in the duck_pen The ducks have run into the yard. >> take(egg). You now have the egg. >> goto(yard). You are in the yard >> goto(house). You are in the house The fox has taken a duck. Thanks for getting the egg. ?-
This is just the skeletal prototype that can easily be enhanced to include more flowing English for descriptions of what's happening and for accepting commands. In a Prolog that supports graphics, the I/O could manipulate graphic images instead of words.
But, no matter how its enhanced, the code for the game will continue to look like a concise logical specification of the game. This is in contrast to a more conventional procedural application that scatters the basic logic of the application amongst the mechanics of how it gets executed.
Prolog was originally designed for natural language work, and is excellent for that, but it is also ideal for experimenting with different ideas for computer languages. For example, Prolog can be used to implement an object-oriented programming extension to itself. Here are a few lines of code that implement polymorphism much better than C++ does. (Polymorphism is the ability of different types of objects to respond to the same message.)
| Prolog Jargon - Lists in Prolog are represented with [] brackets, such as [one, two, three]. A list can be considered to be composed of two parts, the first element, or head, and the list of remaining elements, or tail. This is represented by the notation [H | T] where the '|' separates the head and tail. |
We need to introduce Prolog lists to implement it, (See side box) and one of the classic list utilities, member, that finds members of a list. It says, X is a member of list whose head is X. Failing, this, X is a member of a list if it's a member of the tail of the list.
member(X, [X|_]). member(X, [_|Z]) :- member(X, Z).
To implement polymorphism we will write a predicate, oo_send/2 which sends a message to an object. For an example we will define classes of objects corresponding to geometric shapes, and methods for each shape to compute it's area and perimeter. To do this we first need to define structures to represent the classes.
Here are two class definitions for rectangles and circles.
oo_class( rectangle(H, W), methods([ ( area(A) :- A is H * W ), ( perimeter(P) :- P is 2 * (H + W) ) ]) ).
oo_class( circle(R), methods([ ( area(A) :- A is pi * R * R ), ( perimeter(P) :- 2 * pi * R ) ]) ).
Given the design of the class structures, oo_send/2 becomes simple to implement. It has three goals which perform the operations:
This is, of course, just a logical specification of what oo_send should do and corresponds very closely to the code itself.
oo_send(Obj, Mess) :- oo_class(Obj, methods(Ms)), member((Mess :- Meth), Ms), call(Meth).
The reason the code is so close to the logical specification, is that the programming tasks of searching for the right class and the right method in that class are taken care of by Prolog's backtracking search and unification. All that's left is the logic.
Note how powerful unification is in this example. The variable Ms becomes unified with the whole complex list of methods for the given object, and, despite being passed to member, the relationship between all the logical variables is preserved so the right answer winds up in the variable used in the message.
To illustrate how this works, we create a list of different shapes and write a test predicate that sends the message area(A) to each of the shapes on the list.
shapes([rectangle(2, 3), circle(10), rectangle(4, 5), circle(4)]).
go :- shapes(L), member(S, L), oo_send(S, area(A)), write($Area of $), write(S), write($ = $), write(A), nl, fail. go.
The test predicate, go, uses member to find each of the members of the list. It does this by calling member with a variable, S, as the first argument. On the first call to member, S is unified with the first element of the list. The next goal sends that element the same message area(A). The fail goal initiates backtracking which causes member to unify S with the next element of the list, which also then gets the area(A) message sent to it. This continues until there are no more members of the list.
For each shape, the area will be different and the method actually used to compute it will be different, but the message stays the same. This is polymorphism.
Here are the results of running the test program.
?- go.
Area of rectangle(2, 3) = 6 Area of circle(10) = 314.159 Area of rectangle(4, 5) = 20 Area of circle(4) = 50.2655
yes ?-
This simple example can be expanded to include multiple inheritance, flavors, persistent objects and any thing else you might desire in an OOP system. As with the adventure game example, the code will continue to look like a logical specification of an OOP system.
There is a game called animals that uses expanding tree structures to try to guess what animal you were thinking of. If it guesses wrong it asks you what animal you are thinking of and for a question to identify it. Thus the decision tree grows and the program gets "smarter."
The example starts with a simple tree with two branches, each pointing to a different animal. A question is used to distinguish between them.
/ yes - mouse Does it have fur? \ no - lizard
If the program guesses wrong, then the answer animal is replaced with a new subtree, having two branches and a question as shown in the figure.
/ yes - dog / yes - Does it bark? Does it have fur? \ no - mouse \ no - lizard
This application is trivial in Prolog using the power of unification in which variables can be bound to complex structures which can contain other variables, which might in turn be unified with still other structures. This is how the tree grows. First, how the program works. A sample dialog looks like:
?- go. Does it have fur? yes Is it a mouse? no What animal were you thinking of? dog What is a yes/no question that distinguishes them? Does it bark? For a dog the answer is: yes Play again? yes Does it have fur? yes Does it bark? yes Is it a dog? yes Play again? no yes ?-
Here is all the code to implement animals in Prolog. The nodes of the tree are represented by the pattern, Animal - Tree. If Tree is a variable, then the node is an end node and the program guesses the animal. If Tree is a tree, then it is used to ask more questions. When the program guesses wrong, then it prompts for information used to build another subtree. That subtree is unified with the variable Tree at the current node and the program loops again, all the wiser.
% The starting tree init(root - tree(mouse - X, $Does it have fur?$, lizard - Y)).
% The main program loop go:- init(T), loop($yes$, T).
loop($no$, _). loop($yes$, T):- identify(T), nl, write($Play again? $), read_string(Ans), nl, loop(Ans, T).
% When the end of a branch is reached, try to guess the animal identify(Animal - X):- var(X), nl, write($Is it a $), write(Animal), write($? $), read_string(Ans), nl, process(Ans, Animal, X). % Walks the tree asking about the attributes of the animal identify(_ - tree(YES, Q, NO)):- nl, write(Q), tab(1), read_string(Ans), nl, (Ans = $yes$, identify(YES); identify(NO)).
% Do nothing if the guess is correct process($yes$, _, _). % Adds a new subtree if the guess is wrong process($no$, Animal, X):- nl, write($What animal were you thinking of? $), nl, read_string(Ans), nl, nl, write($What is a yes/no question that distinguishes them?$), nl, read_string(Q), nl, nl, write($For a $), write(Ans), write($ the answer is: $), read_string(YN), nl, (YN = $yes$, X = tree(Ans-Y, Q, Animal-Z); X = tree(Animal-Y, Q, Ans-Z)).
| Prolog jargon - the ';' indicates an 'or' in a list of goals, as opposed to the more common ', ' which indicates an 'and.' The percent sign % is used to denote comments. |
In this case it is unification and recursion that make this an elegant and simple expression of the code to implement the animals decision tree game.
I don't know about you, but I've never really enjoyed figuring out my taxes, that is, until the year I decided to write my own tax program in Prolog. The challenge shifted from getting all the right numbers in the right boxes, to putting together a logical structure that would do it for me.
To illustrate the idea, consider the following simplified tax form, 1040F (F for fantasy, if it were only so simple and cheap.)
line 1 wages | | line 2 tax - enter 5% of line 1 | | line 3 withheld | | line 4 refund (line 3 - line 2) | |
Each line of the tax form can be represented as a clause of the predicate line. The line predicate has four arguments: the form name, the line number, a description, and a value. The clauses for each line refer to the database of raw data and to each other as necessary. Given this, here is a Prolog program to compute taxes for form 1040F. (Remember, terms beginning with upper case are variables.)
tax:- line('1040F', 4, refund, X), write('They owe you: '), write(X), nl.
line('1040F', 1, wages, X) :- wages(X). line('1040F', 2, tax, X) :- line('1040F', 1, _, WAGES), X is 0.05 * WAGES. line('1040F', 3, withheld, X) :- withheld(X). line('1040F', 4, refund, X) :- line('1040F', 2, _, TAX), line('1040F', 3, _, WITHHELD), X is WITHHELD - TAX.
wages(30000).
withheld(2000).
In this program, tax is the top level predicate which is called in a query to start the program. In true business like fashion, it immediately asks for the bottom line. The rule for line 4 calls rules for line 3 and 2, which call other line rules etc. This program accesses data from the predicates wages and withheld.
Backtracking search causes Prolog to automatically use all the necessary data and subsidiary lines to compute the bottom line. The program is very declarative in its nature, mimicking almost precisely the actual tax form. All of the procedurality required to perform the computation is handled automatically by Prolog.
 They owe you: 500 yes ?-
This basic scheme can be applied to the entire tax form, however, there are a few changes that might be made, such as adding a way of 'remembering' the values of various lines so they don't have to be recomputed and can also be used in a final report. This is a relatively simple change that doesn't affect the readability of the program.
In these few examples we've seen how the unique features of Prolog, dynamic memory allocation, unification and backtracking, make it a language whose code appears much cleaner, simpler, and "logical." The net result is a language that is, quite simply, a lot of fun to use.


Function
| Static Public Summary | ||
| public |
We only ever use api() at call-time of functions; this allows the options (particularly the transport option) to be changed dynamically and the data structure to be reused. |
|
| public |
Check if a rpc$ value is loading. |
|
| public |
isNullOrLoading(value: Any): Boolean Check if a rpc$ value is |
|
| public |
Post a transaction to the network. |
|
| public |
Sets an Api object. |
|
| public |
Filter out the loading states in our observable. |
Static Public
public getApi(): Object source
import {getApi} from<EMAIL_ADDRESS>We only ever use api() at call-time of functions; this allows the options (particularly the transport option) to be changed dynamically and the data structure to be reused.
public isLoading(value: Any): Boolean source
import {isLoading} from<EMAIL_ADDRESS>Check if a rpc$ value is loading.
Params:
| Name | Type | Attribute | Description |
| value | Any | The value to test. |
public isNullOrLoading(value: Any): Boolean source
import {isNullOrLoading} from<EMAIL_ADDRESS>Check if a rpc$ value is null,
undefined` or loading.
Params:
| Name | Type | Attribute | Description |
| value | Any | The value to test. |
public post$(tx: Object): Observable<Object> source
import {post$} from<EMAIL_ADDRESS>Post a transaction to the network.
Calls, in this order, eth_estimateGas
, parity_postTransaction
,
parity_checkRequest
and eth_getTransactionReceipt
to get the status of
the transaction.
Params:
| Name | Type | Attribute | Description |
| tx | Object | A transaction object. |
public setApi(newApi: Object): Null source
import {setApi} from<EMAIL_ADDRESS>Sets an Api object.
Params:
| Name | Type | Attribute | Description |
| newApi | Object | The Api object. |
Return:
| Null |
public withoutLoading() source
import {withoutLoading} from<EMAIL_ADDRESS>Filter out the loading states in our observable.


backbone-es6/src/Model.js
'use strict';
import _ from 'underscore';
import BackboneProxy from './BackboneProxy.js';
import Events from 'typhonjs-core-backbone-events/src/Events.js';
import Utils from './Utils.js';
/**
* Backbone.Model - Models are the heart of any JavaScript application. (http://backbonejs.org/#Model)
* --------------
*
* Models are the heart of any JavaScript application, containing the interactive data as well as a large part of the
* logic surrounding it: conversions, validations, computed properties, and access control.
*
* Backbone-ES6 supports the older "extend" functionality of Backbone. You can still use "extend" to extend
* Backbone.Model with your domain-specific methods, and Model provides a basic set of functionality for managing
* changes.
*
* It is recommended though to use ES6 syntax for working with Backbone-ES6 foregoing the older "extend" mechanism.
*
* Create a new model with the specified attributes. A client id (`cid`) is automatically generated & assigned for you.
*
* If you pass a {collection: ...} as the options, the model gains a collection property that will be used to indicate
* which collection the model belongs to, and is used to help compute the model's url. The model.collection property is
* normally created automatically when you first add a model to a collection. Note that the reverse is not true, as
* passing this option to the constructor will not automatically add the model to the collection. Useful, sometimes.
*
* If {parse: true} is passed as an option, the attributes will first be converted by parse before being set on the
* model.
*
* Underscore methods available to Model:
* @see http://underscorejs.org/#chain
* @see http://underscorejs.org/#keys
* @see http://underscorejs.org/#invert
* @see http://underscorejs.org/#isEmpty
* @see http://underscorejs.org/#omit
* @see http://underscorejs.org/#pairs
* @see http://underscorejs.org/#pick
* @see http://underscorejs.org/#values
*
* @example
* import Backbone from 'backbone';
*
* export default class MyModel extends Backbone.Model
* {
* initialize() { alert('initialized!); }
* }
*
* older extend example:
* export default Backbone.Model.extend(
* {
* initialize: { alert('initialized!); }
* });
*
* @example
* Another older extend example... The following is a contrived example, but it demonstrates defining a model with a
* custom method, setting an attribute, and firing an event keyed to changes in that specific attribute. After running
* this code once, sidebar will be available in your browser's console, so you can play around with it.
*
* var Sidebar = Backbone.Model.extend({
* promptColor: function() {
* var cssColor = prompt("Please enter a CSS color:");
* this.set({color: cssColor});
* }
* });
*
* window.sidebar = new Sidebar;
*
* sidebar.on('change:color', function(model, color) {
* $('#sidebar').css({ background: color });
* });
*
* sidebar.set({color: 'white'});
*
* sidebar.promptColor();
*
* @example
* The above extend example converted to ES6:
*
* class Sidebar extends Backbone.Model {
* promptColor() {
* const cssColor = prompt("Please enter a CSS color:");
* this.set({ color: cssColor });
* }
* }
*
* window.sidebar = new Sidebar();
*
* sidebar.on('change:color', (model, color) => {
* $('#sidebar').css({ background: color });
* });
*
* sidebar.set({ color: 'white' });
*
* sidebar.promptColor();
*
* @example
* Another older extend example:
* extend correctly sets up the prototype chain, so subclasses created with extend can be further extended and
* sub-classed as far as you like.
*
* var Note = Backbone.Model.extend({
* initialize: function() { ... },
*
* author: function() { ... },
*
* coordinates: function() { ... },
*
* allowedToEdit: function(account) {
* return true;
* }
* });
*
* var PrivateNote = Note.extend({
* allowedToEdit: function(account) {
* return account.owns(this);
* }
* });
*
* @example
* Converting the above example to ES6:
*
* class Note extends Backbone.Model {
* initialize() { ... }
*
* author() { ... }
*
* coordinates() { ... }
*
* allowedToEdit(account) {
* return true;
* }
* }
*
* class PrivateNote extends Note {
* allowedToEdit(account) {
* return account.owns(this);
* }
* });
*
* let privateNote = new PrivateNote();
*
* @example
* A huge benefit of using ES6 syntax is that one has access to 'super'
*
* class Note extends Backbone.Model {
* set(attributes, options) {
* super.set(attributes, options);
* ...
* }
* });
*/
class Model extends Events
{
/**
* When creating an instance of a model, you can pass in the initial values of the attributes, which will be set on
* the model. If you define an initialize function, it will be invoked when the model is created.
*
* @example
* new Book({
* title: "One Thousand and One Nights",
* author: "Scheherazade"
* });
*
* @example
* ES6 example: If you're looking to get fancy, you may want to override constructor, which allows you to replace
* the actual constructor function for your model.
*
* class Library extends Backbone.Model {
* constructor() {
* super(...arguments);
* this.books = new Books();
* }
*
* parse(data, options) {
* this.books.reset(data.books);
* return data.library;
* }
* }
*
* @see http://backbonejs.org/#Model-constructor
*
* @param {object} attributes - Optional attribute hash of original keys / values to set.
* @param {object} options - Optional parameters
*/
constructor(attributes = {}, options = {})
{
super();
// Allows child classes to abort constructor execution.
if (_.isBoolean(options.abortCtor) && options.abortCtor) { return; }
let attrs = attributes;
/**
* The prefix is used to create the client id which is used to identify models locally.
* You may want to override this if you're experiencing name clashes with model ids.
*
* @type {string}
*/
this.cidPrefix = 'c';
/**
* Client side ID
* @type {number}
*/
this.cid = _.uniqueId(this.cidPrefix);
/**
* The hash of attributes for this model.
* @type {object}
*/
this.attributes = {};
if (options.collection)
{
/**
* A potentially associated collection.
* @type {Collection}
*/
this.collection = options.collection;
}
/**
* A hash of attributes whose current and previous value differ.
* @type {object}
*/
this.changed = {};
/**
* The value returned during the last failed validation.
* @type {*}
*/
this.validationError = null;
// Allows child classes to postpone initialization.
if (_.isBoolean(options.abortCtorInit) && options.abortCtorInit) { return; }
if (options.parse) { attrs = this.parse(attrs, options) || {}; }
attrs = _.defaults({}, attrs, _.result(this, 'defaults'));
this.set(attrs, options);
this.initialize(this, arguments);
}
/**
* Retrieve a hash of only the model's attributes that have changed since the last set, or false if there are none.
* Optionally, an external attributes hash can be passed in, returning the attributes in that hash which differ from
* the model. This can be used to figure out which portions of a view should be updated, or what calls need to be
* made to sync the changes to the server.
*
* @see http://backbonejs.org/#Model-changedAttributes
*
* @param {object} diff - A hash of key / values to diff against this models attributes.
* @returns {object|boolean}
*/
changedAttributes(diff)
{
if (!diff) { return this.hasChanged() ? _.clone(this.changed) : false; }
const old = this._changing ? this._previousAttributes : this.attributes;
const changed = {};
for (const attr in diff)
{
const val = diff[attr];
if (_.isEqual(old[attr], val)) { continue; }
changed[attr] = val;
}
return _.size(changed) ? changed : false;
}
/**
* Removes all attributes from the model, including the id attribute. Fires a "change" event unless silent is
* passed as an option.
*
* @see http://backbonejs.org/#Model-clear
*
* @param {object} options - Optional parameters.
* @returns {*}
*/
clear(options)
{
const attrs = {};
for (const key in this.attributes) { attrs[key] = void 0; }
return this.set(attrs, _.extend({}, options, { unset: true }));
}
/**
* Returns a new instance of the model with identical attributes.
*
* @see http://backbonejs.org/#Model-clone
*
* @returns {*}
*/
clone()
{
return new this.constructor(this.attributes);
}
/**
* Destroys the model on the server by delegating an HTTP DELETE request to Backbone.sync. Returns a jqXHR object,
* or false if the model isNew. Accepts success and error callbacks in the options hash, which will be passed
* (model, response, options). Triggers a "destroy" event on the model, which will bubble up through any collections
* that contain it, a "request" event as it begins the Ajax request to the server, and a "sync" event, after the
* server has successfully acknowledged the model's deletion. Pass {wait: true} if you'd like to wait for the server
* to respond before removing the model from the collection.
*
* @example
* book.destroy({success: function(model, response) {
* ...
* }});
*
* @see http://backbonejs.org/#Model-destroy
*
* @param {object} options - Provides optional properties used in destroying a model.
* @returns {boolean|XMLHttpRequest}
*/
destroy(options)
{
options = options ? _.clone(options) : {};
const success = options.success;
const wait = options.wait;
const destroy = () =>
{
this.stopListening();
this.trigger('destroy', this, this.collection, options);
};
options.success = (resp) =>
{
if (wait) { destroy(); }
if (success) { success.call(options.context, this, resp, options); }
if (!this.isNew()) { this.trigger('sync', this, resp, options); }
};
let xhr = false;
if (this.isNew())
{
_.defer(options.success);
}
else
{
Utils.wrapError(this, options);
xhr = this.sync('delete', this, options);
}
if (!wait) { destroy(); }
return xhr;
}
/**
* Similar to get, but returns the HTML-escaped version of a model's attribute. If you're interpolating data from
* the model into HTML, using escape to retrieve attributes will prevent XSS attacks.
*
* @example
* let hacker = new Backbone.Model({
* name: "<script>alert('xss')</script>"
* });
*
* alert(hacker.escape('name'));
*
* @see http://backbonejs.org/#Model-escape
*
* @param {*} attr - Defines a single attribute key to get and escape via Underscore.
* @returns {string}
*/
escape(attr)
{
return _.escape(this.get(attr));
}
/**
* Merges the model's state with attributes fetched from the server by delegating to Backbone.sync. Returns a jqXHR.
* Useful if the model has never been populated with data, or if you'd like to ensure that you have the latest
* server state. Triggers a "change" event if the server's state differs from the current attributes. fetch accepts
* success and error callbacks in the options hash, which are both passed (model, response, options) as arguments.
*
* @example
* // Poll every 10 seconds to keep the channel model up-to-date.
* setInterval(function() {
* channel.fetch();
* }, 10000);
*
* @see http://backbonejs.org/#Model-fetch
*
* @param {object} options - Optional parameters.
* @returns {*}
*/
fetch(options)
{
options = _.extend({ parse: true }, options);
const success = options.success;
options.success = (resp) =>
{
const serverAttrs = options.parse ? this.parse(resp, options) : resp;
if (!this.set(serverAttrs, options)) { return false; }
if (success) { success.call(options.context, this, resp, options); }
this.trigger('sync', this, resp, options);
};
Utils.wrapError(this, options);
return this.sync('read', this, options);
}
/**
* Get the current value of an attribute from the model.
*
* @example
* For example:
* note.get("title")
*
* @see http://backbonejs.org/#Model-get
*
* @param {*} attr - Defines a single attribute key to get a value from the model attributes.
* @returns {*}
*/
get(attr)
{
return this.attributes[attr];
}
/**
* Returns true if the attribute is set to a non-null or non-undefined value.
*
* @example
* if (note.has("title")) {
* ...
* }
*
* @see http://backbonejs.org/#Model-has
*
* @param {string} attr - Attribute key.
* @returns {boolean}
*/
has(attr)
{
return !Utils.isNullOrUndef(this.get(attr));
}
/**
* Has the model changed since its last set? If an attribute is passed, returns true if that specific attribute has
* changed.
*
* Note that this method, and the following change-related ones, are only useful during the course of a "change"
* event.
*
* @example
* book.on("change", function() {
* if (book.hasChanged("title")) {
* ...
* }
* });
*
* @see http://backbonejs.org/#Model-hasChanged
*
* @param {string} attr - Optional attribute key.
* @returns {*}
*/
hasChanged(attr)
{
if (Utils.isNullOrUndef(attr)) { return !_.isEmpty(this.changed); }
return _.has(this.changed, attr);
}
/**
* Initialize is an empty function by default. Override it with your own initialization logic.
*
* @see http://backbonejs.org/#Model-constructor
* @abstract
*/
initialize()
{
}
/**
* Has this model been saved to the server yet? If the model does not yet have an id, it is considered to be new.
*
* @see http://backbonejs.org/#Model-isNew
*
* @returns {boolean}
*/
isNew()
{
return !this.has(this.idAttribute);
}
/**
* Run validate to check the model state.
*
* @see http://backbonejs.org/#Model-validate
*
* @example
* class Chapter extends Backbone.Model {
* validate(attrs, options) {
* if (attrs.end < attrs.start) {
* return "can't end before it starts";
* }
* }
*
* let one = new Chapter({
* title : "Chapter One: The Beginning"
* });
*
* one.set({
* start: 15,
* end: 10
* });
*
* if (!one.isValid()) {
* alert(one.get("title") + " " + one.validationError);
* }
*
* @see http://backbonejs.org/#Model-isValid
*
* @param {object} options - Optional hash that may provide a `validationError` field to pass to `invalid` event.
* @returns {boolean}
*/
isValid(options)
{
return this._validate({}, _.defaults({ validate: true }, options));
}
/**
* Special-cased proxy to the `_.matches` function from Underscore.
*
* @see http://underscorejs.org/#iteratee
*
* @param {object|string} attrs - Predicates to match
* @returns {boolean}
*/
matches(attrs)
{
return !!_.iteratee(attrs, this)(this.attributes);
}
/* eslint-disable no-unused-vars */
/**
* parse is called whenever a model's data is returned by the server, in fetch, and save. The function is passed the
* raw response object, and should return the attributes hash to be set on the model. The default implementation is
* a no-op, simply passing through the JSON response. Override this if you need to work with a preexisting API, or
* better namespace your responses.
*
* @see http://backbonejs.org/#Model-parse
*
* @param {object} resp - Usually a JSON object.
* @param {object} options - Unused
* @returns {object} Pass through to set the attributes hash on the model.
*/
parse(resp, options)
{
/* eslint-enable no-unused-vars */
return resp;
}
/**
* During a "change" event, this method can be used to get the previous value of a changed attribute.
*
* @example
* let bill = new Backbone.Model({
* name: "Bill Smith"
* });
*
* bill.on("change:name", function(model, name) {
* alert("Changed name from " + bill.previous("name") + " to " + name);
* });
*
* bill.set({name : "Bill Jones"});
*
* @see http://backbonejs.org/#Model-previous
*
* @param {string} attr - Attribute key used for lookup.
* @returns {*}
*/
previous(attr)
{
if (Utils.isNullOrUndef(attr) || !this._previousAttributes) { return null; }
return this._previousAttributes[attr];
}
/**
* Return a copy of the model's previous attributes. Useful for getting a diff between versions of a model, or
* getting back to a valid state after an error occurs.
*
* @see http://backbonejs.org/#Model-previousAttributes
*
* @returns {*}
*/
previousAttributes()
{
return _.clone(this._previousAttributes);
}
/**
* Save a model to your database (or alternative persistence layer), by delegating to Backbone.sync. Returns a jqXHR
* if validation is successful and false otherwise. The attributes hash (as in set) should contain the attributes
* you'd like to change — keys that aren't mentioned won't be altered — but, a complete representation of the
* resource will be sent to the server. As with set, you may pass individual keys and values instead of a hash. If
* the model has a validate method, and validation fails, the model will not be saved. If the model isNew, the save
* will be a "create" (HTTP POST), if the model already exists on the server, the save will be an "update"
* (HTTP PUT).
*
* If instead, you'd only like the changed attributes to be sent to the server, call model.save(attrs,
* {patch: true}). You'll get an HTTP PATCH request to the server with just the passed-in attributes.
*
* Calling save with new attributes will cause a "change" event immediately, a "request" event as the Ajax request
* begins to go to the server, and a "sync" event after the server has acknowledged the successful change. Pass
* {wait: true} if you'd like to wait for the server before setting the new attributes on the model.
*
* In the following example, notice how our overridden version of Backbone.sync receives a "create" request the
* first time the model is saved and an "update" request the second time.
*
* @example
* Backbone.sync = (method, model) => {
* alert(method + ": " + JSON.stringify(model));
* model.set('id', 1);
* };
*
* let book = new Backbone.Model({
* title: "The Rough Riders",
* author: "Theodore Roosevelt"
* });
*
* book.save();
*
* book.save({author: "Teddy"});
*
* @see http://backbonejs.org/#Model-save
*
* @param {key|object} key - Either a key defining the attribute to store or a hash of keys / values to store.
* @param {*} val - Any type to store in model.
* @param {object} options - Optional parameters.
* @returns {*}
*/
save(key, val, options)
{
// Handle both `"key", value` and `{key: value}` -style arguments.
let attrs;
if (Utils.isNullOrUndef(key) || typeof key === 'object')
{
attrs = key;
options = val;
}
else
{
(attrs = {})[key] = val;
}
options = _.extend({ validate: true, parse: true }, options);
const wait = options.wait;
// If we're not waiting and attributes exist, save acts as
// `set(attr).save(null, opts)` with validation. Otherwise, check if
// the model will be valid when the attributes, if any, are set.
if (attrs && !wait)
{
if (!this.set(attrs, options)) { return false; }
}
else
{
if (!this._validate(attrs, options)) { return false; }
}
// After a successful server-side save, the client is (optionally)
// updated with the server-side state.
const success = options.success;
const attributes = this.attributes;
options.success = (resp) =>
{
// Ensure attributes are restored during synchronous saves.
this.attributes = attributes;
let serverAttrs = options.parse ? this.parse(resp, options) : resp;
if (wait) { serverAttrs = _.extend({}, attrs, serverAttrs); }
if (serverAttrs && !this.set(serverAttrs, options)) { return false; }
if (success) { success.call(options.context, this, resp, options); }
this.trigger('sync', this, resp, options);
};
Utils.wrapError(this, options);
// Set temporary attributes if `{wait: true}` to properly find new ids.
if (attrs && wait) { this.attributes = _.extend({}, attributes, attrs); }
const method = this.isNew() ? 'create' : (options.patch ? 'patch' : 'update');
if (method === 'patch' && !options.attrs) { options.attrs = attrs; }
const xhr = this.sync(method, this, options);
// Restore attributes.
this.attributes = attributes;
return xhr;
}
/**
* Set a hash of attributes (one or many) on the model. If any of the attributes change the model's state, a "change"
* event will be triggered on the model. Change events for specific attributes are also triggered, and you can bind
* to those as well, for example: change:title, and change:content. You may also pass individual keys and values.
*
* @example
* note.set({ title: "March 20", content: "In his eyes she eclipses..." });
*
* book.set("title", "A Scandal in Bohemia");
*
* @see http://backbonejs.org/#Model-set
*
* @param {object|string} key - Either a string defining a key or a key / value hash.
* @param {*|object} val - Either any type to store or the shifted options hash.
* @param {object} options - Optional parameters.
* @returns {*}
*/
set(key, val, options = {})
{
if (Utils.isNullOrUndef(key)) { return this; }
// Handle both `"key", value` and `{key: value}` -style arguments.
let attrs;
if (typeof key === 'object')
{
attrs = key;
options = val || {};
}
else
{
(attrs = {})[key] = val;
}
// Run validation.
if (!this._validate(attrs, options)) { return false; }
// Extract attributes and options.
const unset = options.unset;
const silent = options.silent;
const changes = [];
const changing = this._changing;
this._changing = true;
if (!changing)
{
this._previousAttributes = _.clone(this.attributes);
this.changed = {};
}
const current = this.attributes;
const changed = this.changed;
const prev = this._previousAttributes;
// For each `set` attribute, update or delete the current value.
for (const attr in attrs)
{
val = attrs[attr];
if (!_.isEqual(current[attr], val)) { changes.push(attr); }
if (!_.isEqual(prev[attr], val))
{
changed[attr] = val;
}
else
{
delete changed[attr];
}
if (unset)
{
delete current[attr];
}
else
{
current[attr] = val;
}
}
/**
* Update the `id`.
* @type {*}
*/
this.id = this.get(this.idAttribute);
// Trigger all relevant attribute changes.
if (!silent)
{
if (changes.length) { this._pending = options; }
for (let i = 0; i < changes.length; i++)
{
this.trigger(`change:${changes[i]}`, this, current[changes[i]], options);
}
}
// You might be wondering why there's a `while` loop here. Changes can
// be recursively nested within `"change"` events.
if (changing) { return this; }
if (!silent)
{
while (this._pending)
{
options = this._pending;
this._pending = false;
this.trigger('change', this, options);
}
}
this._pending = false;
this._changing = false;
return this;
}
/**
* Uses Backbone.sync to persist the state of a model to the server. Can be overridden for custom behavior.
*
* @see http://backbonejs.org/#Model-sync
*
* @returns {*}
*/
sync()
{
return BackboneProxy.backbone.sync.apply(this, arguments);
}
/**
* Return a shallow copy of the model's attributes for JSON stringification. This can be used for persistence,
* serialization, or for augmentation before being sent to the server. The name of this method is a bit confusing,
* as it doesn't actually return a JSON string — but I'm afraid that it's the way that the JavaScript API for
* JSON.stringify works.
*
* @example
* let artist = new Backbone.Model({
* firstName: "Wassily",
* lastName: "Kandinsky"
* });
*
* artist.set({ birthday: "December 16, 1866" });
*
* alert(JSON.stringify(artist));
*
* @see http://backbonejs.org/#Model-toJSON
*
* @returns {object} JSON representation of this model.
*/
toJSON()
{
return _.clone(this.attributes);
}
/**
* Remove an attribute by deleting it from the internal attributes hash. Fires a "change" event unless silent is
* passed as an option.
*
* @see http://backbonejs.org/#Model-unset
*
* @param {object|string} attr - Either a key defining the attribute or a hash of keys / values to unset.
* @param {object} options - Optional parameters.
* @returns {*}
*/
unset(attr, options)
{
return this.set(attr, void 0, _.extend({}, options, { unset: true }));
}
/**
* Returns the relative URL where the model's resource would be located on the server. If your models are located
* somewhere else, override this method with the correct logic. Generates URLs of the form: "[collection.url]/[id]"
* by default, but you may override by specifying an explicit urlRoot if the model's collection shouldn't be taken
* into account.
*
* Delegates to Collection#url to generate the URL, so make sure that you have it defined, or a urlRoot property,
* if all models of this class share a common root URL. A model with an id of 101, stored in a Backbone.Collection
* with a url of "/documents/7/notes", would have this URL: "/documents/7/notes/101"
*
* @see http://backbonejs.org/#Model-url
* @see http://backbonejs.org/#Model-urlRoot
*
* @returns {string}
*/
url()
{
const base = _.result(this, 'urlRoot') || _.result(this.collection, 'url') || Utils.urlError();
if (this.isNew()) { return base; }
const id = this.get(this.idAttribute);
return base.replace(/[^\/]$/, '$&/') + encodeURIComponent(id);
}
/**
* Run validation against the next complete set of model attributes, returning `true` if all is well. Otherwise,
* fire an `"invalid"` event.
*
* @protected
* @param {object} attrs - attribute hash
* @param {object} options - Optional parameters
* @returns {boolean}
*/
_validate(attrs, options)
{
if (!options.validate || !this.validate) { return true; }
attrs = _.extend({}, this.attributes, attrs);
const error = this.validationError = this.validate(attrs, options) || null;
if (!error) { return true; }
this.trigger('invalid', this, error, _.extend(options, { validationError: error }));
return false;
}
}
// The default name for the JSON `id` attribute is `"id"`. MongoDB and CouchDB users may want to set this to `"_id"`.
Model.prototype.idAttribute = 'id';
// Underscore methods that we want to implement on the Model, mapped to the number of arguments they take.
const modelMethods =
{
keys: 1, values: 1, pairs: 1, invert: 1, pick: 0,
omit: 0, chain: 1, isEmpty: 1
};
// Mix in each Underscore method as a proxy to `Model#attributes`.
Utils.addUnderscoreMethods(Model, modelMethods, 'attributes');
/**
* Exports the Model class.
*/
export default Model;


Product User Guide
Setting it up
Basic Features
Video Playback
Basic Controls
Recording Video
Manual Recording
Scheduling a Recording
Advanced Features
Sharing Video
Compressing Video


Module phyzzle.Map
Map
Info:
- Release: v2.0.0
- License: MIT
- Author: Gamedevaton GitHub Twitter
Functions
| new (t) | Create a new map. |
| init () | Initialize the map by creating the zones. |
| add (e) | Add an entity to the map. |
| get (t) | Get a list of entities that intersect a AABB. |
| move (e, dx, dy) | Move an entity in the map and check for collisions. |
| zone (e) | Update Entity.zones base on the new location. |
| update (dt) | Update all dynamic entities. |
| region (t) | Get a zone region that encompasses the supplied AABB. |
Fields
| w | Map width in pixels. |
| h | Map height in pixels. |
| zs | The zone size, the width and height of a zone in pixels. |
| entitiesCount | Total number of entities in the map. |
| updatersCount | Total number of updating entities in the map. |
Functions
- new (t)
-
Create a new map.
Parameters:
- t Optional table of overrides and initial state.
Returns:
-
Map instance.
- init ()
-
Initialize the map by creating the zones.
Called automatically by Map:new.
Override in child maps to specify custom init functionality. All init functions will always be called unlike other overriden functions.
- add (e)
-
Add an entity to the map.
Parameters:
- e The Entity to add.
Returns:
-
The added Entity.
- get (t)
-
Get a list of entities that intersect a AABB.
Useful for checking for collisions in specific places.
Every Entity is an AABB. A generic AABB needs an x,y,w,h.
Parameters:
- t AABB to check for collisions.
Returns:
- move (e, dx, dy)
-
Move an entity in the map and check for collisions.
Will either trigger the entity's move or collision response handler. Movement is done one axis at a time, X first, Y second.
Parameters:
- e The Entity to move in the map.
- dx The amount to move in the X axis.
- dy The amount to move in the Y axis.
- zone (e)
-
Update
Entity.zones
base on the new location.Called automatically by Map:add. Needs to be called after manually setting an Entity locaiton
x
ory
. You only have to manually set an Entity location if you want to avoid collision checks.Parameters:
- e The `Entity to zone.
- update (dt)
-
Update all dynamic entities.
If an entity is flagged for removal it is removed.
Parameters:
- dt Change in time or delta time.
- region (t)
-
Get a zone region that encompasses the supplied AABB.
The AABB needs an x,y,w,h.
Useful for creating viewport based renderers or querying sections of the map.
Parameters:
- t AABB zones need to cover.
Returns:
- x1 The top-left zone's x location.
- y1 The top-left zone's y location.
- x1 The bottom-right zone's x location.
- y1 The bottom-right zone's y location.
Fields
- w
- Map width in pixels.
- h
- Map height in pixels.
- zs
-
The zone size, the width and height of a zone in pixels.
A map will be divided in to a grid of zones to optimise collisions and renderering.
- entitiesCount
- Total number of entities in the map.
- updatersCount
- Total number of updating entities in the map.


Call
Email
Copy
Share on facebook
Tweet to twitter
Do you know?
You can also create a profile like this for free. Click here to know more


Git
Upating remote repo
git push [alias] [remote branch name]
e.g. git push origin master
Updating local repo from remote repo
git pull
this is the same as git fetch and then git merge
Creating a local repo from a forked remote repo
git clone "URL from GitHub repo"
Creates a local repo of a remote repo on GitHub
Checking current local repo status compared to gitHub repo
git status
Checking current local repo status compared to gitHub repo
Adding a file to be committed
git add .
Checking current local repo status compared to gitHub repo
Committing a file/s
git commit -m "Commit comment.""
Committing a file/s
Ruby
Ruby Enumerables
inject(initial) { |memo, obj| block } → obj
(5..10).inject { |sum, n| sum + n } #=> 45
Combines all elements of enum by applying a binary operation, specified by a block or a symbol that names a method or operator.
map { |obj| block } → array
(1..4).map { |i| i*i } #=> [1, 4, 9, 16]
(1..4).collect { "cat" } #=> ["cat", "cat", "cat", "cat"]
Combines all elements of enum by applying a binary operation, specified by a block or a symbol that names a method or operator.
max(n) → obj , max(n) {|a,b| block } → obj
a = %w[albatross dog horse]
a.max { |a, b| a.length <=> b.length } #=> "albatross"
a.max(2) {|a, b| a.length <=> b.length } #=> ["albatross", "horse"]
partition { |obj| block } → [ true_array, false_array ]
(1..6).partition { |v| v.even? } #=> [[2, 4, 6], [1, 3, 5]]
Javascript
Creating objects
var person = {firstName:"John", lastName:"Doe", age:50, eyeColor:"blue"};
or object literal notation
var person = {
firstName:"John",
lastName:"Doe",
age:50,
eyeColor:"blue"
};
or using 'new' keyword
var person = new Object();
person.firstName = "John";
person.lastName = "Doe";
person.age = 50;
person.eyeColor = "blue";
Using object constructor
function person(first, last, age, eyecolor) {
this.firstName = first;
this.lastName = last;
this.age = age;
this.eyeColor = eyecolor;
}
var myFather = new person("John", "Doe", 50, "blue");
var myMother = new person("Sally", "Rally", 48, "green");
The above function (person) is an object constructor. Once you have an object constructor, you can create new objects of the same type: var myFather = new person("John", "Doe", 50, "blue"); var myMother = new person("Sally", "Rally", 48, "green");
The this Keyword In JavaScript, the thing called this, is the object that "owns" the JavaScript code. The value of this, when used in a function, is the object that "owns" the function. The value of this, when used in an object, is the object itself. The this keyword in an object constructor does not have a value. It is only a substitute for the new object. The value of this will become the new object when the constructor is used to create an object.


gdal_pansharpen.py
Perform a pansharpen operation.
(Since GDAL 2.1)
Synopsis
gdal_pansharpen [--help-general] pan_dataset {spectral_dataset[,band=num]}+ out_dataset
[-of format] [-b band]* [-w weight_val]*
[-r {nearest,bilinear,cubic,cubicspline,lanczos,average}]
[-threads {ALL_CPUS|number}] [-bitdepth val] [-nodata val]
[-spat_adjust {union,intersection,none,nonewithoutwarning}]
[-co NAME=VALUE]* [-q]
Description
The gdal_pansharpen.py script performs a pan-sharpening operation. It can create a "classic" output dataset (such as GeoTIFF), or a VRT dataset describing the pan-sharpening operation.
More details can be found in the Pansharpened VRT section.
- -of <format>:
Select the output format. Starting with GDAL 2.3, if not specified, the format is guessed from the extension (previously was
GTiff
). Use the short format name.VRT
can also be used.
- -b <band>
Select band band from the input spectral bands for output. Bands are numbered from 1 in the order spectral bands are specified. Multiple -b switches may be used. When no -b switch is used, all input spectral bands are set for output.
- -w <weight_val>
Specify a weight for the computation of the pseudo panchromatic value. There must be as many -w switches as input spectral bands.
- -r {nearest,bilinear,cubic (default),cubicspline,lanczos,average}
Select a resampling algorithm.
- -threads {ALL_CPUS,number}
Specify number of threads to use to do the resampling and pan-sharpening itself. Can be an integer number or ALL_CPUS.
- -bitdepth <val>
Specify the bit depth of the panchromatic and spectral bands (e.g. 12). If not specified, the NBITS metadata item from the panchromatic band will be used if it exists.
- -nodata <val>
Specify nodata value for bands. Used for the resampling and pan-sharpening computation itself. If not set, deduced from the input bands, provided they have a consistent setting.
- -spat_adjust {union(default),intersection,none,nonewithoutwarning}
Select behavior when bands have not the same extent. See SpatialExtentAdjustment documentation in Pansharpened VRT
- -co <NAME=VALUE>
Many formats have one or more optional creation options that can be used to control particulars about the file created. For instance, the GeoTIFF driver supports creation options to control compression, and whether the file should be tiled.
The creation options available vary by format driver, and some simple formats have no creation options at all. A list of options supported for a format can be listed with the --formats command line option but the documentation for the format is the definitive source of information on driver creation options. See Raster drivers format specific documentation for legal creation options for each format.
- -q
Suppress progress monitor and other non-error output.
- <pan_dataset>
Dataset with panchromatic band (first band will be used).
- <spectral_dataset>[,band=num]
Dataset with one or several spectral bands. If the band option is not specified, all bands of the datasets are taken into account. Otherwise, only the specified (num)th band. The same dataset can be repeated several times.
- <out_dataset>
Output dataset
Bands should be in the same projection.
Example
With spectral bands in a single dataset :
gdal_pansharpen.py panchro.tif multispectral.tif pansharpened_out.tif
With a few spectral bands from a single dataset, reordered :
gdal_pansharpen.py panchro.tif multispectral.tif,band=3 multispectral.tif,band=2 multispectral.tif,band=1 pansharpened_out.tif
With spectral bands in several datasets :
gdal_pansharpen.py panchro.tif band1.tif band2.tif band3.tif pansharpened_out.tif
Specify weights:
gdal_pansharpen.py -w 0.7 -w 0.2 -w 0.1 panchro.tif multispectral.tif pansharpened_out.tif
Specify RGB bands from a RGBNir multispectral dataset while computing the pseudo panchromatic intensity on the 4 RGBNir bands:
gdal_pansharpen.py -b 1 -b 2 -b 3 panchro.tif rgbnir.tif pansharpened_out.tif


Angular is dying.
Is there a life after its death?
Created by Mykola Savenko
Agenda:
- Is there a life ?
- 1.x vs 2.0
- ECMAScript
- The most advanced stack of technologies
- Isomorphic
- wasm
Is there a life ...
YEAP !
1.x
- No more $scope.$apply
- No two-way data binding
- Watchers!!!
2.0
Angular is coming...
- Component based
- One-way Data Flow
- Web Components (Shadow DOM)
- New Router
- New Modules
AtScript
What do we have right now?
The most advanced stack of technologies
what are we using currently?
React
Everything is a component.
MVC
Flux
is the application architecture that Facebook uses for building client-side web applications.
JSX
is a JavaScript syntax extension that looks similar to XML
jscss
It's like React's JSX, but for CSS.
- totally separate from the browser
- makes server-side rendering possible (because Node doesn’t need to have a real DOM API)
Isomorphic
Application written in JavaScript that can run both on the client and on the server.


{% extends "admin/base_site.html" %} {% load staticfiles %} {% block extrahead %} {% endblock %} {% block title %}Generate Link{% endblock %} {% block content %}
The conversation you post online will be available to anyone with the correct address until the beginning of the day you specify.
Save this address and give it to whomever you would like to take your conversation. If you right-click on it and 'copy' the link, you don't have to worry about making a mistake.


Quantity Topping
Quantity
Cheesecake
Special Instructions
Jan
Feb
Mar
Apr
May
Jun
Jul
Aug
Sep
Oct
Nov
Dec


| 43 | (A) | he knewe countres fułł fele & kyngdoms fułł Many |
| 43 | (C) | He knewe contreys fele . & kyndomes manye |
| 43 | (D) | knewe kyngdomes ful fele and cuntres many |
| 42 | (E) | he knew cuntres manye . & kymdomys bothe |
| (Ex) | ---- no text ---- | |
| 43 | (L) | knewe contreys fele kyngdomes manye |
| 38 | (P) | Knew countres fele and kyngedoms many |
| 43 | (U) | he knewe contrees fele / and kyngdomes manye |
| (V) | ---- no text ---- |


--- layout: post title: Learn to code! There's one day left to enroll in this week's +Railsbridge Outreach Workshop for Women... date: type: post published: false status: draft categories: [] tags: [] meta: google_plus_activity_id: z12ejdtgbzmddnk3d234i3fogkmne1adz author: login: admin email<EMAIL_ADDRESS>display_name: admin first_name: Carina C. last_name: Zon ---
Learn to code! There's one day left to enroll in this week's +Railsbridge Outreach Workshop for Women, hosted at +Airbnb. In honor of Railsbridge's 3rd anniversary, we've banished the wait list just this once. So everyone's got a special opportunity to jump into this one. Take advantage now, before enrollment closes at 5pm Tuesday...
STUDENTS: RailsBridge Open Outreach Workshop for Women
RailsBridge Outreach Workshop is intended to reach out to women who are interested in learning Ruby on Rails. Men are welcome to attend if you bring a woman who wants to learn Ruby on Rails too. ** ...


HSNSwitch can be used to change your HotSync name on the fly. I got a new Palm and made it my primary PDA. It inherited the old HotSync name so that I could continue using most of the software I use without a change. I also decided that my old Palm (a Tungsten T) was going to be a replacement for my Gameboy (yes - the original b/w one :-) So I had to find a way to move the games registered for primary Palm to the game-device.
Enter HSNSwitch. Basically, HSNSwitch can change the HotSync name on the fly - that is, before a program/game is launched the name is changed and after the application exits the name is reset.
HSNSwitch (currently) runs on PalmOS 5.x (and 5.x only!).
HSNSwitch is released under the GNU General Public License v2.
You can support this project by donating any amount to my Pay Pal account.
HSNSwitch has been tested on the following hardware:
It may work on your hardware as well. If not, please run HSNDetect. If HSNSwitch runs succesfully on your hardware I'd really like to know about it so that I can update the above list.
v1.5 (2005-09-22) Changed versioning from 1rX to 1.X. HSNSwitch can now also set HotSync ID for application launched from card. v1r4 (2005-04-27) Fixed a minor bug in v1r3 where the HotSync name came out wrong. On the 'Available Applications' form you can enter a letter and the list will scroll to that letter (Requested by Colin Quek). v1r3 (2005-04-27) Application names can now be changed so that the '*' left by PowerRun can be deleted (Requested by Colin Quek). v1r2 (2005-04-26) Added support for the Tungsten E and GSM Treo 650 devices. v1r1 (2005-04-17) First release of HSNSwitch.


WORD JUMBLE
by Arshad Umrethi
Follow steps 1, 2 & 3
1. Choose a Difficulty Level
1
2
3
4
5
2. Now Click:
Run Game
3. Un-Jumble this word:
Submit
Play Again


Some awesome talk about our awesome technology.
Some awesome talk about our awesome relationship creating.
Some awesome talk about our awesome ecosystems.
Alaska's road crews now have real-time information on where winter roads are being buried by snow.
Making it easier for athletic coaches, trainers and teams to reach peak performance through smarter visual and metric capture.
Take control of your devices before building the first prototype.
Stop worrying about how to power your business, and focus on solving problems for your business.
Register NowA framework for the rapid development of business in Things.
Unique and custom user experiences for Enterprises.
Connect solutions for IoT with the Enterprises that need them.
Connect services for IoT with the Enterprises that need them.
From R&D to scale; technology, business, and financial support for the IoT.
Register NowGet Started for Free with $500 per month in credit.
Create New AccountUse our quickstart tutorials and learn to build your business solutinos.
Start LearningExplore our product marketplace and leverage our services for your enterprise solutinos.
Start Building


|
mbed TLS v2.16.11
|
#include <hmac_drbg.h>
Data Fields | |
| mbedtls_md_context_t | md_ctx |
| unsigned char | V [MBEDTLS_MD_MAX_SIZE] |
| int | reseed_counter |
| size_t | entropy_len |
| int | prediction_resistance |
| int | reseed_interval |
| int(* | f_entropy )(void *, unsigned char *, size_t) |
| void * | p_entropy |
HMAC_DRBG context.
Definition at line 112 of file hmac_drbg.h.
| size_t mbedtls_hmac_drbg_context::entropy_len |
entropy bytes grabbed on each (re)seed
Definition at line 121 of file hmac_drbg.h.
| int(* mbedtls_hmac_drbg_context::f_entropy) (void *, unsigned char *, size_t) |
entropy function
Definition at line 127 of file hmac_drbg.h.
| mbedtls_md_context_t mbedtls_hmac_drbg_context::md_ctx |
HMAC context (inc. K)
Definition at line 116 of file hmac_drbg.h.
| void* mbedtls_hmac_drbg_context::p_entropy |
context for the entropy function
Definition at line 128 of file hmac_drbg.h.
| int mbedtls_hmac_drbg_context::prediction_resistance |
enable prediction resistance (Automatic reseed before every random generation)
Definition at line 122 of file hmac_drbg.h.
| int mbedtls_hmac_drbg_context::reseed_counter |
reseed counter
Definition at line 118 of file hmac_drbg.h.
| int mbedtls_hmac_drbg_context::reseed_interval |
reseed interval
Definition at line 124 of file hmac_drbg.h.
| unsigned char mbedtls_hmac_drbg_context::V[MBEDTLS_MD_MAX_SIZE] |
V in the spec
Definition at line 117 of file hmac_drbg.h.


--- layout: page title: "About" description: "" header-img: "img/about-bg.jpg" ---
Programmer/Brazilian Jiu Jitsu practitioner/Musician. Enjoy live music, backpacking, motorcycle rides, beer! I build microservices and data pipelines at Yammer, a product that is changing the way people communicate and collaborate at work. Still figuring out/creating myself and trying out new things in the process.


Seeking a job
Most of us at one time or another need to go out and find a job. Sometimes it is easy, but often it is a challenge. In these difficult economic times, it is harder. This site is dedicated to helping job seekers.
There are many good resources online. The combination of LinkedIn and Meetup are great for business networking. There are job boards and aggregation sites which allow you find job openings at many companies.
It is common for companies to use computer systems to track their interactions with job seekers and filter resumes. What if there was a system for job seeker?
A dashboard from which one could track interactions (e.g., applied for a position, spoke with someone, interviewer with some group) with companies. Investigating what is important to them to allow you to put together a value proposition and hone your elevator pitch.
Social networks are a household word today. One of the seminal works that lead to these social networks is The Strength of Weak Ties
He was a PhD student at John Hopkins University studying how poeple found jobs. Don't go job hunting alone! Today's social networks are big on sharing. The word share appears in Granovetter's paper twice. Leveraging your social network is essential on the job hunt but there is a time when you want to confide in your family, close friends or a mentor. This website can help with that. By default, you nothing is shared. When you want to get some feedback from close associates, you can share your portfolio with them.


WITNESS LIST
Appropriations Committee
February 14, 2017 - 7:30 AM
Cyber Security and IT
On:
Kimbriel, Todd (Dept of Informatiom Resources)
Napier, Stacey (Department of Information Resources)
Deferred Maintenance and Capital Needs
On:
Diehl, Mike (Legislative Budget Board)
Keyton, Sarah (Legislative Budget Board)
Smith, Jordan (Legislative Budget Board)
Registering, but not testifying:
On:
Velasco, Nora (Legislative Budget Board)
State Auditor's Office
On:
Collier, Lisa (State Auditor's Office)
Collier, Lisa (State Auditor's Office)
O'Neill, Audrey (State Auditor's Office)
Registering, but not testifying:
On:
Elliott, Verma (State Auditor's Office)
Griffin, Justin (State Auditor's Office)
White, Tony (State Auditor's Office)
State Benefits at ERS and TRS
On:
Fallon, Katy (Legislative Budget Board)
Simmons, Trevor (Legislative Budget Board)
Registering, but not testifying:
On:
Keyton, Sarah (Legislative Budget Board)
MacLaurin, Andy (LBB)
Velasco, Nora (Legislative Budget Board)
State Contracting
On:
Collier, Lisa (State Auditor's Office)
Corbell, Richard (Legislative Budget Board)
Keyton, Sarah (Legislative Budget Board)
O'Neill, Audrey (State Auditor's office)
1
WITNESS LIST
On:
Pugh, Jacob (Legislative Budget Board)
Registering, but not testifying:
On:
Beachy, Becky (State Auditor's Office)
Boston, Scott (State Auditor's Office)
Comeaux, Amy (Comptroller)
Godfrey, Lauren (State Auditor's Office)
Griffin, Justin (State Auditor's Office)
Hicks, Willie (Sao)
Mlynar, Tessa (State Auditor's Office)
Ngaide, Kelley (Tx state auditors office)
Quereau, Jennifer (Legislative Budget Board)
Scoggins, Kristyn (State Auditor's Office)
Sunset Advisory Commission
On:
Levine, Ken (Sunset Commission)
Registering, but not testifying:
On:
Jones, Jennifer (Texas Sunset Commission)
2


Tyler, The Creator reacts to Drake being booed off stage at Camp Flog Gnaw festival
It's thought fans were disappointed that Frank Ocean wasn't a surprise guest.
Tyler, The Creator has responded after Drake was forced to cut short his surprise headline set at Tyler’s Camp Flog Gnaw Festival, after the rapper faced unrelenting booing from fans.
The Canadian rapper made a surprise appearance at the event on Sunday evening in a headline slot which was also split between Lil Uzi Vert and A$AP Rocky.
However, footage on social media seemingly shows Drake choosing to bring a premature end to his slot, after facing relentless criticism from fans.
 If you wanna keep going, I will keep going”, Drake tells fans in one video.
A large section of fans are then heard delivering a resounding “NO!”, before Drake eventually pulls the plug on the set.
“Look. It’s been love. I love y’all. I go by the name of Drake, thank you for having me.”
Tyler, The Creator performs live
Now, Tyler has responded to the events, taking to his Twitter account.

“BUT FLIPSIDE, A LIL TONE DEAF KNOWING THE SPECIFIC CROWD IT DREW.
Although the reason for the hostility from fans is yet to be properly established, some claim that they were expecting Frank Ocean to be the secret headliner – sparking anger at Drake’s arrival.
One Twitter user wrote: “Soooo, the crowd at Camp Flog Gnaw booed Drake, Uzi, and Rocky off stage because they were mad the surprise guest wasn’t Frank Ocean? Who hurt ya’ll?”
Other acts on Sunday’s line-up at Camp Flog Gnaw included the likes of Brockhampton, H.E.R, YG and Blood Orange.
Meanwhile, it was reported last week that Drake is starting his own cannabis company, selling a varied selection of “cannabis products and accessories, medical cannabis, THC and CBD.”


Wilbert:
Let's see here... The card I took out is:
.
The cards on the table are:
[Wilbert]
[ ]
Luck! Looks like I win. It was a good game, though, eh? If you'd like to play again, feel free to challenge me.
Challenge him again.


Building
Building Name
Number of Floors
Floor to Floor Height
Building Footprint Type
Rectangle
L Shape
T Shape
U Shape
H Shape
Cross Shape
Trapezoid
Triangle
Building List
id#
Building Name
Building Shape
Building Height
{{building.id}}
{{building.name}}
{{building.buildingShape}}
{{building.buildingHeight}} m
Remove


Command Line Tools¶
This chapter describes GeoMesa Tools, a set of command line tools for feature management, query planning and explanation, ingest, and export from the command line.
Installation¶
Running the command line tools¶
Run the geomesa
without any arguments to produce the following usage text:
$ geomesa
Warning: GEOMESA_HOME is not set, using /opt/devel/src/geomesa/geomesa-dist/target/geomesa-1.2.0-SNAPSHOT/dist/tools/geomesa-tools-1.2.0-SNAPSHOT
Usage: geomesa [command] [command options]
Commands:
create Create a feature definition in a GeoMesa catalog
deletecatalog Delete a GeoMesa catalog completely (and all features in it)
deleteraster Delete a GeoMesa Raster Table
describe Describe the attributes of a given feature in GeoMesa
env Examine the current GeoMesa environment
explain Explain how a GeoMesa query will be executed
export Export a GeoMesa feature
getsft Get the SimpleFeatureType of a feature
help Show help
ingest Ingest/convert various file formats into GeoMesa
ingestraster Ingest a raster file or raster files in a directory into GeoMesa
list List GeoMesa features for a given catalog
queryrasterstats Export queries and statistics about the last X number of queries to a CSV file.
removeschema Remove a schema and associated features from a GeoMesa catalog
tableconf Perform table configuration operations
version GeoMesa Version
This usage text lists the available commands. To see help for an individual command,
run geomesa help <command-name>
, which for example will give you something like this:
$ geomesa help list
Warning: GEOMESA_HOME is not set, using /opt/devel/src/geomesa/geomesa-dist/target/geomesa-1.2.0-SNAPSHOT/dist/tools/geomesa-tools-1.2.0-SNAPSHOT
List GeoMesa features for a given catalog
Usage: list [options]
Options:
--auths
Accumulo authorizations
* -c, --catalog
Catalog table name for GeoMesa
-i, --instance
Accumulo instance name
--mock
Run everything with a mock accumulo instance instead of a real one
Default: false
-p, --password
Accumulo password (will prompt if not supplied)
* -u, --user
Accumulo user name
--visibilities
Accumulo scan visibilities
-z, --zookeepers
Zookeepers (host[:port], comma separated)
The Accumulo username and password is required for each command. Specify the
username and password in each command by using -u
(or --username
) and -p
(or
--password
), respectively. One can also only specify the username on the
command line using -u
or --username
and type the password in an additional
prompt, where the password will be hidden from the shell history.
In nearly all commands below, one can add --instance-name
, --zookeepers
,
--auths
, and --visibilities
(or in short form -i
, -z
, -a
, and -v
) arguments
to properly configure the Accumulo data store connector. The Accumulo instance
name and Zookeepers string can usually be automatically assigned as long as
Accumulo is configured correctly. The Auths and Visibilities strings will have
to be added as arguments to each command, if needed.
Command overview¶
Creating and deleting feature types¶
create¶
Used to create a feature type (SimpleFeatureType
) in a GeoMesa catalog:
$ geomesa create -u username -p password \
-i instance -z zoo1,zoo2,zoo3 \
-c test_create \
-f testing \
-s fid:String:index=true,dtg:Date,geom:Point:srid=4326 \
--dtg dtg
describe¶
Display details about the attributes of a specified feature type:
$ geomesa describe -u username -p password -c test_delete -f testing
getsft¶
Get the specified feature type as an encoded feature schema string:
$ geomesa getsft -u username -p password -c test_catalog -f test_feature
list¶
List all known feature types in a GeoMesa catalog:
$ geomesa list -u username -p password -c test_catalog
removeschema¶
Used to remove a feature type (SimpleFeatureType
) in a GeoMesa catalog. This will also delete any feature of that type in the data store:
$ geomesa removeschema -u username -p password \
-i instance -z zoo1,zoo2,zoo3 \
-c test_catalog -f testfeature1
$ geomesa removeschema -u username -p password \
-i instance -z zoo1,zoo2,zoo3 \
-c test_catalog --pattern 'testfeatures\d+'
Ingesting and exporting data¶
export¶
Export GeoMesa features. The “attribute expressions” specified by the -a
option are comma-separated expressions
in the format:
attribute[=filter_function_expression]|derived-attribute=filter_function_expression
filter_function_expression is an expression of filter function applied to attributes, literals and filter functions, i.e. can be nested.
Example export commands:
$ geomesa export -u username -p password \
-c test_catalog -f test_feature \
-a "geom,text,user_name" --format csv \
-q "include" -m 100
$ geomesa export -u username -p password \
-c test_catalog -f test_feature \
-a "geom,text,user_name" --format gml \
-q "user_name='JohnSmith'"
$ geomesa export -u username -p password \
-c test_catalog -f test_feature \
-a "user_name,buf=buffer(geom\, 2)" \
--format csv -q "[[ user_name like `John%' ] AND [ bbox(geom, 22.1371589, 44.386463, 40.228581, 52.379581, 'EPSG:4326') ]]"
ingest¶
Used to convert and ingest data from various file formats as GeoMesa features.
GeoMesa defines several common converter factories for formats such as delimited text (TSV, CSV), fixed width files, JSON, XML, and Avro. New converter factories (e.g. for custom binary formats) can be registered on the classpath using Java SPI. Shapefile ingest is also supported. Files can be either local or in HDFS. You cannot mix target files (e.g. local and HDFS).
Note
The header, if present, is not parsed by ingest
for information. It is assumed that all lines are valid entries.
Converters and SFTs are specified in HOCON format (https://github.com/typesafehub/config/blob/master/HOCON.md) and
loaded using TypeSafe config. They can be referenced by name using the -s
and -C
args.
To define new converters for the users can package a reference.conf
file inside a jar and drop it in the
$GEOMESA_HOME/lib
directory or add config definitions to the $GEOMESA_TOOLS/conf/application.conf
file which
includes some examples. SFT and Converter specifications should use the path prefixes
geomesa.converters.<convertername>
and geomesa.sfts.<typename>
For example...Here’s a simple CSV file to ingest named example.csv
:
ID,Name,Age,LastSeen,Friends,Lat,Lon
23623,Harry,20,2015-05-06,"Will, Mark, Suzan",-100.236523,23
26236,Hermione,25,2015-06-07,"Edward, Bill, Harry",40.232,-53.2356
3233,Severus,30,2015-10-23,"Tom, Riddle, Voldemort",3,-62.23
To ingest this file, a SimpleFeatureType named renegades
and a converter named renegades-csv
can be placed in
the application.conf file:
# cat $GEOMESA_HOME/conf/application.conf
geomesa {
sfts {
renegades = {
attributes = [
{ name = "id", type = "Integer", index = false }
{ name = "name", type = "String", index = true }
{ name = "age", type = "Integer", index = false }
{ name = "lastseen", type = "Date", index = true }
{ name = "friends", type = "List[String]", index = true }
{ name = "geom", type = "Point", index = true, srid = 4326, default = true }
]
}
}
converters {
renegades-csv = {
type = "delimited-text"
format = "CSV"
options {
skip-lines = 1 //skip the header
}
id-field = "toString($id)"
fields = [
{ name = "id", transform = "$1::int" }
{ name = "name", transform = "$2::string" }
{ name = "age", transform = "$3::int" }
{ name = "lastseen", transform = "date('YYYY-MM-dd', $4)" }
{ name = "friends", transform = "parseList('string', $5)" }
{ name = "lon", transform = "$6::double" }
{ name = "lat", transform = "$7::double" }
{ name = "geom", transform = "point($lon, $lat)" }
]
}
}
}
The SFT and Converter can be referenced by name and the following commands can ingest the file:
$ geomesa ingest -u username -p password \
-c geomesa_catalog -i instance \
-s renegates -C renegades-csv example1.csv
# use the Hadoop file system instead
$ geomesa ingest -u username -p password \
-c geomesa_catalog -i instance \
-s renegades -C renegades-csv hdfs:///some/hdfs/path/to/example1.csv
SFT and Converter configs can also be provided as strings or filenames to the -s
and -C
arguments. The syntax is
very similar to the application.conf
and reference.conf
format. Config specifications must be nested using the
paths geomesa.converters.<convertername>
and geomesa.sfts.<typename>
as shown below:
# A nested SFT config provided as a string or file to the -s argument specifying
# a type named "renegades"
#
# cat /tmp/renegades.sft
geomesa.sfts.renegades = {
attributes = [
{ name = "id", type = "Integer", index = false }
{ name = "name", type = "String", index = true }
{ name = "age", type = "Integer", index = false }
{ name = "lastseen", type = "Date", index = true }
{ name = "friends", type = "List[String]", index = true }
{ name = "geom", type = "Point", index = true, srid = 4326, default = true }
]
}
Similarly, converter configurations must be nested when passing them directly to the -C
argument:
# a nested converter definition
# cat /tmp/renegades.convert
geomesa.converters.renegades-csv = {
type = "delimited-text"
format = "CSV"
options {
skip-lines = 0 // don't skip lines in distributed ingest
}
id-field = "toString($id)"
fields = [
{ name = "id", transform = "$1::int" }
{ name = "name", transform = "$2::string" }
{ name = "age", transform = "$3::int" }
{ name = "lastseen", transform = "date('YYYY-MM-dd', $4)" }
{ name = "friends", transform = "parseList('string', $5)" }
{ name = "lon", transform = "$6::double" }
{ name = "lat", transform = "$7::double" }
{ name = "geom", transform = "point($lon, $lat)" }
]
}
Using the SFT and Converter config files we can then ingest our csv file with this command:
# ingest command
geomesa ingest -u username -p password -c geomesa_catalog -i instance -s /tmp/renegades.sft -C /tmp/renegades.convert hdfs:///some/hdfs/path/to/example.csv
For more documentation on converter configuration, refer to the the geomesa-$VERSION/docs/README-convert.md
file
in the binary distribution.
Shape files may also be ingested:
$ geomesa ingest -u username -p password -c test_catalog -f shapeFileFeatureName /some/path/to/file.shp
Enabling S3 Ingest
Hadoop ships with an implementation of an S3 Native filesystem denoted by the prefix s3n://
that can be enabled in
the Hadoop configuration used with GeoMesa Tools. Edit the core-site.xml file in your Hadoop installation. These
instructions apply to Hadoop 2.5.0 and higher. Note that you must have the environmental variable
HADOOP_MAPRED_HOME
set properly in your environment.
<!– core-site.xml –> <property>
<name>fs.s3n.impl</name> <value>org.apache.hadoop.fs.s3native.NativeS3FileSystem</value> <description>Tell hadoop which class to use to access s3 URLs. This change became necessary in hadoop 2.6.0</description> </property><!– Note that you need to make sure HADOOP_MAPRED_HOME is set or some other way of getting this on the classpath –> <property>
<name>mapreduce.application.classpath</name> <value>$HADOOP_MAPRED_HOME/share/hadoop/mapreduce/:$HADOOP_MAPRED_HOME/share/hadoop/mapreduce/lib/:$HADOOP_MAPRED_HOME/share/hadoop/tools/lib/*</value> <description>The classpath specifically for mapreduce jobs. This override is nec. so that s3n URLs work on hadoop 2.6.0+</description></property>
- <property>
- <name>fs.s3n.awsAccessKeyId</name> <value>XXXX YOURS HERE</value>
</property>
- <property>
- <name>fs.s3n.awsSecretAccessKey</name> <value>XXXX YOURS HERE</value>
</property>
After you have enabled S3 in your Hadoop configuration you can ingest with GeoMesa tools. Note that you can still use
the Kleene star (*) with S3. S3 paths are prefixed in hadoop with s3n://
as shown below:
$ geomesa ingest -u username -p password -c geomesa_catalog -i instance -s yourspec -C convert s3n://bucket/path/file s3n://bucket/path/*
Working with raster data¶
deleteraster¶
Delete a given GeoMesa raster table:
$ geomesa deleteraster -u username -p password -t somerastertable -f
ingestraster¶
Ingest one or multiple raster image files into Geomesa. Input files, GeoTIFF or DTED, should be located on the local file system.
Note
Make sure GDAL is installed when doing chunking, which depends on the GDAL utility gdal_translate
.
Input raster files are assumed to have CRS set to EPSG:4326. For non-EPSG:4326 files, they need to be converted into
EPSG:4326 raster files before ingestion. An example of doing conversion with GDAL utility is gdalwarp -t_srs EPSG:4326
input_file out_file
.
Example usage:
$ geomesa ingestraster -u username -p password -t geomesa_raster -f /some/local/path/to/raster.tif
queryrasterstats¶
Export queries and statistics about the n most recent raster queries to a CSV file:
$ geomesa queryrasterstats -u username -p password -t somerastertable -n 10
Performing system administration tasks¶
deletecatalog¶
Delete a GeoMesa catalog table completely, along with all features in it.:
$ geomesa deletecatalog -u username -p password -i instance -z zoo1,zoo2,zoo3 -c test_catalog
env¶
Examines the current GeoMesa tools environment, and prints out simple feature types converters that are available on the current classpath. The available types can be used for ingestion; see the ingest command.
Example usage:
$ geomesa env
explain¶
Explain how a given GeoMesa query will be executed:
$ geomesa explain -u username -p password \
-c test_catalog -f test_feature \
-q "INTERSECTS(geom, POLYGON ((41 28, 42 28, 42 29, 41 29, 41 28)))"
tableconf¶
Perform various table configuration tasks. There are three sub-arguments:
- list - List the configuration options for a GeoMesa table
- describe - Describe a given configuration option for a table
- update - Update a given configuration option for a table
Example commands:
$ geomesa tableconf list -u username -p password \
-c test_catalog -f test_feature -t st_idx
$ geomesa tableconf describe -u username -p password \
-c test_catalog -f test_feature -t attr_idx \
--param table.bloom.enabled
$ geomesa tableconf update -u username -p password \
-c test_catalog -f test_feature -t records \
--param table.bloom.enabled -n true
version¶
Prints out the version, git branch, and commit ID that the tools were built with:
$ geomesa version


HP rejects takeover bid from Xerox
HP Inc. said Sunday it turned down a $33 billion hostile takeover bid from Xerox, saying it undervalued the computer and printer maker.
But the HP board said it still would like to discuss the possibility of reaching a deal with its rival, a venerable US tech company best known for its photocopy machines.
"We recognize the potential benefits of consolidation, and we are open to exploring whether there is value to be created for HP shareholders through a potential combination with Xerox," HP said in a statement.
But the company's board members have "fundamental questions that need to be addressed" first, it added.
It said, for instance, that Xerox's revenue dropped from $10.2 billion to $9.2 billion since June 2018.
And HP is three times more valuable than Xerox with a $27 billion market value.
Hewlett-Packard was one of the first Silicon Valle giants. In 2015, it spun off its enterprise products and services business, and held onto the PC and printer businesses. It was renamed HP Inc.
Xerox, founded in 1906 as Haloid, was the pioneer in photocopy machines, so much so that in the United States, its name became a verb meaning to make a photocopy.


require.js: Define Double Test
Make sure a double define only uses the first one.
More info
Check console for messages


To view a Spectrum screen in HTML/CSS, drag and drop an SCR file, enter a URL to load, or load a sample image:
For more information, visit https://github.com/jonrandy/zxscreen


InitiatedBy(value: KClass<out Flow<*>>)
This annotation is required by any FlowLogic that is designed to be initiated by a counterparty flow. The class must have at least a constructor which takes in a single net.corda.core.identity.Party parameter which represents the initiating counterparty. The FlowLogic that does the initiating is specified by the value property and itself must be annotated with InitiatingFlow.
The node on startup scans for FlowLogics which are annotated with this and automatically registers the initiating to initiated flow mapping.
See Also


 Within this head element you are going to create a meta tag and the attribute will be charset equal to the value of utf-8. So, it would look like (left angle bracket)meta charset="utf-8"(right angle bracket). You will also include the title of your page within this part of the document as well.
Right after the closing head tag, we will create a body tag to place all over our content within. If we type somethiing within our body it will come out just as text with no style. We must remember that CSS controls our styling. We can structure this texy by using the tag H1 which will give it a default setting for the format. We also ahve paragragh tags that are simply represented by (left bracket)p(right bracket)
This is the beginning that you need to be able to slowly begin to talk about the structure of an HTMl document. Next we wil talk about Formatting Pages


4 overrides of BeginBracketExpression
System.Management.Automation (4)
cimSupport\cmdletization\cim\WildcardPatternToCimQueryParser.cs (1)
53
protected override void
BeginBracketExpression
()
engine\regex.cs (3)
850
protected override void
BeginBracketExpression
()
1236
protected override void
BeginBracketExpression
()
1323
protected override void
BeginBracketExpression
()
1 reference to BeginBracketExpression
System.Management.Automation (1)
engine\regex.cs (1)
600
this.
BeginBracketExpression
();


Hong Kong is getting 2 big markets
Hong Kong get chance to become a great city, The city can fulfil its history accomplishment: a port between the west and the east. This can happen only if Hong Kong protesters can hold on, but it's hard to keep energy after prolonged 4 months when 1500 arrested already.
And if we talk about business, Hong Kong will get good share in the 2 markets, the mainland and the west. if they sucessed, they are going to get far more market share than before, no need to say benefits of culture and political advantages. This is quite different view when most citizen witness a lot infrasture damage caused by frontline black fighters.
In history, Hong Kong is a port. It became important after Opium war of 1840, when British became the first naval power after Napoleonic war in Europe, when the dynasty of Qing failed to talk with the west.
Now, it's a same chance. CCP can't keep in good relationship with the west, Hong Kong fight for it's autonomy. The extradition bill is only a fuse, the real struggle is against infiltration of CCP. So, if keep inside 1 country 2 system, Hong Kong should fight for full autonomy, it's to control their government work for their own citizen, and keep rule of law.
If break the framework of 1 country 2 system, Hong Kong is going to be Israel of China. Few think about this way, CCP makes sure they get no weapon.
Anyway, HK is valueless when it lose independence, if they get ruled by mainlander, whether CCP or another central government.
US know all about the above, this is why the US Congress working on Hong Kong Human Rights and Democracy Act. Note, it's in the Congress, councilors and senates from both parties show support of the Act, once passed, it's not going to be changed by president re-election.
What if HK protester lose?
It's worse than before. Even police force can't avoid been look down by their mainlander boss.
It's hard to think clear when HK protester shocked by police brutalities. You can't win by fighting police, no military training, no weapon, no tactic advantages, no interests from the western world.
You can only be great if you can stand between the east and the west, don't cheat yourself, push to the following steps: freedom, democracy, rule of law, autonomy, independence.

Comments to Ming Ju Zheng's video
Hong Kong people looks confused when they get hate by mainland.
It's wrong if you think Hong Kong people don't know who's their mainland fellows, vice versa.
Hong Kong (HK) can get good future only if she can stand independently between the west and the east. If HK can't bridge between the 2 half-spheres, HK can't be more productive over Shenzhen or similar cities where slave factory lower the costs.
So, it's important to say: we fight China Communist Party (CCP) to save Hong Kong. Know that your Five Demands can only beget from CCP, don't cheat yourself any more, my dear HK citizens.
Make it clear you're going to fight for the freedom, be determined to fight the central government even if CCP collapse next year, because it's Hong Kong's destiny to be a bridge between China and the western world.
In history, Hong Kong is a port. It became important after Opium war of 1840, when British became the first global naval power after Napoleonic war in Europe, when the dynasty of Qing failed to balance trade with the west.
Even if HK people like to make successful business only, without the political drama, a degree of independence is a must, either fulfill the autonomy according the basic law or, to an extreme degree, fight for independence. USA know it, so they work on the Hong Kong Human Rights and Democracy Act.
HK lacks chance to become Israel of China, but it's actually a good example.
 It's now, at the precise moment, you get the challenge to become a great city, but if you dare not even to speak: I'm fighting the evil and connect to the righteousness. You're worthless, doomed to lose.
It's very important to stop cheating yourself,
you're fighting CCP.
You make your real enemy laugh when you dare not to talk the truth,
and now, ask yourself again: who satisfy your FIVE demands at last?
Msg to Lucas Video
Please let your friends in Hong Kong know that they MUST talk it clear that they are fighting CCP, China Communist Party.
The 5 demands can only be achieved from CCP, not Carrie LAM, not government of Hong Kong.
The whole world is helping Hong Kong fighting CCP, but what's going to happen if Hong Kong people dare not to talk the truth?
It's painful beaten by corrupted police, but HongKongners' going to make their real enemy laugh if they repeat yelling: Five Demands... but dare not look straight to their real enemy.
I feel danger because CCP is going to be free to pay more attention on HK after Oct. 1, do it now or never.
Please tell your HK friends if you think it's ok.
comments on Glory to Hong Kong
It's time to make it clear, you are anti-CCP and anti-totalitarian.
please speak out now that you are fighting CCP, China Communist Party.
The 5 demands can only be granted by CCP, not Carrie LAM, not government of Hong Kong.
The whole world is helping Hong Kong fighting CCP, but what's going to happen if Hong Kong people dare not to tell the truth?
It's painful beaten by corrupted police, actually CCP control those batons. Hong Kong people is going to make their real enemy laugh if they repeat yelling: Five Demands... but dare not look straight into their real enemy.
It become more danger because CCP is going to move ahead to apply hard hands on HK after Oct. 1. Tell the truth now or never.
Good to let the whole world know chiNAZI coming to kill you instead of being tortured after they cut off internet, push away all journalists, crash all cameras, drug 30k police to next level of brutality. Then they brainwash you to love their abusive mindset, forget all the struggles.

This is the only way to get 5 demands, not one less.
Put a simple word: chiNAZI, or NAZI 2.0 Then the whold word know pretty well how to help you. If you keep crying against brutal police, let's think about it, such brutalities happen all over the world, your foreigner friends lose focus how to help you. And the 5 Demands confuse them, by no means give up the big 5, instead hold up one of you hand express all the fingers, but make it simple with one word: chiNAZI, it NAZI 2.0.
They know immediately how to help: keep your communication, keep freedom of speech, fight again brainwashing, focus on human rights, send more journalists, fix their eyes on police brutalities, watch out mainland military, and so on.
Don't use anti-chinazi, it's waste 4 letters and one symbol, keep it short, cut off all the misleading information, there're always some one who don't know what's ANTI-, and alwasy someone get no time to read 4 more letters, save all of your efforts to get help, it's a fighting against NAZI style oppression. This might be a must to win the 5 demands, not one less.
Please think about it.


Ever wanted to check a gravatar URL, maybe for testing or wondering what your image is set to without having to log into gravatar?
Well now you can!
This was a quick hack I put together when I needed to find my Gravatar Image easily, I see now it would have been easier for me to just log in to Gravatar but not quite as fun!
blueimp/md5 - a JavaScript MD5 library
jQuery - because it's easy, even if I'm only using a couple of lines :x


WITNESS LIST Urban Affairs Committee May 8, 2002-9:00A Interim Charge 1 On: Braziel, Melvin (San Antonio Housing Authority and National Association of Housing and Redevelopment Officials) Bresette, Patrick (Center for Public Policy Priorities) Carrington, Edwina (Texas Department of Housing and Community Affairs) Day, Luz (U.S. Department of Housing and Urban Development) Henneberger, John (Texas Low Income Housing Information Service) Huff, Joe (Brownwood Housing Authority) Langendorf, Jean (United Cerebral Palsy of Texas and Home of Your Own) Maxwell, Susan (Texas Council for Developmental Disabilities) Mayfield, Mark (Marble Falls Housing Authority) Norwood, Jane (Texas Department on Aging) Pelley, Frances (Texoma Housing Partners) Swan, Al (Affordable Housing) Zappasodi, David (National Association of Housing and Redevelopment Officials) Registering, but not testifying: On: Denton, Ann (The Enterprise Foundation)


I am looking for some suggestions for a build that is fun to play and uses at least 15 Paladin levels, gets epic dodge, at least 6 DwD, and I want him to be able to disarm traps and open locks as well, and have some paladin goodies.
 Levelling him should not be a problem, I don't mind xp penalties.
This comes pretty close; though the ED is missing as this one is strength based. A point to start from though
Click Here _________________ -4SakN "never kiss a girl whose brothers have knife scars." "never gamble without knowing a back way out." -Robert Jordan
Well I can make a build using those parameters, I'm just not sure if it's good... I have very little experience with melee/rogue types. Wanted to see how those experienced with this type of character would do it.
edit: That build looks good but it doesn't have any CHA.. Of course on my PW I could get +12 to CHA fairly easily. This is just one of the questions I'm looking at, because I wanted to take advantage of being able to get +12 Cha and use divine might/shield if I'm going to be a paladin. With 18 Cha he would get 10 rounds of divine might/shield but then his AB is worse, and it already doesn't look that good. See what I mean?


Note: Apples are currently not in season.
All oranges are currently out of stock.
You’ve successfully selected the most amazing fruit in the world.