http://www.codeproject.com/Articles/1388/Calling-Conventions-Demystified
Month: September 2013
http://visual.merriam-webster.com/energy/geothermal-fossil-energy/oil/offshore-prospecting.php
offshore prospecting
Vibrations from an exploding charge in the sea are used to locate oil deposits; prospecting offshore is more difficult than on land.
petroleum trap
Assemblage of porous rocks that contain recoverable oil reserves, which are produced from marine or land deposits.
blasting charge
Quantity of explosives (substances capable of discharging high-temperature gases over a very short time period) that produce shock waves when detonated.
seismographic recording
A recording made using an apparatus called a seismograph; the analysis of its shock wave echoes detects the presence of rock layers that might contain pockets of petroleum or gas.
Responses HTTP
If status code begin with
2: Basic mean OK
3: basic ok but need to do difference technique to find document
4: Error on browser side (eg: find document doesn’t exist)
5: Error on Server side (eg: server broke )
GET method
Tower
http://en.wikipedia.org/wiki/Tower_of_Hanoi#Recursive_solution
var a={ a: [1,2,3,4,5], name: "a"} var b={ a: [], name : "b" }; var c={ a:[], name : "c" }; var cnt=0; function hn(n,from,to,im){ if (n===1){ console.log(from.a[from.a.length-1]+" from "+from.name + " to "+to.name) to.a.push(from.a.pop()); ++cnt; }else{ hn(n-1,from,im,to); console.log(from.a[from.a.length-1]+" from "+from.name + " to "+to.name) to.a.push(from.a.pop()); ++cnt; hn(n-1,im,to,from); } return to.name + ": " + to.a+" total " +cnt + " times" } hn(a.a.length,a,b,c);
move n−1 discs from A to B. This leaves disc n alone on peg A
move disc n from A to C
move n−1 discs from B to C so they sit on disc n
Prototype (JC)
http://sporto.github.io/blog/2013/02/22/a-plain-english-guide-to-javascript-prototypes/
The ‘prototype’ property points to the object that will be asigned as the prototype of instances created with that function when using ’new’. Confusing? This is easier to explain with an example:
Deactive user in Linux
Follow
jsmith:x:1001:1000:Joe Smith,Room 1007,(234)555-8910,(234)555-0044,email:/home/jsmith:/bin/sh
The fields, in order from left to right, are:[2]
The first field is the user name, i.e. the string a user would type in when logging into the operating system: the logname. Each record in the file must have a unique user name field.
The second field stores information used to validate a user’s password; however in most modern uses this field is usually set to “x” (or some other indicator) with the actual password information being stored in a separate shadow password file. Setting this field to an asterisk “*” is the typical way to deactivate an account to prevent it being used.
The third field is the user identifier, the number that the operating system uses for internal purposes. It does not have to be unique.
The fourth field is the group identifier. This number identifies the primary group of the user; all files that are created by this user may initially be accessible to this group.
The fifth field, called the Gecos field, is commentary that describes the person or account. Typically, this is a set of comma-separated values including the user’s full name and contact details.
The sixth field is the path to the user’s home directory.
The seventh field is the program that is started every time the user logs into the system. For an interactive user, this is usually one of the system’s command line interpreters (shells).
Cash Register (JC codeacademy)
function StaffMember(name,discountPercent){ this.name = name; this.discountPercent = discountPercent; } var sally = new StaffMember("Sally",5); var bob = new StaffMember("Bob",10); // Create yourself again as 'me' with a staff discount of 20% var me=new StaffMember("me",20); var cashRegister = { total:0, lastTransactionAmount: 0, add: function(itemCost){ this.total += (itemCost || 0); this.lastTransactionAmount = itemCost; }, scan: function(item,quantity){ switch (item){ case "eggs": this.add(0.98 * quantity); break; case "milk": this.add(1.23 * quantity); break; case "magazine": this.add(4.99 * quantity); break; case "chocolate": this.add(0.45 * quantity); break; } return true; }, voidLastTransaction : function(){ this.total -= this.lastTransactionAmount; this.lastTransactionAmount = 0; }, // Create a new method applyStaffDiscount here applyStaffDiscount : function(employee){ this.total=this.total-this.total*employee.discountPercent/100; } }; cashRegister.scan('eggs',1); cashRegister.scan('milk',1); cashRegister.scan('magazine',3); // Apply your staff discount by passing the 'me' object // to applyStaffDiscount cashRegister.applyStaffDiscount(me), // Show the total bill console.log('Your bill is '+cashRegister.total);
Inheritance
// original classes function Animal(name, numLegs) { this.name = name; this.numLegs = numLegs; this.isAlive = true; } function Penguin(name) { this.name = name; this.numLegs = 2; } function Emperor(name) { this.name = name; this.saying = "Waddle waddle"; } // set up the prototype chain Penguin.prototype = new Animal(); Emperor.prototype = new Penguin(); var myEmperor = new Emperor("Jules"); console.log( myEmperor.saying ); // should print "Waddle waddle" console.log( myEmperor.numLegs); // should print 2 console.log( myEmperor.isAlive); // should print true