iwiki Documentation Release 1.0 jch

Similar documents
JavaScript: Sort of a Big Deal,

Harmony Highlights Proxies & Traits. Tom Van Cutsem Mark S. Miller

Proxies Design Principles for Robust OO Intercession APIs

JAVASCRIPT AND JQUERY: AN INTRODUCTION (WEB PROGRAMMING, X452.1)

Classes vs Simple Object Delegation In JavaScript

Symbols. accessor properties, attributes, creating, adding properties, 8 anonymous functions, 20, 80

JavaScript. Training Offer for JavaScript Introduction JavaScript. JavaScript Objects

The course is supplemented by numerous hands-on labs that help attendees reinforce their theoretical knowledge of the learned material.

Node.js Training JavaScript. Richard richardrodger.com

The 5 capacities we look for in candidates

traits.js Robust Object Composition and High-integrity Objects for ECMAScript 5 Tom Van Cutsem Mark S. Miller Abstract 1.

Introduction to JavaScript p. 1 JavaScript Myths p. 2 Versions of JavaScript p. 2 Client-Side JavaScript p. 3 JavaScript in Other Contexts p.

Object Oriented JavaScript (Part the Second)

traits.js Robust Object Composition and High-integrity Objects for ECMAScript 5 Tom Van Cutsem Mark S. Miller Abstract 1.

Decision Making in C

JavaScript: The Good Parts

COMP519 Web Programming Lecture 21: Python (Part 5) Handouts

FALL 2017 CS 498RK JAVASCRIPT. Fashionable and Functional!

JavaScript: The Good Parts. Douglas Crockford Yahoo! Inc.

Functional JavaScript. Douglas Crockford Yahoo! Inc.

COMP519 Web Programming Lecture 14: JavaScript (Part 5) Handouts

JavaScript CS 4640 Programming Languages for Web Applications

Static Analysis for JavaScript

Busy.NET Developer's Guide to ECMAScript

JAVASCRIPT AND JQUERY: AN INTRODUCTION (WEB PROGRAMMING, X452.1)

Robust Trait Composition for Javascript

JavaScript CS 4640 Programming Languages for Web Applications

JavaScript Programming

ECE 364 Software Engineering Tools Laboratory. Lecture 7 Python: Object Oriented Programming

JavaScript. What s wrong with JavaScript?

JavaScript for C# Programmers Kevin

Sorting HOW TO Release 2.7.6

JavaScript Lecture 3b (Some language features)

CS61A Lecture 20 Object Oriented Programming: Implementation. Jom Magrotker UC Berkeley EECS July 23, 2012

traity Documentation Release Sean Ross-Ross

Page. User. Sorting Mini-HOW TO. Search Titles Text. More Actions: HowTo Sorting. HowTo/Sorting

Python source materials

JavaScript. History. Adding JavaScript to a page. CS144: Web Applications

COMP 401 Spring 2013 Midterm 1

Introduction to Python programming, II

pysqlw Documentation Release plausibility

Webgurukul Programming Language Course

Picolo: A Simple Python Framework for Introducing Component Principles

Babu Madhav Institute of Information Technology, UTU 2015

UNIT -II. Language-History and Versions Introduction JavaScript in Perspective-

Subprogram Concept. COMP3220 Principle of Programming Languages. Zhitao Gong Spring

Client-Side Web Technologies. JavaScript Part I

Sample CS 142 Midterm Examination

Lecture 5: Python PYTHON

COMP519 Web Programming Lecture 20: Python (Part 4) Handouts

Kaiso Documentation. Release 0.1-dev. onefinestay

Javascript s Meta-object Protocol. Tom Van Cutsem

JavaScript Lecture 1

Meta Classes. Chapter 4

Python Training. Complete Practical & Real-time Trainings. A Unit of SequelGate Innovative Technologies Pvt. Ltd.

Classical Object-Oriented Programming with ECMAScript. Abstract. 1 Class-Like Objects in ECMA- Script. Contents

Week. Lecture Topic day (including assignment/test) 1 st 1 st Introduction to Module 1 st. Practical

Class, Variable, Constructor, Object, Method Questions

JavaScript: Features, Trends, and Static Analysis

CSE : Python Programming

Announcements. Homework 1 due Monday 10/12 (today) Homework 2 released next Monday 10/19 is due 11/2

Introduction to Python

MEMOIZATION, RECURSIVE DATA, AND SETS

doubles Documentation

Decorators. Userland Extensions to ES6 Classes

Python Basics. Lecture and Lab 5 Day Course. Python Basics

CS2304: Python for Java Programmers. CS2304: Advanced Function Topics

CSE : Python Programming. Decorators. Announcements. The decorator pattern. The decorator pattern. The decorator pattern

Python Programming: Lecture 3 Functions

Midterm Exam. 5. What is the character - (minus) used for in JavaScript? Give as many answers as you can.

A Tested Semantics for Getters, Setters, and Eval in JavaScript

This page intentionally left blank

Subclass Gist Example: Chess Super Keyword Shadowing Overriding Why? L10 - Polymorphism and Abstract Classes The Four Principles of Object Oriented

arxiv: v1 [cs.pl] 15 Dec 2009

The JavaScript Language

maya-cmds-help Documentation

CS61B Lecture #7. Announcements:

Powerful JavaScript OOP concept here and now. CoffeeScript, TypeScript, etc

Positional, keyword and default arguments

JavaScript. History. Adding JavaScript to a page. CS144: Web Applications

Javascript : the language. accu2009 conference 25 th April 2009 Tony Barrett-Powell

Lecture 3: The Basics of JavaScript. Background. Needs for Programming Capability. Origin of JavaScript. Using Client-side JavaScript

ADsafety. Type-based Verification of JavaScript Sandboxing. Joe Gibbs Politz Spiridon Aristides Eliopoulos Arjun Guha Shriram Krishnamurthi

PYTHON CONTENT NOTE: Almost every task is explained with an example

<Insert Picture Here> Adventures in JSR-292 or How To Be A Duck Without Really Trying

Boot Camp JavaScript Sioux, March 31, 2011

pysharedutils Documentation

Chapter 1 Summary. Chapter 2 Summary. end of a string, in which case the string can span multiple lines.

MatchaScript: Language Reference Manual Programming Languages & Translators Spring 2017

Lecture #15: Generic Functions and Expressivity. Last modified: Wed Mar 1 15:51: CS61A: Lecture #16 1

Python A Technical Introduction. James Heliotis Rochester Institute of Technology December, 2009

More on JavaScript Functions

Language Features. 1. The primitive types int, double, and boolean are part of the AP

Dogeon Documentation. Release Lin Ju

Frontend II: Javascript and DOM Programming. Wednesday, January 7, 15

JavaScript: The Definitive Guide

Stepic Plugins Documentation

OstrichLib Documentation

The JavaScript Language

INTRODUCTION TO JAVASCRIPT

Transcription:

iwiki Documentation Release 1.0 jch January 31, 2014

Contents i

ii

Contents: Contents 1

2 Contents

CHAPTER 1 Python 1.1 Python Core 1.1.1 Strings 1.1.2 Functions Argument Lists *args tuple/list **kwargs dictionary def foo(*args): print args Unpacking 1.1.3 Tuples Tuple assignment a, b = b, a Tuple comparison 1.1.4 Lists 1.1.5 Dictionaries Sorting from operator import itemgetter d = { spam :7, eggs : 14, ham :6} #sort by key print sorted(d.iteritems(), reverse=true) # return a list of tuples print sorted(d.keys(), reverse=true) # return just a list of keys 3

# sort by value print sorted(d.iteritems(), key=itemgetter(1), reverse=true) #return a list of tuples print sorted(d.iteritems(), key=lambda x: x[1], reverse=true) print sorted(d, key=d. getitem, reverse=true) #return just a list of values 1.1.6 Files 1.1.7 Regular Expressions re.search(pat, str, flags=0) returns a match object or None otherwise. re.findall(pat, str, flags=0) returns a list of all matches. re.sub(pat, repl, str, count=0, flags=0) the replacement string can include \1, \2 which refer to the text from group(1), group(2) and so on from the original text: str = spam foo@bar.com ham baz@qux.com eggs match = re.search(r ([\w.-]+)@([\w.-]+), str) # using raw string is convinient if match: print match:, match.group() # foo@bar.com print submatch:, match.group(1) # foo else: print not found print re.findall(r [\w.-]+@[\w.-]+, str) # [ foo@bar.com, baz@qux.com ] # return a list of tuples instead of strings submatches > 1 print re.findall(r ([\w.-]+)@([\w.-]+), str) # [( foo, bar.com ), ( baz, qux.com )] print re.sub(r ([\w.-]+)@([\w.-]+), r \1@quxx.com, str) # spam foo@quxx.com ham baz@quxx.com eggs 1.1.8 OOP init str Operator Overloading add and radd ref Polymorphism Inheritance 1.1.9 Standard Library 4 Chapter 1. Python

CHAPTER 2 Javascript 2.1 Javascript Core 2.1.1 Objects Creation Literal With new Object.create() Note: Introduced in ECMAScript 5 Object.create(proto [, propertiesobject]) var o; o = Object.create(null); //with no prototype o = {}; // is equivalent to: o = Object.create(Object.prototype); function Constructor(){} o = new Constructor(); // is equivalent to: o = Object.create(Constructor.prototype); o = Object.create({}, { p: { value: 42 } }) // by default properties ARE NOT writable, enumerable or configurable: o.p = 24 o.p //42 o.q = 12 for (var prop in o) { console.log(prop) //"q" } delete o.p //false //to specify an ES3 property o2 = Object.create({}, { p: { value: 42, writable: true, enumerable: true, configurable: true } }); 5

Polyfill: if (typeof Object.create!== function ) { Object.create = function (o, props) { function F() {} F.prototype = o; } if (typeof (props) === "object") { for (prop in props) { if (props.hasownproperty((prop))) { F[prop] = props[prop]; } } } return new F(); }; Properties Querying and Setting obj.prop obj["prop"] Deleting delete Testing prop in obj return true for own or inherited properties obj.hasownproperty(prop) return false for inherited properties obj.propertyisenumerable(prop) return true for own property and its enumerable attribute is true. obj.prop!==undefined Enumerating for/in loops (enumerable): for (p in o) { if (!o.hasownproperty(p)) continue; } //filter inherited properties for (p in o) { if (typeof o[p] === "function") continue; } //filter methods Note: Introduced in ECMAScript 5 6 Chapter 2. Javascript

Object.keys(obj) return enumerable own properties Object.getOwnPropertyNames(obj) return enumerable and non-enumerable own properties Getters and Setters Note: Introduced in ECMAScript 5 Property Attributes Note: Introduced in ECMAScript 5 Object.getOwnPropertyDescriptor(obj, prop) Object.defineProperty(obj, prop, descriptor) Object Attributes prototype class extensible Serializing Methods 2.1.2 Functions Invocation Method Invocation Function Invocation Constructor Invocation Apply Invocation In this case, this in the nested function is bound to the global object: var o = { value: 1, outer: function () { var inner = function () { console.log(this); }; inner(); //bound to global object 2.1. Javascript Core 7

} }; o.outer(); Workaround: var o = { value: 1, outer: function () { var that = this; //assign this to a variable var inner = function () { console.log(that); console.log(that.value); }; inner(); } }; o.outer(); //have access to outer s variable Arguments Return Exceptions If return value is not specified, then undefined is returned. If the function is invoked with new and the return value is not an object, then this (the new object) is returned. 2.1.3 Inheritance The true prototype of an object is held by [[Prototype]] internal property: function Foo () {} var bar = new Foo(); //the [[Prototype]] of bar is Foo.prototype function Baz () {} // Baz.prototype = new Foo(); //the [[Prototype]] of Baz.prototype is changed to Foo.prototype. 8 Chapter 2. Javascript

Foo Function prototype constructor [[Prototype]] [[Prototype]] constructor prototype Foo.prototype Function.prototype [[Prototype]] [[Prototype]] Object.prototype [[Prototype]] [[Prototype]] constructor prototype null Object obj instanceof Constructor tests whether obj is in Constructor.prototype s prototype chain. proto.isprototypeof(obj) tests whether obj is in proto s prototype chain. Note: Introduced in ECMAScript 5 Object.getPrototypeOf(obj) Warning: Not standard obj. proto 2.1. Javascript Core 9

10 Chapter 2. Javascript

CHAPTER 3 CSS 3.1 CSS Core 11

12 Chapter 3. CSS

CHAPTER 4 HTML 4.1 HTML Core 13

14 Chapter 4. HTML

CHAPTER 5 Database 5.1 SQL 15

16 Chapter 5. Database

CHAPTER 6 Git 6.1 Git 17

18 Chapter 6. Git

CHAPTER 7 Testing 7.1 Testing Basic 7.2 Selenium 19

20 Chapter 7. Testing

CHAPTER 8 Linux 8.1 Linux Basic 8.2 Arch Linux 21

22 Chapter 8. Linux

CHAPTER 9 Indices and tables genindex modindex search 23