| 程序包 | 说明 |
|---|---|
| org.apache.giraph.conf |
Package of Giraph configuration related things.
|
| org.apache.giraph.edge |
Package of Vertex implementations.
|
| org.apache.giraph.graph |
Package of all the graph related objects, built on the
org.apache.bsp package.
|
| 限定符和类型 | 字段和说明 |
|---|---|
static ClassConfOption<OutEdges> |
GiraphConstants.INPUT_VERTEX_EDGES_CLASS
Vertex edges class to be used during edge input only - optional
|
protected Class<? extends OutEdges<I,E>> |
GiraphClasses.inputOutEdgesClass
Input vertex edges class - cached for fast access
|
protected Class<? extends OutEdges<I,E>> |
GiraphClasses.outEdgesClass
Vertex edges class - cached for fast access
|
static ClassConfOption<OutEdges> |
GiraphConstants.VERTEX_EDGES_CLASS
Vertex edges class - optional
|
| 限定符和类型 | 方法和说明 |
|---|---|
OutEdges<I,E> |
ImmutableClassesGiraphConfiguration.createAndInitializeInputOutEdges()
Create an input
OutEdges instance and
initialize it with the default capacity. |
OutEdges<I,E> |
ImmutableClassesGiraphConfiguration.createAndInitializeOutEdges()
Create a
OutEdges instance and initialize
it with the default capacity. |
OutEdges<I,E> |
ImmutableClassesGiraphConfiguration.createAndInitializeOutEdges(int capacity)
Create a
OutEdges instance and initialize
it with the given capacity (the number of edges that will be added). |
OutEdges<I,E> |
ImmutableClassesGiraphConfiguration.createAndInitializeOutEdges(Iterable<Edge<I,E>> edges)
Create a
OutEdges instance and initialize
it with the given iterable of edges. |
OutEdges<I,E> |
ImmutableClassesGiraphConfiguration.createInputOutEdges()
Create a user
OutEdges used during
edge-based input |
OutEdges<I,E> |
ImmutableClassesGiraphConfiguration.createOutEdges()
Create a user
OutEdges |
| 限定符和类型 | 方法和说明 |
|---|---|
Class<? extends OutEdges<I,E>> |
ImmutableClassesGiraphConfiguration.getInputOutEdgesClass()
Get the user's subclassed
OutEdges used for
input |
Class<? extends OutEdges<I,E>> |
GiraphClasses.getInputOutEdgesClass() |
Class<? extends OutEdges<I,E>> |
ImmutableClassesGiraphConfiguration.getOutEdgesClass() |
Class<? extends OutEdges<I,E>> |
GiraphClasses.getOutEdgesClass()
Get Vertex edges class
|
Class<? extends OutEdges> |
GiraphConfiguration.getOutEdgesClass()
Get the vertex edges class
|
| 限定符和类型 | 方法和说明 |
|---|---|
GiraphClasses |
GiraphClasses.setInputOutEdgesClass(Class<? extends OutEdges> inputOutEdgesClass)
Set OutEdges class used during edge-input (if different from the one
used for computation)
|
void |
GiraphConfiguration.setInputOutEdgesClass(Class<? extends OutEdges> inputOutEdgesClass)
Set the vertex edges class used during edge-based input (if different
from the one used during computation)
|
GiraphClasses |
GiraphClasses.setOutEdgesClass(Class<? extends OutEdges> outEdgesClass)
Set OutEdges class held
|
void |
GiraphConfiguration.setOutEdgesClass(Class<? extends OutEdges> outEdgesClass)
Set the vertex edges class
|
| 限定符和类型 | 接口和说明 |
|---|---|
interface |
MultiRandomAccessOutEdges<I extends org.apache.hadoop.io.WritableComparable,E extends org.apache.hadoop.io.Writable>
Interface for
OutEdges implementations that provide efficient
random access to the edges given the target vertex id. |
interface |
MutableOutEdges<I extends org.apache.hadoop.io.WritableComparable,E extends org.apache.hadoop.io.Writable>
Interface for
OutEdges implementations that have an optimized
mutable edge iterator. |
interface |
ReuseObjectsOutEdges<I extends org.apache.hadoop.io.WritableComparable,E extends org.apache.hadoop.io.Writable>
Empty interface to characterize
OutEdges implementations that
don't keep references to the Edge (or id and value) objects they are passed. |
interface |
StrictRandomAccessOutEdges<I extends org.apache.hadoop.io.WritableComparable,E extends org.apache.hadoop.io.Writable>
Interface for
OutEdges implementations that provide efficient
random access to the edges given the target vertex id. |
| 限定符和类型 | 类和说明 |
|---|---|
class |
ArrayListEdges<I extends org.apache.hadoop.io.WritableComparable,E extends org.apache.hadoop.io.Writable>
|
class |
ByteArrayEdges<I extends org.apache.hadoop.io.WritableComparable,E extends org.apache.hadoop.io.Writable>
OutEdges implementation backed by a byte array. |
class |
ConfigurableOutEdges<I extends org.apache.hadoop.io.WritableComparable,E extends org.apache.hadoop.io.Writable>
Common base class for
OutEdges implementations that require a
configuration. |
class |
HashMapEdges<I extends org.apache.hadoop.io.WritableComparable,E extends org.apache.hadoop.io.Writable>
|
class |
HashMultimapEdges<I extends org.apache.hadoop.io.WritableComparable,E extends org.apache.hadoop.io.Writable>
OutEdges implementation backed by an ArrayListMultimap . |
class |
IntNullArrayEdges
Implementation of
OutEdges with int ids and null edge
values, backed by dynamic primitive array. |
class |
LongDoubleArrayEdges
Implementation of
OutEdges with long ids and double edge
values, backed by dynamic primitive arrays. |
class |
LongDoubleHashMapEdges
OutEdges implementation with long ids and double edge values,
backed by a Long2DoubleOpenHashMap . |
class |
LongNullArrayEdges
Implementation of
OutEdges with long ids and null edge
values, backed by a dynamic primitive array. |
class |
LongNullHashSetEdges
OutEdges implementation with long ids and null edge values,
backed by a LongOpenHashSet . |
class |
MutableEdgesWrapper<I extends org.apache.hadoop.io.WritableComparable,E extends org.apache.hadoop.io.Writable>
Helper class that wraps the current out-edges and inserts them into a new
data structure as they are iterated over.
|
| 限定符和类型 | 方法和说明 |
|---|---|
OutEdges<I,E> |
MutableEdgesWrapper.getNewEdges()
Get the new
OutEdges data structure. |
OutEdges<I,E> |
MutableEdgesWrapper.unwrap()
Moves all the remaining edges to the new data structure, and returns it.
|
| 限定符和类型 | 方法和说明 |
|---|---|
static <I extends org.apache.hadoop.io.WritableComparable,E extends org.apache.hadoop.io.Writable> |
MutableEdgesWrapper.wrap(OutEdges<I,E> edges,
ImmutableClassesGiraphConfiguration<I,?,E,?> conf)
Factory method to create a new wrapper over the existing out-edges.
|
| 限定符和类型 | 方法和说明 |
|---|---|
void |
Vertex.addVertexRequest(I id,
V value,
OutEdges<I,E> edges)
Sends a request to create a vertex that will be available during the
next superstep.
|
Copyright © 2011-2013 The Apache Software Foundation. All Rights Reserved.


include "view-home.html"
include "view-restaurant-search.html"
include "view-restaurant-detail.html"
include "view-restaurant-pictures.html"
include "view-restaurant-order.html"
include "view-member-center.html"
include "view-member-login.html"
include "view-member-profile.html"
include "view-member-contacts.html"
include "view-member-credits.html"
include "view-member-favorites.html"
include "view-member-anniversaries.html"
include "view-member-anniversary-detail.html"
include "view-generic-order-list.html"
include "view-generic-order-detail.html"
include "view-order-list.html"
include "view-order-detail.html"
include "view-product-list.html"
include "view-product-order.html"
include "view-product-redeem.html"
include "view-package-order.html"
include "view-package-order-confirm.html"
include "view-package-order-detail.html"
include "view-attending.html"
include "view-settings.html"
include "view-request-driver.html"
include "view-vvip.html"
include "view-getstarted.html"


Writer Gong Ji Young states the judge involved in Hara's case with ex-boyfriend should be charged
by sl278Writer Gong Ji Young has stated her strong opinions on how Hara's case regarding assault and revenge porn with ex-boyfriend Choi Jong Bum was dealt with.
Gong Ji Young made a long post on her Facebook page on November 25 stating:
"Those who gave the involved boyfriend probation and saw the video should be punished. If the presiding judge saw the video after stating that the contents of the video were essential to see despite Hara's refusal, then they should be punished. On top of that, they only assigned probation and said that the use of the camera had no fault. I trembled as I saw the articles come up today. Everywhere we go there is torture and slaughter. Choi Jong Bum needs to face punishment that is fair for his threat that he would end her career as a celebrity and release the video."
What do you think of this statement?


"As a developer, I don't want to tell my build script what to do,
I want to just tell what (file) I want so the script can then decide what really needs to be done. If anything."
What is iwant
iwant
is a build system. Some of its key features are:
- Powerful: The build "scripts" (programs) are written in Java, which gives the author access to the full power of IDEs and Java libraries, including those being built by the build program (reusing code between build-time and run-time).
- Expressive: The API for writing build programs is fluent, resulting in compact and readable code.
- Ergonomic: The build script author does not need to declare dependencies. If a target (a file with dynamically defined content) refers to another path (source or target) in its definition,
iwant
automatically tracks this as a dependency.
- Parallel: Multi-threaded building is supported by default, transparently. It only needs to be disabled for targets that don't support it (for example because they use shared resources.)
- Easy to use: Command-line user interface utilizes bash completion so the user can avoid a lot of typing by using
tab
- Reproducible:
iwant
bootstraps itself from a specific revision, so the build system itself is also under configuration management, resulting in reproducible build results.
- LAZY: Target evaluation is referentially transparent, which enables maximal laziness. Side effects (like deployments) are explicitly declared in a different way.
Concrete examples, please
To see and try out iwant
in action, please git clone iwant-demo, a multi-module project that uses iwant
as the build system to demonstrate several of its features. Feel free to clone it, to try things out, or even to develop new things for others to learn and reuse.
Also, some more details, like taking iwant
into use, are documented in the tutorial (in a documentation driven manner by descript).
About the project
General status of the project:
- The engine is quite solid. It has been used in several projects for several years, on Linux and Windows. There are some caveats, though (to be fixed later):
- It is not recommended to run several
iwant
processes at the same time by the same user, since the shared cache is not locked.
- It is not recommended to touch sources during build, since timestamp comparison is only done before refreshing targets, resulting in false clean status for a target that is being refreshed while one of its sources is touched.
- The API hasn't yet been stablized so build programs may need modifications when upgrading.
- Although the number of plugins is still small, the utility of
iwant
is already good, because it is easy to extend the functionality by calling shell or ant scripts or java libraries.
For news please see the github project page.
You can track the project progress and plans in the
backlog.txt.
iwant
- developed by Ville Oikarinen since 2009


Welcome to the LinusTechTips 10TB+ Storage Showoff Topic,
(aka the LTT Petabyte Club, as of April 15th, 2014)
Topic:
A topic like this seems to be mandatory on tech forums, so here it is!
In essence this topic is for your large storage systems that you wish to show off.
But it's not limited to large server only, you can also post your smaller build.
As a result this will be a very nice place for people to brainstorm about their own future storage builds!
The list of the systems, along with some statistics about the systems and HDDs used, will be maintained in the post below this one.
Criteria:
Here are the criteria to get in 10TB+ list:
Capacity Calculation:
I decided to make it easy for you by not paying attention to RAID.
So if you have 10 1TB drives then it's 10TB worth of storage.
Always use advertised space, so 1TB=1TB (not 931GB).
Small boot drives and cache drives are excluded from the count, this way we will end up with a nice round number for most systems.
SMALLER SERVERS/Noteworthy builds that didn't make the list:
As I said before, I want this to be a inspirational topic for people who want to build their own server.
But not everyone needs 10TB+, so for noteworthy builds (either due to awesomeness, or just an elegant solution for somebody who wants to build a NAS but doesn't need a huge server), there is a second (unranked/unordered) list. Feel free to submit your storage build even if it doesn't quite match the size criteria and it might just make that list (and it could always get into the actual rankings when you upgrade to more storage).
Builds with less than 10 TB capacity don't count towards the statistics.
Please still use my post as a template for your build even if it is a smaller machine.
External Sites:
This topic is inspired by the topic at Hard Forum, if you want to see huge storage systems then go there.
Another forum I want to point out is the dutch Gathing of Tweakers, but its in dutch so not for everyone (nice pics though)
Last but not least, Serverthehome.com, also a great forum if you want to see nice storage builds.
PS:
English is not my native language and to make things worse I am also a dyslectic, so if you spot some typos please PM me so I can edit them, thank you!
Ranking Script, (added by alpenwasser, 2014-APR-18)
The ranking list is generated by a Perl script, which is hosted in a github repo here, for those interested.
Systems are ranked first by capacity, then by posting date. Builds smaller than 10 TB are split out into a second list, which is not sorted in any particular fashion. If a build with less than 10 TB storage capacity is updated to 10 TB or more, it will automatically be moved into the actual rankings. The statistics are compiled from the main list only.
The total storage capacity is based on the actual rankings, builds with less than 10 TB capacity do not count towards it.


Plato on Github
Report Home
model/model.js
Maintainability
67.24
Lines of code
1606
Difficulty
73.34
Estimated Errors
3.96
Function weight
By Complexity
By SLOC
// this file should not be stolen directly steal('can/util','can/observe', function( can ) { // ## model.js // `can.Model` // _A `can.Observe` that connects to a RESTful interface._ // // Generic deferred piping function /** * @add can.Model */ var pipe = function( def, model, func ) { var d = new can.Deferred(); def.then(function(){ var args = can.makeArray( arguments ), success = true; try { args[0] = model[func](args[0]); } catch(e) { success = false; d.rejectWith(d, [e].concat(args)); } if (success) { d.resolveWith(d, args); } },function(){ d.rejectWith(this, arguments); }); if(typeof def.abort === 'function') { d.abort = function() { return def.abort(); } } return d; }, modelNum = 0, ignoreHookup = /change.observe\d+/, getId = function( inst ) { // Instead of using attr, use __get for performance. // Need to set reading can.Observe.__reading && can.Observe.__reading(inst, inst.constructor.id) return inst.__get(inst.constructor.id); }, // Ajax `options` generator function ajax = function( ajaxOb, data, type, dataType, success, error ) { var params = {}; // If we get a string, handle it. if ( typeof ajaxOb == "string" ) { // If there's a space, it's probably the type. var parts = ajaxOb.split(/\s+/); params.url = parts.pop(); if ( parts.length ) { params.type = parts.pop(); } } else { can.extend( params, ajaxOb ); } // If we are a non-array object, copy to a new attrs. params.data = typeof data == "object" && ! can.isArray( data ) ? can.extend(params.data || {}, data) : data; // Get the url with any templated values filled out. params.url = can.sub(params.url, params.data, true); return can.ajax( can.extend({ type: type || "post", dataType: dataType ||"json", success : success, error: error }, params )); }, makeRequest = function( self, type, success, error, method ) { var args; // if we pass an array as `self` it it means we are coming from // the queued request, and we're passing already serialized data // self's signature will be: [self, serializedData] if(can.isArray(self)){ args = self[1]; self = self[0]; } else { args = self.serialize(); } args = [args]; var deferred, // The model. model = self.constructor, jqXHR; // `destroy` does not need data. if ( type == 'destroy' ) { args.shift(); } // `update` and `destroy` need the `id`. if ( type !== 'create' ) { args.unshift(getId(self)); } jqXHR = model[type].apply(model, args); deferred = jqXHR.pipe(function(data){ self[method || type + "d"](data, jqXHR); return self; }); // Hook up `abort` if(jqXHR.abort){ deferred.abort = function(){ jqXHR.abort(); }; } deferred.then(success,error); return deferred; }, // This object describes how to make an ajax request for each ajax method. // The available properties are: // `url` - The default url to use as indicated as a property on the model. // `type` - The default http request type // `data` - A method that takes the `arguments` and returns `data` used for ajax. /** * @static */ // /** * @function can.Model.bind bind * @parent can.Model.static * @description Listen for events on a Model class. * * @signature `can.Model.bind(eventType, handler)` * @param {String} eventType The type of event. It must be * `"created"`, `"udpated"`, `"destroyed"`. * @param {function} handler A callback function * that gets called with the event and instance that was * created, destroyed, or updated. * @return {can.Model} The model constructor function. * * @body * `bind(eventType, handler(event, instance))` listens to * __created__, __updated__, __destroyed__ events on all * instances of the model. * * Task.bind("created", function(ev, createdTask){ * this //-> Task * createdTask.attr("name") //-> "Dishes" * }) * * new Task({name: "Dishes"}).save(); */ // /** * @function can.Model.unbind unbind * @parent can.Model.static * @description Stop listening for events on a Model class. * * @signature `can.Model.unbind(eventType, handler)` * @param {String} eventType The type of event. It must be * `"created"`, `"udpated"`, `"destroyed"`. * @param {function} handler A callback function * that was passed to `bind`. * @return {can.Model} The model constructor function. * * @body * `unbind(eventType, handler)` removes a listener * attached with [can.Model.bind]. * * var handler = function(ev, createdTask){ * * } * Task.bind("created", handler) * Task.unbind("created", handler) * * You have to pass the same function to `unbind` that you * passed to `bind`. */ // /** * @property {String} can.Model.id id * @parent can.Model.static * The name of the id field. Defaults to `'id'`. Change this if it is something different. * * For example, it's common in .NET to use `'Id'`. Your model might look like: * * Friend = can.Model.extend({ * id: "Id" * },{}); */ /** * @property {Boolean} can.Model.removeAttr removeAttr * @parent can.Model.static * Sets whether model conversion should remove non existing attributes or merge with * the existing attributes. The default is `false`. * For example, if `Task.findOne({ id: 1 })` returns * * { id: 1, name: 'Do dishes', index: 1, color: ['red', 'blue'] } * * for the first request and * * { id: 1, name: 'Really do dishes', color: ['green'] } * * for the next request, the actual model attributes would look like: * * { id: 1, name: 'Really do dishes', index: 1, color: ['green', 'blue'] } * * Because the attributes of the original model and the updated model will * be merged. Setting `removeAttr` to `true` will result in model attributes like * * { id: 1, name: 'Really do dishes', color: ['green'] } * */ ajaxMethods = { /** * @description Specifies how to create a new resource on the server. `create(serialized)` is called * by [can.Model.prototype.save save] if the model instance [can.Model.prototype.isNew is new]. * @function can.Model.create create * @parent can.Model.static * * * @signature `can.Model.create: function(serialized) -> seferred` * * Specify a function to create persistent instances. The function will * typically perform an AJAX request to a service that results in * creating a record in a database. * * @param {Object} serialized The [can.Observe::serialize serialized] properties of * the model to create. * @return {can.Deferred} A Deferred that resolves to an object of attributes * that will be added to the created model isntance. The object __MUST__ contain * an [can.Model.id id] property so that future calls to [can.Model.prototype.save save] * will call [can.Model.update]. * * * @signature `can.Model.create: "[METHOD] /path/to/resource"` * * Specify a HTTP method and url to create persistent instances. * * If you provide a URL, the Model will send a request to that URL using * the method specified (or POST if none is specified) when saving a * new instance on the server. (See below for more details.) * * @param {HttpMethod} METHOD An HTTP method. Defaults to `"POST"`. * @param {STRING} url The URL of the service to retrieve JSON data. * * * @signature `can.Model.create: {ajaxSettings}` * * Specify an options object that is used to make a HTTP request to create * persistent instances. * * @param {can.AjaxSettings} ajaxSettings A settings object that * specifies the options available to pass to [can.ajax]. * * @body * * `create(attributes) -> Deferred` is used by [can.Model::save save] to create a * model instance on the server. * * ## Implement with a URL * * The easiest way to implement create is to give it the url * to post data to: * * var Recipe = can.Model.extend({ * create: "/recipes" * },{}) * * This lets you create a recipe like: * * new Recipe({name: "hot dog"}).save(); * * * ## Implement with a Function * * You can also implement create by yourself. Create gets called * with `attrs`, which are the [can.Observe::serialize serialized] model * attributes. Create returns a `Deferred` * that contains the id of the new instance and any other * properties that should be set on the instance. * * For example, the following code makes a request * to `POST /recipes.json {'name': 'hot+dog'}` and gets back * something that looks like: * * { * "id": 5, * "createdAt":<PHONE_NUMBER> * } * * The code looks like: * * can.Model.extend("Recipe", { * create : function( attrs ){ * return $.post("/recipes.json",attrs, undefined ,"json"); * } * },{}) */ create : { url : "_shortName", type :"post" }, /** * @description Update a resource on the server. * @function can.Model.update update * @parent can.Model.static * @signature `can.Model.update: "[METHOD] /path/to/resource"` * If you provide a URL, the Model will send a request to that URL using * the method specified (or PUT if none is specified) when updating an * instance on the server. (See below for more details.) * @return {can.Deferred} A Deferred that resolves to the updated model. * * @signature `can.Model.update: function(id, serialized) -> can.Deffered` * If you provide a function, the Model will expect you to do your own AJAX requests. * @param {*} id The ID of the model to update. * @param {Object} serialized The [can.Observe::serialize serialized] properties of * the model to update. * @return {can.Deferred} A Deferred that resolves to the updated model. * * @body * `update( id, attrs ) -> Deferred` is used by [can.Model::save save] to * update a model instance on the server. * * ## Implement with a URL * * The easist way to implement update is to just give it the url to `PUT` data to: * * Recipe = can.Model.extend({ * update: "/recipes/{id}" * },{}); * * This lets you update a recipe like: * * Recipe.findOne({id: 1}, function(recipe){ * recipe.attr('name','salad'); * recipe.save(); * }) * * This will make an XHR request like: * * PUT /recipes/1 * name=salad * * If your server doesn't use PUT, you can change it to post like: * * Recipe = can.Model.extend({ * update: "POST /recipes/{id}" * },{}); * * The server should send back an object with any new attributes the model * should have. For example if your server udpates the "updatedAt" property, it * should send back something like: * * // PUT /recipes/4 {name: "Food"} -> * { * updatedAt : "10-20-2011" * } * * ## Implement with a Function * * You can also implement update by yourself. Update takes the `id` and * `attributes` of the instance to be udpated. Update must return * a [can.Deferred Deferred] that resolves to an object that contains any * properties that should be set on the instance. * * For example, the following code makes a request * to '/recipes/5.json?name=hot+dog' and gets back * something that looks like: * * { * updatedAt: "10-20-2011" * } * * The code looks like: * * Recipe = can.Model.extend({ * update : function(id, attrs ) { * return $.post("/recipes/"+id+".json",attrs, null,"json"); * } * },{}); */ update : { data : function(id, attrs){ attrs = attrs || {}; var identity = this.id; if ( attrs[identity] && attrs[identity] !== id ) { attrs["new" + can.capitalize(id)] = attrs[identity]; delete attrs[identity]; } attrs[identity] = id; return attrs; }, type : "put" }, /** * @description Destroy a resource on the server. * @function can.Model.destroy destroy * @parent can.Model.static * * @signature `can.Model.destroy: function(id) -> deferred` * * * * If you provide a function, the Model will expect you to do your own AJAX requests. * @param {*} id The ID of the resource to destroy. * @return {can.Deferred} A Deferred that resolves to the destroyed model. * * * @signature `can.Model.destroy: "[METHOD] /path/to/resource"` * * If you provide a URL, the Model will send a request to that URL using * the method specified (or DELETE if none is specified) when deleting an * instance on the server. (See below for more details.) * * @return {can.Deferred} A Deferred that resolves to the destroyed model. * * * * @body * `destroy(id) -> Deferred` is used by [can.Model::destroy] remove a model * instance from the server. * * ## Implement with a URL * * You can implement destroy with a string like: * * Recipe = can.Model.extend({ * destroy : "/recipe/{id}" * },{}) * * And use [can.Model::destroy] to destroy it like: * * Recipe.findOne({id: 1}, function(recipe){ * recipe.destroy(); * }); * * This sends a `DELETE` request to `/thing/destroy/1`. * * If your server does not support `DELETE` you can override it like: * * Recipe = can.Model.extend({ * destroy : "POST /recipe/destroy/{id}" * },{}) * * ## Implement with a function * * Implement destroy with a function like: * * Recipe = can.Model.extend({ * destroy : function(id){ * return $.post("/recipe/destroy/"+id,{}); * } * },{}) * * Destroy just needs to return a deferred that resolves. */ destroy : { type : "delete", data : function(id){ var args = {}; args.id = args[this.id] = id; return args; } }, /** * @description Retrieve multiple resources from a server. * @function can.Model.findAll findAll * @parent can.Model.static * * @signature `can.Model.findAll( params[, success[, error]] )` * * Retrieve multiple resources from a server. * * @param {Object} params Values to filter the request or results with. * @param {function(can.Model.List)} [success(list)] A callback to call on successful retrieval. The callback recieves * a can.Model.List of the retrieved resources. * @param {function(can.AjaxSettings)} [error(xhr)] A callback to call when an error occurs. The callback receives the * XmlHttpRequest object. * @return {can.Deferred} A deferred that resolves to a [can.Model.List] of retrieved models. * * * @signature `can.Model.findAll: findAllData( params ) -> deferred` * * Implements `findAll` with a [can.Model.findAllData function]. This function * is passed to [can.Model.makeFindAll makeFindAll] to create the external * `findAll` method. * * findAll: function(params){ * return $.get("/tasks",params) * } * * @param {can.Model.findAllData} findAllData A function that accepts parameters * specifying a list of instance data to retreive and returns a [can.Deferred] * that resolves to an array of those instances. * * @signature `can.Model.findAll: "[METHOD] /path/to/resource"` * * Implements `findAll` with a HTTP method and url to retrieve instance data. * * findAll: "GET /tasks" * * If `findAll` is implemented with a string, this gets converted to * a [can.Model.findAllData findAllData function] * which is passed to [can.Model.makeFindAll makeFindAll] to create the external * `findAll` method. * * @param {HttpMethod} METHOD An HTTP method. Defaults to `"GET"`. * * @param {STRING} url The URL of the service to retrieve JSON data. * * @return {JSON} The service should return a JSON object like: * * { * "data": [ * { "id" : 1, "name" : "do the dishes" }, * { "id" : 2, "name" : "mow the lawn" }, * { "id" : 3, "name" : "iron my shirts" } * ] * } * * This object is passed to [can.Model.models] to turn it into instances. * * _Note: .findAll can also accept an array, but you * probably [should not be doing that](http://haacked.com/archive/2008/11/20/anatomy-of-a-subtle-json-vulnerability.aspx)._ * * * @signature `can.Model.findAll: {ajaxSettings}` * * Implements `findAll` with a [can.AjaxSettings ajax settings object]. * * findAll: {url: "/tasks", dataType: "json"} * * If `findAll` is implemented with an object, it gets converted to * a [can.Model.findAllData findAllData function] * which is passed to [can.Model.makeFindAll makeFindAll] to create the external * `findAll` method. * * @param {can.AjaxSettings} ajaxSettings A settings object that * specifies the options available to pass to [can.ajax]. * * @body * * ## Use * * `findAll( params, success(instances), error(xhr) ) -> Deferred` is used to retrieve model * instances from the server. After implementing `findAll`, use it to retrieve instances of the model * like: * * Recipe.findAll({favorite: true}, function(recipes){ * recipes[0].attr('name') //-> "Ice Water" * }, function( xhr ){ * // called if an error * }) //-> Deferred * * * Before you can use `findAll`, you must implement it. * * ## Implement with a URL * * Implement findAll with a url like: * * Recipe = can.Model.extend({ * findAll : "/recipes.json" * },{}); * * The server should return data that looks like: * * [ * {"id" : 57, "name": "Ice Water"}, * {"id" : 58, "name": "Toast"} * ] * * ## Implement with an Object * * Implement findAll with an object that specifies the parameters to * `can.ajax` (jQuery.ajax) like: * * Recipe = can.Model.extend({ * findAll : { * url: "/recipes.xml", * dataType: "xml" * } * },{}) * * ## Implement with a Function * * To implement with a function, `findAll` is passed __params__ to filter * the instances retrieved from the server and it should return a * deferred that resolves to an array of model data. For example: * * Recipe = can.Model.extend({ * findAll : function(params){ * return $.ajax({ * url: '/recipes.json', * type: 'get', * dataType: 'json'}) * } * },{}) * */ findAll : { url : "_shortName" }, /** * @description Retrieve a resource from a server. * @function can.Model.findOne findOne * @parent can.Model.static * * @signature `can.Model.findOne( params[, success[, error]] )` * * Retrieve a single instance from the server. * * @param {Object} params Values to filter the request or results with. * @param {function(can.Model)} [success(model)] A callback to call on successful retrieval. The callback recieves * the retrieved resource as a can.Model. * @param {function(can.AjaxSettings)} [error(xhr)] A callback to call when an error occurs. The callback receives the * XmlHttpRequest object. * @return {can.Deferred} A deferred that resolves to a [can.Model.List] of retrieved models. * * @signature `can.Model.findOne: findOneData( params ) -> deferred` * * Implements `findOne` with a [can.Model.findOneData function]. This function * is passed to [can.Model.makeFindOne makeFindOne] to create the external * `findOne` method. * * findOne: function(params){ * return $.get("/task/"+params.id) * } * * @param {can.Model.findOneData} findOneData A function that accepts parameters * specifying an instance to retreive and returns a [can.Deferred] * that resolves to that instance. * * @signature `can.Model.findOne: "[METHOD] /path/to/resource"` * * Implements `findOne` with a HTTP method and url to retrieve an instance's data. * * findOne: "GET /tasks/{id}" * * If `findOne` is implemented with a string, this gets converted to * a [can.Model.makeFindOne makeFindOne function] * which is passed to [can.Model.makeFindOne makeFindOne] to create the external * `findOne` method. * * @param {HttpMethod} METHOD An HTTP method. Defaults to `"GET"`. * * @param {STRING} url The URL of the service to retrieve JSON data. * * @signature `can.Model.findOne: {ajaxSettings}` * * Implements `findOne` with a [can.AjaxSettings ajax settings object]. * * findOne: {url: "/tasks/{id}", dataType: "json"} * * If `findOne` is implemented with an object, it gets converted to * a [can.Model.makeFindOne makeFindOne function] * which is passed to [can.Model.makeFindOne makeFindOne] to create the external * `findOne` method. * * @param {can.AjaxSettings} ajaxSettings A settings object that * specifies the options available to pass to [can.ajax]. * * @body * * ## Use * * `findOne( params, success(instance), error(xhr) ) -> Deferred` is used to retrieve a model * instance from the server. * * Use `findOne` like: * * Recipe.findOne({id: 57}, function(recipe){ * recipe.attr('name') //-> "Ice Water" * }, function( xhr ){ * // called if an error * }) //-> Deferred * * Before you can use `findOne`, you must implement it. * * ## Implement with a URL * * Implement findAll with a url like: * * Recipe = can.Model.extend({ * findOne : "/recipes/{id}.json" * },{}); * * If `findOne` is called like: * * Recipe.findOne({id: 57}); * * The server should return data that looks like: * * {"id" : 57, "name": "Ice Water"} * * ## Implement with an Object * * Implement `findOne` with an object that specifies the parameters to * `can.ajax` (jQuery.ajax) like: * * Recipe = can.Model.extend({ * findOne : { * url: "/recipes/{id}.xml", * dataType: "xml" * } * },{}) * * ## Implement with a Function * * To implement with a function, `findOne` is passed __params__ to specify * the instance retrieved from the server and it should return a * deferred that resolves to the model data. Also notice that you now need to * build the URL manually. For example: * * Recipe = can.Model.extend({ * findOne : function(params){ * return $.ajax({ * url: '/recipes/' + params.id, * type: 'get', * dataType: 'json'}) * } * },{}) * * */ findOne: {} }, // Makes an ajax request `function` from a string. // `ajaxMethod` - The `ajaxMethod` object defined above. // `str` - The string the user provided. Ex: `findAll: "/recipes.json"`. ajaxMaker = function(ajaxMethod, str){ // Return a `function` that serves as the ajax method. return function(data){ // If the ajax method has it's own way of getting `data`, use that. data = ajaxMethod.data ? ajaxMethod.data.apply(this, arguments) : // Otherwise use the data passed in. data; // Return the ajax method with `data` and the `type` provided. return ajax(str || this[ajaxMethod.url || "_url"], data, ajaxMethod.type || "get") } } can.Model = can.Observe({ fullName: "can.Model", _reqs: 0, /** * @hide * @function can.Model.setup * @parent can.Model.static * * Configures * */ setup : function(base){ // create store here if someone wants to use model without inheriting from it this.store = {}; can.Observe.setup.apply(this, arguments); // Set default list as model list if(!can.Model){ return; } this.List = ML({Observe: this},{}); var self = this, clean = can.proxy(this._clean, self); // go through ajax methods and set them up can.each(ajaxMethods, function(method, name){ // if an ajax method is not a function, it's either // a string url like findAll: "/recipes" or an // ajax options object like {url: "/recipes"} if ( ! can.isFunction( self[name] )) { // use ajaxMaker to convert that into a function // that returns a deferred with the data self[name] = ajaxMaker(method, self[name]); } // check if there's a make function like makeFindAll // these take deferred function and can do special // behavior with it (like look up data in a store) if (self["make"+can.capitalize(name)]){ // pass the deferred method to the make method to get back // the "findAll" method. var newMethod = self["make"+can.capitalize(name)](self[name]); can.Construct._overwrite(self, base, name,function(){ // increment the numer of requests can.Model._reqs++; var def = newMethod.apply(this, arguments); var then = def.then(clean, clean); then.abort = def.abort; // attach abort to our then and return it return then; }) } }); if(self.fullName == "can.Model" || !self.fullName){ self.fullName = "Model"+(++modelNum); } // Add ajax converters. can.Model._reqs = 0; this._url = this._shortName+"/{"+this.id+"}" }, _ajax : ajaxMaker, _makeRequest : makeRequest, _clean : function(){ can.Model._reqs--; if(!can.Model._reqs){ for(var id in this.store) { if(!this.store[id]._bindings){ delete this.store[id]; } } } return arguments[0]; }, /** * @function can.Model.models models * @parent can.Model.static * @description Convert raw data into can.Model instances. * @signature `can.Model.models(data[, oldList])` * @param {Array<Object>} data The raw data from a `[can.Model.findAll findAll()]` request. * @param {can.Model.List} [oldList] If supplied, this List will be updated with the data from * __data__. * @return {can.Model.List} A List of Models made from the raw data. * * @body * `can.Model.models(data, xhr)` is used to * convert the raw response of a [can.Model.findAll] request * into a [can.Model.List] of model instances. * * This method is rarely called directly. Instead the deferred returned * by findAll is piped into `models`. This creates a new deferred that * resolves to a [can.Model.List] of instances instead of an array of * simple JS objects. * * If your server is returning data in non-standard way, * overwriting `can.Model.models` is the best way to normalize it. * * ## Quick Example * * The following uses models to convert to a [can.Model.List] of model * instances. * * Task = can.Model.extend() * var tasks = Task.models([ * {id: 1, name : "dishes", complete : false}, * {id: 2, name: "laundry", compelte: true} * ]) * * tasks.attr("0.complete", true) * * ## Non-standard Services * * `can.Model.models` expects data to be an array of name-value pair * objects like: * * [{id: 1, name : "dishes"},{id:2, name: "laundry"}, ...] * * It can also take an object with additional data about the array like: * * { * count: 15000 //how many total items there might be * data: [{id: 1, name : "justin"},{id:2, name: "brian"}, ...] * } * * In this case, models will return a [can.Model.List] of instances found in * data, but with additional properties as expandos on the list: * * var tasks = Task.models({ * count : 1500, * data : [{id: 1, name: 'dishes'}, ...] * }) * tasks.attr("name") // -> 'dishes' * tasks.count // -> 1500 * * ### Overwriting Models * * If your service returns data like: * * {thingsToDo: [{name: "dishes", id: 5}]} * * You will want to overwrite models to pass the base models what it expects like: * * Task = can.Model.extend({ * models : function(data){ * return can.Model.models.call(this,data.thingsToDo); * } * },{}) * * `can.Model.models` passes each intstance's data to `can.Model.model` to * create the individual instances. */ models: function( instancesRawData, oldList ) { // until "end of turn", increment reqs counter so instances will be added to the store can.Model._reqs++; if ( ! instancesRawData ) { return; } if ( instancesRawData instanceof this.List ) { return instancesRawData; } // Get the list type. var self = this, tmp = [], res = oldList instanceof can.Observe.List ? oldList : new( self.List || ML), // Did we get an `array`? arr = can.isArray(instancesRawData), // Did we get a model list? ml = (instancesRawData instanceof ML), // Get the raw `array` of objects. raw = arr ? // If an `array`, return the `array`. instancesRawData : // Otherwise if a model list. (ml ? // Get the raw objects from the list. instancesRawData.serialize() : // Get the object's data. instancesRawData.data), i = 0; if(typeof raw === 'undefined') { throw new Error('Could not get any raw data while converting using .models'); } //!steal-remove-start if ( ! raw.length ) { steal.dev.warn("model.js models has no data.") } //!steal-remove-end if(res.length) { res.splice(0); } can.each(raw, function( rawPart ) { tmp.push( self.model( rawPart )); }); // We only want one change event so push everything at once res.push.apply(res, tmp); if ( ! arr ) { // Push other stuff onto `array`. can.each(instancesRawData, function(val, prop){ if ( prop !== 'data' ) { res.attr(prop, val); } }) } // at "end of turn", clean up the store setTimeout(can.proxy(this._clean, this), 1); return res; }, /** * @function can.Model.model model * @parent can.Model.static * @description Convert raw data into a can.Model instance. * @signature `can.Model.model(data)` * @param {Object} data The data to convert to a can.Model instance. * @return {can.Model} An instance of can.Model made with the given data. * * @body * `can.Model.model(attributes)` is used to convert data from the server into * a model instance. It is rarely called directly. Instead it is invoked as * a result of [can.Model.findOne] or [can.Model.findAll]. * * If your server is returning data in non-standard way, * overwriting `can.Model.model` is a good way to normalize it. * * ## Example * * The following uses `model` to convert to a model * instance. * * Task = can.Model.extend({},{}) * var task = Task.model({id: 1, name : "dishes", complete : false}) * * tasks.attr("complete", true) * * `Task.model(attrs)` is very similar to simply calling `new Model(attrs)` except * that it checks the model's store if the instance has already been created. The model's * store is a collection of instances that have event handlers. * * This means that if the model's store already has an instance, you'll get the same instance * back. Example: * * // create a task * var taskA = new Task({id: 5, complete: true}); * * // bind to it, which puts it in the store * taskA.bind("complete", function(){}); * * // use model to create / retrieve a task * var taskB = Task.model({id: 5, complete: true}); * * taskA === taskB //-> true * * ## Non-standard Services * * `can.Model.model` expects to retreive attributes of the model * instance like: * * * {id: 5, name : "dishes"} * * * If the service returns data formatted differently, like: * * {todo: {name: "dishes", id: 5}} * * Overwrite `model` like: * * Task = can.Model.extend({ * model : function(data){ * return can.Model.model.call(this,data.todo); * } * },{}); */ model: function( attributes ) { if ( ! attributes ) { return; } if ( typeof attributes.serialize === 'function' ) { attributes = attributes.serialize(); } var id = attributes[ this.id ], model = (id || id === 0) && this.store[id] ? this.store[id].attr(attributes, this.removeAttr || false) : new this( attributes ); if(can.Model._reqs){ this.store[attributes[this.id]] = model; } return model; } }, /** * @prototype */ { /** * @function can.Model.prototype.isNew isNew * @description Check if a Model has yet to be saved on the server. * @signature `model.isNew()` * @return {Boolean} Whether an instance has been saved on the server. * (This is determined by whether `id` has a value set yet.) * * @body * `isNew()` returns if the instance is has been created * on the server. This is essentially if the [can.Model.id] * property is null or undefined. * * new Recipe({id: 1}).isNew() //-> false */ isNew: function() { var id = getId(this); return ! ( id || id === 0 ); // If `null` or `undefined` }, /** * @function can.Model.prototype.save save * @description Save a model back to the server. * @signature `model.save([success[, error]])` * @param {function} [success] A callback to call on successful save. The callback recieves * the can.Model after saving. * @param {function} [error] A callback to call when an error occurs. The callback receives the * XmlHttpRequest object. * @return {can.Deferred} A Deferred that resolves to the Model after it has been saved. * * @body * `model.save([success(model)],[error(xhr)])` creates or updates * the model instance using [can.Model.create] or * [can.Model.update] depending if the instance * [can.Model::isNew has an id or not]. * * ## Using `save` to create an instance. * * If `save` is called on an instance that does not have * an [can.Model.id id] property, it calls [can.Model.create] * with the instance's properties. It also [can.trigger triggers] * a "created" event on the instance and the model. * * // create a model instance * var todo = new Todo({name: "dishes"}) * * // listen when the instance is created * todo.bind("created", function(ev){ * this //-> todo * }) * * // save it on the server * todo.save(function(todo){ * console.log("todo", todo, "created") * }); * * ## Using `save` to update an instance. * * If save is called on an instance that has * an [can.Model.id id] property, it calls [can.Model.create] * with the instance's properties. When the save is complete, * it triggers an "updated" event on the instance and the instance's model. * * Instances with an * __id__ are typically retrieved with [can.Model.findAll] or * [can.Model.findOne]. * * * // get a created model instance * Todo.findOne({id: 5},function(todo){ * * // listen when the instance is updated * todo.bind("updated", function(ev){ * this //-> todo * }) * * // update the instance's property * todo.attr("complete", true) * * // save it on the server * todo.save(function(todo){ * console.log("todo", todo, "updated") * }); * * }); * */ save: function( success, error ) { return makeRequest(this, this.isNew() ? 'create' : 'update', success, error); }, /** * @function can.Model.prototype.destroy destroy * @description Destroy a Model on the server. * @signature `model.destroy([success[, error]])` * @param {function} [success] A callback to call on successful destruction. The callback recieves * the can.Model as it was just prior to destruction. * @param {function} [error] A callback to call when an error occurs. The callback receives the * XmlHttpRequest object. * @return {can.Deferred} A Deferred that resolves to the Model as it was before destruction. * * @body * Destroys the instance by calling * [Can.Model.destroy] with the id of the instance. * * recipe.destroy(success, error); * * This triggers "destroyed" events on the instance and the * Model constructor function which can be listened to with * [can.Model::bind] and [can.Model.bind]. * * Recipe = can.Model.extend({ * destroy : "DELETE /services/recipes/{id}", * findOne : "/services/recipes/{id}" * },{}) * * Recipe.bind("destroyed", function(){ * console.log("a recipe destroyed"); * }); * * // get a recipe * Recipe.findOne({id: 5}, function(recipe){ * recipe.bind("destroyed", function(){ * console.log("this recipe destroyed") * }) * recipe.destroy(); * }) */ destroy: function( success, error ) { if(this.isNew()) { var self = this; var def = can.Deferred(); def.then(success, error); return def.done(function(data) { self.destroyed(data) }).resolve(self); } return makeRequest(this, 'destroy', success, error, 'destroyed'); }, /** * @description Listen to events on this Model. * @function can.Model.prototype.bind bind * @signature `model.bind(eventName, handler)` * @param {String} eventName The event to bind to. * @param {function} handler The function to call when the * event occurs. __handler__ is passed the event and the * Model instance. * @return {can.Model} The Model, for chaining. * * @body * `bind(eventName, handler(ev, args...) )` is used to listen * to events on this model instance. Example: * * Task = can.Model.extend() * var task = new Task({name : "dishes"}) * task.bind("name", function(ev, newVal, oldVal){}) * * Use `bind` the * same as [can.Observe::bind] which should be used as * a reference for listening to property changes. * * Bind on model can be used to listen to when * an instance is: * * - created * - updated * - destroyed * * like: * * Task = can.Model.extend() * var task = new Task({name : "dishes"}) * * task.bind("created", function(ev, newTask){ * console.log("created", newTask) * }) * .bind("updated", function(ev, updatedTask){ * console.log("updated", updatedTask) * }) * .bind("destroyed", function(ev, destroyedTask){ * console.log("destroyed", destroyedTask) * }) * * // create, update, and destroy * task.save(function(){ * task.attr('name', "do dishes") * .save(function(){ * task.destroy() * }) * }); * * * `bind` also extends the inherited * behavior of [can.Observe::bind] to track the number * of event bindings on this object which is used to store * the model instance. When there are no bindings, the * model instance is removed from the store, freeing memory. */ _bindsetup: function(){ this.constructor.store[this.__get(this.constructor.id)] = this; return can.Observe.prototype._bindsetup.apply( this, arguments ); }, /** * @function can.Model.prototype.unbind unbind * @description Stop listening to events on this Model. * @signature `model.unbind(eventName[, handler])` * @param {String} eventName The event to unbind from. * @param {function} [handler] A handler previously bound with `bind`. * If __handler__ is not passed, `unbind` will remove all handlers * for the given event. * @return {can.Model} The Model, for chaining. * * @body * `unbind(eventName, handler)` removes a listener * attached with [can.Model::bind]. * * var handler = function(ev, createdTask){ * * } * task.bind("created", handler) * task.unbind("created", handler) * * You have to pass the same function to `unbind` that you * passed to `bind`. * * Unbind will also remove the instance from the store * if there are no other listeners. */ _bindteardown: function(){ delete this.constructor.store[getId(this)]; return can.Observe.prototype._bindteardown.apply( this, arguments );; }, // Change `id`. ___set: function( prop, val ) { can.Observe.prototype.___set.call(this,prop, val) // If we add an `id`, move it to the store. if(prop === this.constructor.id && this._bindings){ this.constructor.store[getId(this)] = this; } } }); can.each({ /** * @function can.Model.makeFindAll * @parent can.Model.static * * @signature `can.Model.makeFindAll: function(findAllData) -> findAll` * * Returns the external `findAll` method given the implemented [can.Model.findAllData findAllData] function. * * @params {can.Model.findAllData} * * [can.Model.findAll] is implemented with a `String`, [can.AjaxSettings ajax settings object], or * [can.Model.findAllData findAllData] function. If it is implemented as * a `String` or [can.AjaxSettings ajax settings object], those values are used * to create a [can.Model.findAllData findAllData] function. * * The [can.Model.findAllData findAllData] function is passed to `makeFindAll`. `makeFindAll` * should use `findAllData` internally to get the raw data for the request. * * @return {function(params,success,error):can.Deferred} * * Returns function that implements the external API of `findAll`. * * @body * * ## Use * * `makeFindAll` can be used to implement base models that perform special * behavior. `makeFindAll` is passed a [can.Model.findAllData findAllData] function that retrieves raw * data. It should return a function that when called, uses * the findAllData function to get the raw data, convert them to model instances with * [can.Model.models models]. * * ## Caching * * The following uses `makeFindAll` to create a base `CachedModel`: * * CachedModel = can.Model.extend({ * makeFindAll: function(findAllData){ * // A place to store requests * var cachedRequests = {}; * * return function(params, success, error){ * // is this not cached? * if(! cachedRequests[JSON.stringify(params)] ) { * var self = this; * // make the request for data, save deferred * cachedRequests[JSON.stringify(params)] = * findAllData(params).then(function(data){ * // convert the raw data into instances * return self.models(data) * }) * } * // get the saved request * var def = cachedRequests[JSON.stringify(params)] * // hookup success and error * def.then(success,error) * return def; * } * } * },{}) * * The following Todo model will never request the same list of todo's twice: * * Todo = CachedModel({ * findAll: "/todos" * },{}) * * // widget 1 * Todo.findAll({}) * * // widget 2 * Todo.findAll({}) */ makeFindAll : "models", /** * @function can.Model.makeFindOne * @parent can.Model.static * * @signature `can.Model.makeFindOne: function(findOneData) -> findOne` * * Returns the external `findOne` method given the implemented [can.Model.findOneData findOneData] function. * * @params {can.Model.findOneData} * * [can.Model.findOne] is implemented with a `String`, [can.AjaxSettings ajax settings object], or * [can.Model.findOneData findOneData] function. If it is implemented as * a `String` or [can.AjaxSettings ajax settings object], those values are used * to create a [can.Model.findOneData findOneData] function. * * The [can.Model.findOneData findOneData] function is passed to `makeFindOne`. `makeFindOne` * should use `findOneData` internally to get the raw data for the request. * * @return {function(params,success,error):can.Deferred} * * Returns function that implements the external API of `findOne`. * * @body * * ## Use * * `makeFindOne` can be used to implement base models that perform special * behavior. `makeFindOne` is passed a [can.Model.findOneData findOneData] function that retrieves raw * data. It should return a function that when called, uses * the findOneData function to get the raw data, convert them to model instances with * [can.Model.models models]. * * ## Caching * * The following uses `makeFindOne` to create a base `CachedModel`: * * CachedModel = can.Model.extend({ * makeFindOne: function(findOneData){ * // A place to store requests * var cachedRequests = {}; * * return function(params, success, error){ * // is this not cached? * if(! cachedRequests[JSON.stringify(params)] ) { * var self = this; * // make the request for data, save deferred * cachedRequests[JSON.stringify(params)] = * findOneData(params).then(function(data){ * // convert the raw data into instances * return self.model(data) * }) * } * // get the saved request * var def = cachedRequests[JSON.stringify(params)] * // hookup success and error * def.then(success,error) * return def; * } * } * },{}) * * The following Todo model will never request the same todo twice: * * Todo = CachedModel({ * findOne: "/todos/{id}" * },{}) * * // widget 1 * Todo.findOne({id: 5}) * * // widget 2 * Todo.findOne({id: 5}) */ makeFindOne: "model", makeCreate: "model", makeUpdate: "model" }, function( method, name ) { can.Model[name] = function( oldMethod ) { return function() { var args = can.makeArray(arguments), oldArgs = can.isFunction( args[1] ) ? args.splice( 0, 1 ) : args.splice( 0, 2 ), def = pipe( oldMethod.apply( this, oldArgs ), this, method ); def.then( args[0], args[1] ); // return the original promise return def; }; }; }); can.each([ /** * @function can.Model.prototype.created created * @hide * Called by save after a new instance is created. Publishes 'created'. * @param {Object} attrs */ "created", /** * @function can.Model.prototype.updated updated * @hide * Called by save after an instance is updated. Publishes 'updated'. * @param {Object} attrs */ "updated", /** * @function can.Model.prototype.destroyed destroyed * @hide * Called after an instance is destroyed. * - Publishes "shortName.destroyed". * - Triggers a "destroyed" event on this model. * - Removes the model from the global list if its used. * */ "destroyed"], function( funcName ) { can.Model.prototype[funcName] = function( attrs ) { var stub, constructor = this.constructor; // Update attributes if attributes have been passed stub = attrs && typeof attrs == 'object' && this.attr(attrs.attr ? attrs.attr() : attrs); // triggers change event that bubble's like // handler( 'change','1.destroyed' ). This is used // to remove items on destroyed from Model Lists. // but there should be a better way. can.trigger(this,"change",funcName) //!steal-remove-start steal.dev.log("Model.js - "+ constructor.shortName+" "+ funcName); //!steal-remove-end // Call event on the instance's Class can.trigger(constructor,funcName, this); }; }); // Model lists are just like `Observe.List` except that when their items are // destroyed, it automatically gets removed from the list. /** * @constructor can.Model.List * @inherits can.Observe.List * @parent canjs * @download can/model * @test can/model/qunit.html * * Works exactly like [can.Observe.List] and has all of the same properties, * events, and functions as an observable list. The only difference is that * when an item from the list is destroyed, it will automatically get removed * from the list. * * ## Creating a new Model List * * To create a new model list, just use `new {model_name}.List(ARRAY)` like: * * var todo1 = new Todo( { name: "Do the dishes" } ), * todo2 = new Todo( { name: "Wash floors" } ) * var todos = new Todo.List( [todo1, todo2] ); * * ### Model Lists in `can.Model` * [can.Model.findAll can.Model.findAll] or [can.Model.models] will * almost always be used to return a `can.Model.List` object, even though it * is possible to create new lists like below: * * var todos = Todo.models([ * new Todo( { name: "Do the dishes" } ), * new Todo( { name: "Wash floors" } ) * ]) * * todos.constructor // -> can.Model.List * * // the most correct way to get a can.Model.List * Todo.findAll({}, function(todos) { * todos.constructor // -> can.Model.List * }) * * ### Extending `can.Model.List` * * Creating custom `can.Model.Lists` allows you to extend lists with helper * functions for a list of a specific type. So, if you wanted to be able to * see how many todos were completed and remaining something could be written * like: * * Todo.List = can.Model.List({ * completed: function() { * var completed = 0; * this.each(function(i, todo) { * completed += todo.attr('complete') ? 1 : 0 * }) * return completed; * }, * remaining: function() { * return this.attr('length') - this.completed(); * } * }) * * Todo.findAll({}, function(todos) { * todos.completed() // -> 0 * todos.remaining() // -> 2 * }); * * ## Removing models from model list * * The advantage that `can.Model.List` has over a traditional `can.Observe.List` * is that when you destroy a model, if it is in that list, it will automatically * be removed from the list. * * // Listen for when something is removed from the todos list. * todos.bind("remove", function( ev, oldVals, indx ) { * console.log(oldVals[indx].attr("name") + " removed") * }) * * todo1.destroy(); // console shows "Do the dishes removed" * * */ var ML = can.Model.List = can.Observe.List({ setup: function(params){ if( can.isPlainObject(params) && ! can.isArray(params) ){ can.Observe.List.prototype.setup.apply(this); this.replace(this.constructor.Observe.findAll(params)) } else { can.Observe.List.prototype.setup.apply(this,arguments); } }, _changes: function(ev, attr){ can.Observe.List.prototype._changes.apply(this, arguments ); if(/\w+\.destroyed/.test(attr)){ var index = this.indexOf(ev.target); if (index != -1) { this.splice(index, 1); } } } }) return can.Model; })


Here's a selection of the standard classes applied to create various divisions of content
A common problem with responsive grids is knowing what will happen at a given breakpoint. To make this easier griddles provides classes to make it clear to the author what will happen at a given breakpoint
Show only current breakpoint(s)
Hide something on smaller screens, but keeping them in flow


%(title)s
LogoWord
withSubWord
GO TO 1
GO TO 2
%(table_of_contents)s
%(main)s
Here goes a footer, if desired, maybe with author(s) and a copyright ©


value != -1 && value > 0
the first part is redundant, because if it's false
then the second part is also false. Or in condition like obj != null && obj instanceof String
the null-check is redundant as instanceof implies non-nullity.
New in 2018.3


[Note that followups are directed to rec.arts.movies.current-films and rec.arts.movies.startrek.current only, not to rec.arts.sf.movies. -Moderator]
STAR TREK: FIRST CONTACT A film review by Michael Dequina Copyright 1996 Michael Dequina
Star Trek: First Contact (PG-13) *** (out of ****) Anyone familiar with the series of Star Trek movies knows of the "even-odd pattern"--the even-numbered installments of the series are good while the odd-numbered ones are, well, not-so-good. The pattern continues with the new Star Trek: First Contact, an energetic sci-fi adventure that (coincidentally?) is the eighth entry in the hugely popular series. In this first Trek feature to feature only cast members from the late Star Trek: The Next Generation television series, Captain Jean-Luc Picard (Patrick Stewart) and the rest of the 24th-century crew of the Starship Enterprise--Commander Will Riker (Jonathan Frakes, who also directed), android Lt. Cmdr. Data (Brent Spiner), Lt. Cmdr. Geordi LaForge (LeVar Burton), Lt. Cmdr. Worf (Michael Dorn), Dr. Beverly Crusher (Gates McFadden), and Counselor Deanna Troi (Marina Sirtis)--travel back to 21st-century earth while doing battle with the Borg, a race of cybernetic beings that share a collective mind with the Borg Queen (Alice Krige). The Borg intend to alter history and assimilate all of humankind into their race--starting with the earth-orbiting crew of the Enterprise and a 21st century stowaway (Alfre Woodard). This is an interesting plotline that is sure to mesmerize Trekkers everywhere and engage everyone else, but, unfortunately, it only makes up the Star Trek half of the script by Brannon Braga and Ronald D. Moore. The other half of the title--First Contact--refers to a subplot that takes place on 21st-century earth, where Riker, Troi, and LaForge meet legendary scientist Zephram Cochran (James Cromwell), who is about to embark on the first warp speed flight in human history, which directly leads to the first contact with extraterrestrials. While this story does tie into the main plot and pays off interestingly in the end, it is nowhere near as involving or exciting as the Borg battles on the Enterprise. Not helping matters is the tiresome Cochran character, an eccentric whose drunken schtick starts out funny but becomes too one-note after a while. In the end, though, the First Contact subplot doesn't detract from the enjoyment of the film as a whole. The story is typical sci-fi fantasy, but the conviction of the cast--most notably the always-phenomenal Stewart--makes you believe and care. Frakes, making his feature directorial debut, keeps the action swiftly rolling along and delivers the action goods, even upping the violence a notch (this is the first Trek film to bear a PG-13 rating) to greater effect. ST:FC has a bigger budget than the last Trek outing, the middling Star Trek Generations, and it definitely shows on screen--the production design and especially visual and makeup effects are outstanding (in particular those involving the Borg Queen). Braga and Moore's mostly sharp script will please both Trek devotees and the rest; the references to the Borg storyline in the TV series, the continuity with the previous film (e.g. the ongoing saga of Data's emotion chip), and a fleeting Star Trek: Voyager crossover will make Trekkers squeal with delight, but such points are made easily accessible to those less familiar to the Trek mythos. Paramount was reportedly worried about the staying power of its Trek franchise with the Next Generation cast now carrying the helm. Based on the entertaining success that is Star Trek: First Contact, I'd say the studio has nothing to worry about (at least not until this cast retires and the crew of the wan Star Trek: Deep Space Nine takes over...).
Michael Dequina<EMAIL_ADDRESS>/<EMAIL_ADDRESS>Visit Mr. Brown's Movie Site at http://members.tripod.com/~MrBrown/ Personal Page: http://members.tripod.com/~MrBrown/home.html
The review above was posted to the
rec.arts.movies.reviews newsgroup (de.rec.film.kritiken for German reviews).
The Internet Movie Database accepts no responsibility for the contents of the
review and has no editorial control. Unless stated otherwise, the copyright
belongs to the author.
Please direct comments/criticisms of the review to relevant newsgroups.
Broken URLs inthe reviews are the responsibility of the author.
The formatting of the review is likely to differ from the original due
to ASCII to HTML conversion.
Related links: index of all rec.arts.movies.reviews reviews


--- layout: post status: publish published: true title: Windows Server 2008 on MSDN author: display_name: Tomas Restrepo login: tomasr email<EMAIL_ADDRESS>url: http://winterdom.com/ author_login: tomasr author_email<EMAIL_ADDRESS>author_url: http://winterdom.com/ wordpress_id: 994 wordpress_url: http://winterdom.com/2008/02/windowsserver2008onmsdn date: '2008-02-11 05:28:16 +0000' date_gmt: '2008-02-11 05:28:16 +0000' categories: - Development tags: [] comments: [] ---
I had seen the RTM announcement but no mention on when it might be in MSDN. Took a look yesterday, and it was already available, cool :-). At least the Datacenter/Enterprise/Standard DVD for x86 and x64, Itanium (those are still around?) and Web Server seem to be available.
I'll need to spend some time installing it on a VM to take a good look.


CSS Positioning{ Elements: Attributes }{ display: inline, block, inline-block; }Inline is default, block works like the <p> tag, it creates vertically arranged chunks, inline-block puts multiple chunks on the same line. Also check out this blog post. { position: static, fixed, relative, absolute; }
left; right; top; bottom;These elements accept numbers that represent how far away an object will be from the named element. For example, left: 0; indicates a position aligned with the left (of the parent element), and left: 20px; would align the element 20 px from the left (of the parent element). Use with position relative, absolute, or fixed. { float: left, right; } { clear: left, right, both; }Clear specifies on which side of the element floating elements are not allowed to float. For example, clear: right; would prohibit any floating elements to the right of the current element. Use float with position: static, or position: relative. Pixels (px) vs. Relative-to-element (em) vs. Percentage (%)Pixels will make an element a fixed size relative to pixels on the screen. for example 'width: 50px;' would make the element 50 pixels wide. em will set the element relative to the current size of the element. For example, 0.5em means half the size of the current font. Percentage will set the element as a percentage of the current size of the browser. For example, 'width: 50%;' will make the element half the size of the parent element or the browswer How-To Guide
The Art of CenteringUse these CSS settings to center an <img> or a <div>: img, div { Content Alignment{ text-align: left, right, center; } |
|
Created By Mark & Kelly |


"""Keep alive object that is created with each request to
faciliate the sending of keep alive messages
Classes:
* :class:`CTAPHIDKeepAlive`
"""
"""
© Copyright 2020-2021 University of Surrey
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
 IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
"""
import threading
import logging
import time
from ctap.messages import CTAPHIDKeepAliveResponse
import ctap.constants
log = logging.getLogger('debug')
[docs]class CTAPHIDKeepAlive():
"""Class to automatically send keep-alive messages during the processing of a
request
"""
def __init__(self, ctaphid:'CTAPHID'):
"""Creates a new keep alive instance. This won't do anying unless
start is called, leaving it up to the authenticator to decide
whether to send keep-alive messages or not
Args:
ctaphid (CTAPHID): underlying CTAP HID device to send keep alive
messages with
"""
self._interval = (1/1000)*1000
self._ctaphid = ctaphid
self._cid = None
self._status = ctap.constants.CTAPHID_KEEPALIVE_STATUS.STATUS_PROCESSING
self._running = False
self._keep_alive_thread = None
self._elapsed =0
self._max = 0
[docs] def set_cid(self, cid:bytes):
"""Sets the channel ID
Args:
cid (bytes): channel id bytes
"""
self._cid = cid
[docs] def start(self, max_val=120000):
"""starts the keep alive sender. This will send keep-alive messages
at interval set in _interval which is every second. It will keep
sending them until the max_val is reached and will then stop
Args:
max_val (int, optional): maximum period for which keep alive
messages should be sent. Defaults to 120000 milliseconds/
120 seconds/2 minutes.
Raises:
Exception: thrown if no channel has been set
"""
if self._cid is None:
raise Exception("Keep-alive channel not set")
log.debug("Start keep-alive called")
self._max = max_val/1000
self._keep_alive_thread = threading.Thread(target=self._keep_alive)
self._running = True
self._keep_alive_thread.setDaemon(True)
self._keep_alive_thread.start()
[docs] def stop(self):
"""Stop the keep alive sender. This will stop after the next interval
has expired
"""
self._running = False
[docs] def update_status(self, status:ctap.constants.CTAPHID_KEEPALIVE_STATUS):
"""Change the status being sent in the keep-alive message
Args:
status (ctap.constants.CTAPHID_KEEPALIVE_STATUS): new status to send
"""
log.debug("Keep-alive status updated")
self._status = status
self._send_keep_alive()
def _send_keep_alive(self):
"""Sends the keep alive message
"""
self._ctaphid.send_keep_alive_response(CTAPHIDKeepAliveResponse(self._cid,self._status))
def _keep_alive(self):
"""Function that runs in the thread to trigger the keep-alive messages
"""
while self._running:
self._send_keep_alive()
time.sleep(self._interval)
self._elapsed = self._elapsed + self._interval
if self._elapsed > self._max:
log.debug("Max keep-alive exceeded - will stop")
self._running = False
log.debug("Keep-alive ended")
self._cid = None


CEO & Founder
Some text that describes me lorem ipsum ipsum lorem.
<EMAIL_ADDRESS>Contact
Director
<EMAIL_ADDRESS>Senior Architect
john@example.com


In this project, i build some custom plugins for the page and modified the original theme to the client's needs.
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Amet numquam aspernatur!


Next: FORMAT Miscellaneous Pseudo-Operations, Previous: FORMAT Control-Flow Operations, Up: Formatted Output


Track, manage and deliver all types of work-based training with our eportfolio. Monitor learner progress, assess remotely and generate real-time reports anytime, anywhere, on any device – even when you’re offline.
Create, upload and share resources, from course textbooks to video content. Integrate with our eportfolio to map criteria against outcomes, track progress and send instant feedback using one unified system.
Learning never stops with OneFile – the most powerful tool for professional development. Create a rich bank of evidence to prove your competencies and take it wherever your career takes you – it’s your portfolio for life.
OneFile is the UK’s only learning platform that brings training and assessment together – so users can access all the training tools they need in one place.
Let’s work together.
We use cookies to ensure you receive the best experience on our website. By using this site you're agreeing to our cookies policy.


PROBLEM SOLVING TECHNIQUES
Approaches to Problem Solving
In this post I will discuss the use of certain techniques to overcome blocks when solving problems
Blocked on a Simple Problem:
While attempting to solve one of the kata challenges, I became blocked on a problem, which was simple as it was syntax related however because of this my code was returning an error.
I was trying to pass the final deBee test using the .toUpperCase()
method.
I was using the built-in method filter
and was passing the test to remove 'buzz' words.
The filter()
method creates a new array with all elements that pass the test executed by the function provided.
Test - Pass
//deBee should return a string where the word buzz has been removed
const filterBuzz = words.filter(word => word != "buzz");
To pass the first test did involve understanding the use of the filter
method, however when I ran the test again with the .toUpperCase
method I could not figure out why it was working.
The .toUpperCase
method converts a string to uppercase letters, without changing the original string
In this challenge it was required to change the string 'buzz' to uppercase in order to pass the final test:
Test - Fail
//deBee should return a string where the word buzz has been removed, regardless of capitalization.
const filterBuzz = words.filter(word => word.toUpperCase != "BUZZ");
This failed test was due to syntax - forgetting the ( ) on the method .toUpperCase
the error message here was not helpful so I had to Google the method, and then tried it out in my code editor and found the problem
I already knew syntax was important, however from this I did learn to be more careful when writing the functions to ensure syntax is correct, as a simple problem like this can still be a large blocker - especially when you are new to programming.
Elegant Problem Solving
My most elegant attempt (still finding my feet with JS) at solving a problem was during the JS Gradebook challenge, this is where I combined a few different problem solving techniques including:
- Pseudocode
- Googling
- Trying something
- Reading error messages
During this exercise I felt that, because of these techniques my problem solving flow had vastly improved (not hard). I also began to feel more confident using Javascript during this challenge.
Problem Solving Techniques
- Pseudocode
(med) - I have only just discovered pseudocode, and definitely rely on it in order to solve problems – if I don’t use it, it feels like I am trying to open a window which is glued shut. - Trying something (high) – When approaching problems, I don’t like to feel as if I am getting nowhere, so I will try different things until I understand where I am going wrong, or better yet – solve the problem!
- Rubber ducky method (med) – I am usually studying in a public space, so I cannot exactly start talking to an inanimate object.. or can I? I have not used this method much, but know it does yield results.
- Reading error messages (med) – I find error messages useful, especially for syntax errors, not so much for more complex problems.
- Console.logging (med) – This helps a lot with debugging and understanding code, and I am reasonably confident with the use of console.log()
- Googling (high) – Googling is great, when I know what it is I am looking for! And additionally it helps to go over methods/functions etc. and check syntax. Big fan of Google, I cannot imagine what it would have been like to be a programmer in the 90’s.
- Asking your peers/coaches for help (med) – This is an approach I have seldom utilised, however I think my confidence with this will increase during Bootcamp, as I am starting to find the challenges more difficult.
- Improving your process with reflection (high) – I really do find reflecting on challenges, and learning, to be a useful practice. It can help solidify the information gained, and highlight any gaps in knowledge – I use this one a lot.


We're currently approaching GitHub Actions v2 shipping publicly for everyone to use. I'm personally super excited about this because it means I don't need to configure an external service to run my CI – I can slap in some YAML, and I'm off with a cross-platform (!) CI system with multiple versions of Node.js installed.
For me, that's bliss. No need to go to an external site; everything is very neatly contained. That said, when I've used other CI services in the past (primarily Travis CI and Azure Pipelines) I've generally just copy/pasted someone else's CI configuration from the beginning and then tweaked it with additional context.
This time though, there's minimal prior context. During the beta of Actions v2, GitHub has published a few different CI templates that I could copy/paste certain parts from. However, there are a few standards I hold all of my projects to:
npm install
should pass on the latest versions of all operating systemsnpm test
should pass on the latest versions of all operating systemsnpm install
and npm test
should succeed without fail on all currently supported Node.js versionsThis ends up meaning I have a matrix of anywhere from 9 (3 versions multiplied by three operating systems) to 12 (4 versions multiplied by three operating systems) CI runs on every project at any time. I've found that the implementation of how to achieve this varies greatly depending on the CI system.
Given that there's not going to be a massive amount of prior art on release, I figured I'd begin building out some comprehensive templates so at launch people will have something to easily copy/paste and then tweak to suit their exact needs.
After working on adding GitHub Actions CI to good-first-issue, I figured I should probably abstract the CI file into a repo, so it's a bit more accessible.
As such, last night, I built out GitHub Actions CI Templates. Initially, I shipped it with a single template that covered my needs around Node.js and npm, but as of about an hour ago I've added two additional templates: Node.js and Yarn, and Node.js and pnpm.
If you'd like to check out the templates, they're all relatively straightforward as far as YAML goes:
npm install
and npm test
.yarn install
and yarn test
.pnpm install
and pnpm test
.The templates all follow a relatively similar structure. I figured I'd walk you through each line of code of the Node.js Cross-Platform file to help ensure that they're understandable to you. Let's go line by line, with code on the top and the description on the bottom:
name: Node.js Cross-platform CI (using Yarn)
The above line is the title of the entire CI script, as it'll show up in the Actions
tab of the GitHub repo.
Relevant docs:
on: [push]
The above line indicates the trigger for a run. For most CI cases, [push]
will be ideal since you want it to run every time you push code to the repo or to a PR.
Relevant docs:
jobs:
Workflows are composed of one or more jobs. This line is an indicator that we've got multiple jobs to be run.
Relevant docs:
jobs
build:
This one is the job_id
of our specific job. Since we're running a build, I named this build
but this specific name has no semantic meaning inside of GitHub Actions CI itself.
Relevant docs:
runs-on: $
This is a required property, which tells the CI run what kind of machine it should be running on. In our case, we've added some complexity by adding a matrix of operating systems that need to be built against. That said, the context of the matrix gets hoisted, and we can use that context here.
One key thing to note from the docs:
Each job runs with a fresh instance of the virtual environment specified in by runs-on.
Meaning, every job is running a clean instance of whatever OS is selected. This is table stakes for CI, but it's always useful to keep it in mind. ❤
Relevant docs:
jobs.<job_id>.runs-on
strategy:
Having a strategy
line is the way to begin defining a matrix of environments to run your builds in.
Relevant docs:
matrix:
The tl;dr of a matrix is that it's the set of all the pieces of context you'll want to run against. The most straightforward matrix is one row – for example, multiple Node.js versions on a single platform.
A simple matrix:
| ubuntu-latest |
|---|
| Node.js 8 |
| Node.js 10 |
| Node.js 12 |
That said, JavaScript and Node.js applications are effectively run on all three of the major operating systems in the world as a part of developer workflows. Often, we'll want to run on the three major operating systems to ensure that there are no unexpected platform-specific bugs that are going to occur – especially in open source when there are very few direct paths to end-users. Luckily, a matrix makes this relatively straightforward.
By adding in multiple operating systems, our matrix gets more complex:
| ubuntu-latest | macos-latest | windows-latest |
|---|---|---|
| Node.js 8 | Node.js 8 | Node.js 8 |
| Node.js 10 | Node.js 10 | Node.js 10 |
| Node.js 12 | Node.js 12 | Node.js 12 |
But... that's only the latest versions of each platform. What about older versions that we may often need to support? Well, it turns out that we can also use older versions of each platform in GitHub Actions CI, which could even further complicate the matrix:
| ubuntu-latest | ubuntu-16.04 | macos-latest | macOS-10.14 | windows-latest | windows-2016 |
|---|---|---|---|---|---|
| Node.js 8 | Node.js 8 | Node.js 8 | Node.js 8 | Node.js 8 | Node.js 8 |
| Node.js 10 | Node.js 10 | Node.js 10 | Node.js 10 | Node.js 10 | Node.js 10 |
| Node.js 12 | Node.js 12 | Node.js 12 | Node.js 12 | Node.js 12 | Node.js 12 |
And this is currenlty a downtime for Node.js builds. Half of the year (every year) there are 4 supported release lines, which would look more like this:
| ubuntu-latest | ubuntu-16.04 | macos-latest | macOS-10.14 | windows-latest | windows-2016 |
|---|---|---|---|---|---|
| Node.js 8 | Node.js 8 | Node.js 8 | Node.js 8 | Node.js 8 | Node.js 8 |
| Node.js 10 | Node.js 10 | Node.js 10 | Node.js 10 | Node.js 10 | Node.js 10 |
| Node.js 12 | Node.js 12 | Node.js 12 | Node.js 12 | Node.js 12 | Node.js 12 |
| Node.js 13 | Node.js 13 | Node.js 13 | Node.js 13 | Node.js 13 | Node.js 13 |
A matrix is super useful in helping us programmatically define such a list without actually having to define each of these contexts individually. This utility mostly comes when you start adding more platforms and versions, but thankfully the overhead of doing that is incredibly low from the configuration side of things (see the following sections for more context)
Relevant docs:
os: [ubuntu-latest, windows-latest, macOS-latest]
The above is effectively a variable that we're assigning to the matrix, which can be dynamically called. In our case, we're just saying that the os
variable on matrix
(so matrix.os
) is going to be each of these. The how is still a bit magic to me, but... it works, seemingly by iterating over each of them when they're called. When used in conjunction with another variable (like node-version
), they're iterated over to create something like the tables above effectively.
Relevant docs:
node-version: [8.x, 10.x, 12.x]
Another variable where we're going to define the Node.js versions we'd want to be running.
Relevant docs:
steps:
Each job contains a set of steps
. This specific line is where we indicate that we're going to begin defining the steps.
Relevant docs:
- uses: actions/checkout@v1
Tells our workflow that we're going to be using the GitHub Action that can be found at actions/checkout
which maps to the GitHub org/repo at [gihub.com/actions/checkout]. It's also worth noting that @v1
which is a tagged and released version that can be found in the GitHub Releases for the repo.
Relevant docs:
$GITHUB_WORKSPACE
in the virtual environment.jobs.<job_id>.steps.uses
- name: Use Node.js $NaN on $
The name to display for the job in the UIs that it's rendered within, given the various variables that we've inserted using matrix
.
Note: There seems to be a bug where this does not render properly – instead of rendering as a tagged template literal, the Actions UI renders as a string.
Relevant docs:
uses: actions/setup-node@v1
Defines an external action – in this case, the [github.com/actions/setup-node] action at version 1.x.x (as released via the GitHub repo). In our case, this is an action that provides a super handy interface to install arbitrary versions of Node.js other than the version that comes baked into the VMs that are provided. My guess is that this will be a default action for anyone who is running JavaScript or Node.js builds simply because it handles so much for you by default.
It's worth noting that actions consumed with uses:
can be sourced from within the same repository, from a public repository, and from a Docker image published to Docker Hub.
Relevant docs:
with:
This is a map
(my assumption is that this is a map
in the sense of YAML's definition of a map) of the parameters defined in the action. In our case, actions/setup-node
needs a version to run with.
Relevant docs:
node-version: $NaN
The actions/setup-node
action needs a version of Node.js to run, via the node-version:
property. Since we named the variable for Node.js versions in our Matrix node-versions
, we're able to pass matrix.node-version
to the node-version:
property.
Relevant docs:
- name: npm install and test
We're again defining the name of a job. In this case, there's no dynamic information since the commands we're going to be running are pretty static.
I use npm install
and npm test
, but your applications may vary in install/build/test/ci commands – my recommendation for this is to tweak both the title and the actual commands, so it's extremely clear what's being run.
Relevant docs:
run: |
npm install
npm test
This is an interesting set of lines for those unfamiliar with YAML. We start with using a run
property for the job, which allows us to run any command on the system. In our case, we're going to use this to run npm install
and npm test
... but those are two different commands, that need to be run separately. The pipe (|
) is a tool defined in the YAML spec as Literal Style. In our case, it allows us to write multiple lines that execute independently without having to use multiple run:
commands or multiple jobs. Basically, it's shorthand that enables use to be looser in how we're able to build out our file.
Note: It may be worth using
npm ci
rather thannpm install
to install dependencies, given thatnpm ci
was tailor-made for CI environments. You can find more details onnpm ci
in the official documentation.
Relevant docs:
env:
Allows us to set up environment variables in our virtual environments with relative ease.
Relevant docs:
CI: true
This one is a personal preference, and also happens to be the default for the simplest Node.js workflow suggested by GitHub. Simply sets an environment variable that can be easily picked up on by various tools. GitHub
Relevant docs:
Currently, GitHub Actions CI is in a semi-public beta as a part of GitHub Actions v2 – they've invited a bunch of folks who applied to use it. That said, if you feel like this is a repeat of what happened when GitHub Actions initially shipped last year, you'll be happy to know that in the GitHub Special Event in which GitHub Actions CI and GitHub Actions v2 were shared, Nat Friedman said that GitHub Actions CI and GitHub Actions v2, along with GitHub Package Registry, is shipping to everyone on November 13th – the first day of GitHub Universe.
So, in just over a month from the date of publishing this article, you'll be able to start using GitHub Actions CI on any and every public project for free. 🎉
If you've got any questions or comments about what I've talked about in this post, or if there's more you'd like to learn about GitHub Actions CI or GitHub Actions v2, I'd be more than happy to see if I can either answer your questions in the comments directly, make good free and public repos that can help give you answers, or write more posts on the subject if you'd find that helpful!


{{clubname}}
Welcome.
Dashboard
Club
Classes
Settings
Add Post
Members
Organizer: {{organizer}}
{{member}}
{{introduction}}
About {{clubname}}
{{postname}}


{% extends "layout.html" %} {% block page_title %} Money Claims Prototype {% endblock %} {% block proposition_header %} {% include "includes/propositional_navigation.html" %} {% endblock %} {% block content %} {% include "includes/phase_banner_beta.html" %} Make your witness statement We need to ask you some questions to make a 'witness statement'. A witness statement is a document that explains your view of the case to a judge. We'll ask you to explain the claim and list evidence. You can repeat information you told us when you made the claim. {% include 'prototypes/prototype-may-2020/includes/contact.html' %} {% endblock %}
We need to ask you some questions to make a 'witness statement'.
A witness statement is a document that explains your view of the case to a judge.
We'll ask you to explain the claim and list evidence.
You can repeat information you told us when you made the claim.


Replicates a model on different GPUs. (deprecated)
tf.compat.v1.keras.utils.multi_gpu_model
tf.compat.v2.keras.utils.multi_gpu_model
tf.keras.utils.multi_gpu_model( model, gpus, cpu_merge=True, cpu_relocation=False )
Warning: THIS FUNCTION IS DEPRECATED. It will be removed after 2020-04-01.
Instructions for updating:
Use tf.distribute.MirroredStrategy
instead.
Specifically, this function implements single-machine multi-GPU data parallelism. It works in the following way:
E.g. if your batch_size
is 64 and you use gpus=2
,
then we will divide the input into 2 sub-batches of 32 samples,
process each sub-batch on one GPU, then return the full
batch of 64 processed samples.
This induces quasi-linear speedup on up to 8 GPUs.
This function is only available with the TensorFlow backend for the time being.
model
: A Keras model instance. To avoid OOM errors,
this model could have been built on CPU, for instance
(see usage example below).gpus
: Integer >= 2, number of on GPUs on which to create
model replicas.cpu_merge
: A boolean value to identify whether to force
merging model weights under the scope of the CPU or not.cpu_relocation
: A boolean value to identify whether to
create the model's weights under the scope of the CPU.
If the model is not defined under any preceding device
scope, you can still rescue it by activating this option.A Keras Model
instance which can be used just like the initial
model
argument, but which distributes its workload on multiple GPUs.
Example 1: Training models with weights merge on CPU
import tensorflow as tf from keras.applications import Xception from keras.utils import multi_gpu_model import numpy as np num_samples = 1000 height = 224 width = 224 num_classes = 1000 # Instantiate the base model (or "template" model). # We recommend doing this with under a CPU device scope, # so that the model's weights are hosted on CPU memory. # Otherwise they may end up hosted on a GPU, which would # complicate weight sharing. with tf.device('/cpu:0'): model = Xception(weights=None, input_shape=(height, width, 3), classes=num_classes) # Replicates the model on 8 GPUs. # This assumes that your machine has 8 available GPUs. parallel_model = multi_gpu_model(model, gpus=8) parallel_model.compile(loss='categorical_crossentropy', optimizer='rmsprop') # Generate dummy data. x = np.random.random((num_samples, height, width, 3)) y = np.random.random((num_samples, num_classes)) # This `fit` call will be distributed on 8 GPUs. # Since the batch size is 256, each GPU will process 32 samples. parallel_model.fit(x, y, epochs=20, batch_size=256) # Save model via the template model (which shares the same weights): model.save('my_model.h5')
Example 2: Training models with weights merge on CPU using cpu_relocation
.. # Not needed to change the device scope for model definition: model = Xception(weights=None, ..) try: model = multi_gpu_model(model, cpu_relocation=True) print("Training using multiple GPUs..") except: print("Training using single GPU or CPU..") model.compile(..) ..
Example 3: Training models with weights merge on GPU (recommended for NV-link)
.. # Not needed to change the device scope for model definition: model = Xception(weights=None, ..) try: model = multi_gpu_model(model, cpu_merge=False) print("Training using multiple GPUs..") except: print("Training using single GPU or CPU..") model.compile(..) ..
ValueError
: if the gpus
argument does not match available devices.


Grinnell College Press is a student organization which works with writers and artists on campus to design and print (a collection of) their work in a cohesive and beautiful publication.
Our current publications (released in Spring 2018) are:
- The Foodhouse Cookbook by Grinnell College Foodhouse
- Drawings from Copenhagen by Sam Nakahira
- The Silence of Lavender and Blood by Nicole Polglaze
- Contemporary Frames by Puravi Nath


--- permalink: /404.html --- {% include header.html %}
{% octicon chevron-left height:16 class:"mr-2 v-align-middle" fill:#0366d6 aria-label:Home %}Home
>>> this_page
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
404Error: 'this_page' is not defined


WITNESS LIST Criminal Justice Committee February 15, 2000-10:00A Interim Charge 2 On: Berndt, Deborah (MHMR), Austin Brock, Jean (Physicians Network Assn.), Lubbock Brzozowski, Perri (Travis Co. Children's Partnership), Austin Cheyney, Patsy (San Antonio Alliance for the Mentally Ill), San Antonio Coffee, Vicky (Travis Co. Children's Partnership), Austin Fabelo, Dr. Tony (Criminal Justice Policy Council), Austin, TX Fillmore, Debbie (TX Commission on Jail Standards), Austin,TX Gutierrez, David (Sheriff - Lubbock County), Lubbock Hearon, Genevieve (Capacity for Justice), Austin Hicks, Dr. Regenia (MHMR), Houston Kifowit, Dee (TCOMI), Austin, TX Lovelace, Joe (NAMI), Austin Mahan, Mary (MHMR), Lubbock Medina, Estela (Travis Co. Juvenile Probation), Austin Patterson, Robert (Bell County Sheriff's Office), Belton Reeves, Linda (TX Inmate Families Assc.), Austin Reyes, Dr. Linda (TYC), Austin, TX Scott, Wayne (TDCJ), Huntsville, TX Spriggs, Vicki (TX Juvenile Probation Commission), Austin Stanley, Ann (Health & Human Services Commission), Austin Thompson, William (Harris Co. Juvenile Probation), Houston Wanser, Dr. Dave (MHMR), Austin, TX Registering, but not testifying: On: Heikes, Joel (Criminal Justice Policy Council), Austin Scarborough, Paul (Lubbock Co. Sherriff's Dept.), Lubbock Interim Charge 6 On: Benestante, John (TDCJ), Huntsville, TX Brown, Joyce Ann (MASS), Dallas, TX Ellison, Burt (TX Workforce Commisssion), Austin, TX Garrett, Gerald (TX Board of Pardons & Paroles), Austin Jeffries, Carl (TDCJ), Austin, TX Lindholm, Craig (Lindholm Management), Texarkana, TX Mintz, David (TX Apartment Association), Austin Morelock, Paula (TYC), Austin, TX Morrow, Mike (Windham School District), Huntsville, TX Rodriguez, Victor (TDCJ), Austin, TX Scott, Wayne (TDCJ), Huntsville,TX Registering, but not testifying: On: Cragg, Sherma (TYC), Austin, TX Evans, Bob (Windham School District), Huntsville, TX Haynes, Marjie (Windham School District), Huntsville, TX Kelly, Dr. William (UT Austin), Austin Roberts, Debra (TDCJ), Huntsville, TX Interim Charge 7 On: Hubbarth, William (Justice for All), Austin Keiser, George (U.S. Department of Justice), Washington, DC Masters, Rick (Council of State Governments), Lousiville, KY Scott, Wayne (TDCJ), Huntsville, TX Winckler, Kathie (TDCJ), Washington,DC


Pick Date:
Select Meals:
Pounded Yam & Egusi
Fried Rice & Chicken
Jollof Rice & Chicken
Amala & Ewedu
Fufu & Egusi


bmq.txt @PURPOSE: Public SDK API for the BlazingMQ framework. @MNEMONIC: BlazingMQ (bmq) @DESCRIPTION: BlazingmQ (package group 'bmq') is a message-queue framework allowing application developers to use reliable distributed queues. The 'bmqa' and 'bmqt' packages contain all components that constitute the public API for BlazingmQ users to use. A client should only use the components in these packages, and should not use any other package under the 'bmq' package group since they are implementation components that may change at any time. /Hierarchical Synopsis /--------------------- The 'bmq' group library currently has 5 packages forming 5 levels of physical dependency. .. 5. bmqa 4. bmqimp 3. bmqp 2. bmqt 1. bmqscm .. /Package Synopsis /------------------ : 'bmqa': : Provide applications public API for the BlazingmQ SDK. : : 'bmqimp': : [INTERNAL] Provide implementation for the API of the BlazingMQ SDK. : : 'bmqp': : [INTERNAL] Provide BlazingMQ protocol definition, builders and parsers. : : 'bmqscm': : Provide versioning information for library components in 'bmq'. : : 'bmqt': : Provide value-semantic vocabulary types. /Package Overview /---------------- The following provides a brief overview of several of the packages within the 'bmq' package group, arranged in alphabetical order. The descriptions here are still very brief; see the respective Package Level documents for more details and usage examples. /'bmqa' /- - - 'bmqa' provides the top-level public APIs application can use to interact with BlazingMQ framework in their applications. /'bmqt' /- - - 'bmqt' provides value-semantic vocabulary types used in the {'bmqa'} APIs.


|
Javed IqbalSodomized and killed 100 boys in Pakistan. All of the boys were street urchins which he drugged, molested, strangled and then dissolved in vats of acid, keeping their shoes and clothes as trophies. About halfway through, began a photodocumentation of his efforts, which he sent to police when the goal of 100 was attained. As nobody in Islamabad notices when a street urchin goes missing, Iqbal claims he could have achieved 500 had he the desire.
"I am Javed Iqbal, killer of 100 children...  I have no regrets. I killed 100 children." Javed means immortal; Iqbal means desire. This gentleman is not to be confused with Javed Iqbal, cricket player, or Javed Iqbal, surgeon, or several other prominent Javed Iqbals in Pakistan. Timeline
|