JPoint 2016; Moscow, Russia; 24 April 2016. Video is here: https://www.youtube.com/watch?v=F4N25kZ2zQU (in Russian with English subtitles).
The document discusses JavaScript functions, classes, and regular expressions. It covers:
1) How functions are defined and invoked in JavaScript and the different ways functions can be invoked like as methods, constructors, or indirectly.
2) How classes are implemented in JavaScript using prototypes and constructor functions to define behaviors shared across objects.
3) How regular expressions can be used to describe patterns in strings using special characters like character classes, repetition, and other techniques.
This document discusses various options for formatting numbers in Microsoft Excel. It describes number formatting categories like General, Number, Currency, Accounting, Date, Time, Percentage, Fraction, Scientific, and Text. It provides examples of how numbers will appear formatted under each of these options. The document also includes step-by-step instructions for formatting a list of expenses in a sample Excel worksheet using the Currency number format with two decimal places and a PHP symbol.
JPoint 2016; Moscow, Russia; 24 April 2016. Video is here: https://www.youtube.com/watch?v=F4N25kZ2zQU (in Russian with English subtitles).
The document discusses JavaScript functions, classes, and regular expressions. It covers:
1) How functions are defined and invoked in JavaScript and the different ways functions can be invoked like as methods, constructors, or indirectly.
2) How classes are implemented in JavaScript using prototypes and constructor functions to define behaviors shared across objects.
3) How regular expressions can be used to describe patterns in strings using special characters like character classes, repetition, and other techniques.
This document discusses various options for formatting numbers in Microsoft Excel. It describes number formatting categories like General, Number, Currency, Accounting, Date, Time, Percentage, Fraction, Scientific, and Text. It provides examples of how numbers will appear formatted under each of these options. The document also includes step-by-step instructions for formatting a list of expenses in a sample Excel worksheet using the Currency number format with two decimal places and a PHP symbol.
The document provides an introduction to JavaScript functions. It explains that functions allow code to be reused by defining reusable blocks of code called functions. It provides examples of simple functions that check if a number is greater than or equal to 21, and adds additional time to a number of minutes. The document emphasizes that functions are like buttons on a microwave that each serve a specific purpose. It encourages readers to try out functions on their own.
This document provides an introduction to object-oriented programming concepts in Java. It discusses similarities and differences between Java and C++, object-oriented nomenclature, instance variables, methods, and constructors. Instance variables are fields that belong to objects of a class. Methods are functions defined within classes that can access and modify instance variables. Constructors initialize new objects and are called when objects are created using the new operator. The document provides examples to illustrate these concepts and highlights key differences between Java and C++ regarding object-oriented programming.
This document discusses lambda functions and new features coming to Java 8, including lambda functions (anonymous functions), method references, default methods in interfaces, and functional interfaces with a single abstract method. It provides examples of lambda functions and explores how they can be used for filtering, mapping, chaining, and iterating over collections.
Functional Programming in Java 8 - Exploiting LambdasGanesh Samarthyam
This document introduces lambda functions and functional programming in Java 8. It defines lambda functions as anonymous functions without a name. Functional programming views programs as functions that accept inputs and produce outputs. Lambda functions and streams help enable a more functional approach to programming in Java. Parallel streams can improve performance by processing elements concurrently.
This document provides instructions for creating a basic HTML file that calculates speed based on distance and time inputs. It outlines 15 steps to set up the HTML skeleton, add input fields for distance and time, create a button to call the ComputeSpeed function, and use a script to calculate and display the speed when the button is clicked. The instructions are for a learning activity to demonstrate functions in JavaScript.
“Lambdas in JAVA 8 is not for what they can do, It is about how we write Program”
It enables Functional Programming, It Adds a New nucleotides in the DNA of Java.
There is a Change in “The Climate” to change our Ways.
Java is a popular programming language used for developing applications, especially web applications. It follows specific syntax rules and uses object-oriented programming. Key points covered in the document include the basic structure of a Java program, popular programming languages, tools used for Java development, and an overview of object-oriented concepts like classes, objects, methods, and inheritance.
Understanding Java 8 Lambdas and Streams - Part 1 - Lambda Calculus, Lambda...Philip Schwarz
Quick summary of the talk:
* We start playing a bit with integer streams
* We soon come across lambda expressions
* We introduce the Lambda Calculus and show that it is Turing Complete.
* We look at how Java lambda expressions relate to lambda Calculus ones
* We look at how the two differ
* We ask ourselves: are functions 1st class citizens in Java 8?
* We look at what ‘1st class functions‘ means in Haskell and Scala
* We compare Java’s approach to ‘1st class functions’ with Scala’s
* We ask ourselves:
o are Java lambda expressions objects?
o are Java lambda expressions syntactic sugar for
anonymous instances of functional interfaces?
o Is it possible to write a recursive lambda expression in Java 8?
* We get answers to those questions
The document discusses functional programming concepts in Java 8 such as lambda expressions, streams, and functional interfaces. It provides examples of filtering, mapping, reducing, and grouping collections of objects in an imperative vs declarative style using streams. Key points include how lambda expressions allow passing functions as arguments, default methods enable new functionality in interfaces, and streams support parallel processing and aggregate operations on data sources.
The document provides information about a mentoring program run by Baabtra-Mentoring Partner including a trainee's typing speed progress over 3 weeks, jobs applied to with current statuses, an introduction to functions in Javascript covering definitions, advantages, examples, and local and global variables. Contact details for Baabtra are also provided at the end.
This document contains notes on JavaScript functions from a course. It discusses:
1) Functions allow breaking programs into modules for easier maintenance and debugging. Functions in JavaScript include predefined and programmer-defined methods.
2) Functions receive arguments, can call other functions in a hierarchical relationship, and may return values. Functions define local variables that do not exist outside the function.
3) Examples show defining and calling functions to square numbers, find the maximum of three values, and generate random numbers by scaling and shifting the output of Math.random().
Functional programming in Java 8 allows for:
1) The use of lambda expressions and streams for a more declarative programming style without iteration.
2) Functional interfaces like Function, Predicate, and Consumer along with lambda expressions enable function composition and chaining.
3) Features like immutable collections help reduce mutability and side effects, important aspects of functional programming.
The document discusses functional JavaScript programming. It introduces functional concepts like anonymous functions, binding functions to contexts, and enumerable functions. It provides examples of how to write functional code using these concepts like mapping over arrays with anonymous functions and filtering arrays. It also discusses structuring applications and provides an example code snippet for converting HTML elements.
Functions being first-class citizens in JavaScript offers developers a tremendous amount power and
flexibilty. However, what good is all this power if you don't know how to harness it?
This talk will provide a thorough examination of JavaScript functions. Topics
that will be covered in this talk are:
* Functions are objects
* Execution Context and the Scope Chain
* Closures
* Modifying Context
* The Various Forms of Functions.
Attendees will leave this talk understanding the power of JavaScript functions and the knowledge to apply new
techiques that will make their JavaScript cleaner, leaner and more maintainable.
Functional programming is all the rage. It can undoubtedly produce cleaner and more expressive code, but why switch to Scala or wait for Java 8? In fact, there are many ways to dramatically improve your Java code quality by using a more functional style today. This presentation discusses how techniques such as functional programming, using fluent APIs, and other clean coding practices can make your code more concise, more readable, and much easier to maintain. But more importantly, you will learn about libraries such as LambdaJ and Google Guava that make this possible today with your existing Java code base.
The document discusses different programming concepts including structured programming, object-oriented programming, data types, operators, control structures, and generations of programming languages. It provides examples of programming code in different languages and describes key differences between structured and object-oriented approaches.
This document provides an introduction to basic Java concepts for Android development. It discusses installing the Java Development Kit, writing simple Java code including classes, objects, methods, and statements. It also covers Java fundamentals like conditionals, loops, encapsulation, and static variables.
The document provides an overview of functional programming in Java. It discusses functional programming concepts like higher-order functions and avoiding side effects. It gives examples of functional-style code in Java for filtering lists and transforming objects. It also discusses how functional programming can be used to implement customizable business logic by passing functions as parameters and looking up functions through a dependency injection container.
Minął rok od prezentacji natywnego wsparcia podejścia MVVM na Google I/O. Przez ostatni rok mieliśmy okazję wykorzystywać to z wykorzystaniem Kotlina, oraz wypracować kilka uniwersalnych rozwiązań dla bolączek, z którymi boryka się Android. Pokażemy jak poradziliśmy sobie z runtime permissions, screen rotation oraz przechowywaniem stanu aplikacji bez użycia OnSaveInstanceState. Wszystko, aby móc pisać logikę biznesową odseparowaną od uwarunkowań systemu.
Autorzy: Michał Zawalich, Łukasz Roszak
Kod przykładowy do prezentacji: http://github.com/lrs-bls/mvvm-skeleton
The document compares Dagger and Koin dependency injection frameworks for Android. It discusses that Dagger uses compile-time code generation while Koin is runtime without code generation. It provides examples of implementing dependency injection with field injection, modules, and scoping for both frameworks. It also covers testing dependency injection with Koin. In summary, the document notes that Dagger scales better but has slower build times while Koin is simpler to use but errors occur at runtime.
This document discusses software security strategies and the Open Software Assurance Maturity Model (OpenSAMM). It provides examples of objectives and assessments for governance, construction, verification, and operations based on OpenSAMM. The document also outlines how to get started with OpenSAMM, including assessing maturity levels, defining a roadmap, and estimating costs. External support is offered to help with assessments, penetration tests, and training.
Prezentacja wyjaśnia różnice pomiędzy wzorcami MVVM oraz MVC w kontekście iOS'a. Znajduje się w niej analiza dwóch prostych aplikacji: jedna korzysta ze wzorca MVVM, druga MVC
This document discusses using Kotlin for test suites and provides examples of writing unit tests in Kotlin compared to Java. It shows how Kotlin allows for cleaner, more readable tests through features like lambdas, extension functions, and DSL capabilities. Specifically, it provides an example of refactoring a test for a task presenter to initialize views into a clearer specification using the given-when-then syntax supported by testing frameworks like Spek for Kotlin. The refactored test checks that when a task with no response is assigned to the current user, the response button is enabled upon initializing the presenter's views.
This document discusses clean architecture principles for Android applications. It outlines goals of having an architecture that is focused on use cases, easy to maintain and test, and decoupled. It describes layers including entities, use cases, interface adapters, frameworks/drivers, presentation layer, and data layer. It emphasizes separating domains, business rules in their own layer, and testing at different levels. Tools mentioned include dependency injections, Proguard, and Lint.
This document discusses different location services APIs in iOS including CLGeocoder and MKLocalSearch for geocoding, authorization types for location access, and location tracking types like continuous and region monitoring. It also provides a demo GitHub link and notes that Apple Watch location services will be discussed as a bonus.
The document provides guidance for developers on best practices for writing code. It emphasizes following rules like clean code, code reviews, and refactoring. Key points include writing simple and readable code, avoiding duplication, learning from others, and ensuring code meets definitions of done that specify requirements like testing and code quality. Refactoring is advised to reduce technical debt by improving structure without changing functionality. Code reviews are recommended to catch defects through constructive peer review.
3. constructor declaration
var Person = function (name) {
this.name = name;
};
Person.prototype.sayHi = function () {
return "Hi, I'm " + this.name;
};
var me = new Person("Piotr");
me.sayHi(); // “Hi I'm Piotr”
5. constructor prototype chain
var Car = function () {
this.name = "Car";
}
var Truck = function () {};
Truck.prototype = new Car();
var t = new Truck();
t; // Object { name="Car"}
t.name; // "Car"
t.hasOwnProperty("name"); // false
t.name = "Truck";
t.hasOwnProperty("name"); // true
6. constructor Object.defineProperty()
Object.defineProperty(obj, "name", {
configurable : false,
enumerable : false,
// data descriptors
writable: false,
value : "Object value",
// accessor descriptors
get : function () {},
set : function (val) {}
});
var o = {};
Object.defineProperty(o, "name", {
value : "Object O"
});
o.name; // Object O
o.name = "New name";
o.name; // Object O
7. new creating objects
var Person = function (name) {
this.name = name;
};
var me = new Person("Piotr");
me.name; // “Piotr”
var me = Person("Piotr");
me; // undefined
window.name; // “Piotr”
8. new instanceof
var Person = function () {
this.name = “Person”;
};
var p = new Person();
p instanceof Person; // true
"Hello" instanceof String; // false
new String("Hello") instanceof String;
// true
9. new creating objects
var Person = function () {
this.name = “Person”;
};
var p = new Person();
p.name; // “Person”
p instanceof Person; // true
var Person = function () {
return {
name : “Person”
};
};
var p = new Person();
p.name; // “Person”
p instanceof Person; // false
10. this function context
function getThis() { return this; }
getThis(); // window
var o = { name : "Object O" };
o.getThis = getThis;
o.getThis();
// Object { name="Object O",
getThis=getThis()}
var o = {
name : "Object O",
getThis : function () { return this;}
};
o.getThis(); // Object
var getThis = o.getThis;
getThis(); // window
11. this inner functions
var o = {
innerThis : function () {
function getThis () {
return this;
};
return getThis();
}
};
o.innerThis(); // window
12. this strict mode
function getThis () {
"use strict";
return this;
};
getThis(); // undefined
var o = {
innerThis : function () {
"use strict";
function getThis () {
return this;
};
return getThis();
}
};
o.innerThis(); // undefined
13. bind changing function context
var o = { name : "Object O" };
function getThis () { return this; };
getThis(); // window
var boundGetThis = getThis.bind(o);
boundGetThis();
// Object { name="Object O"}
var o = { name : "Object O" };
function getThis() { return this; }
getThis(); // window
o.getThis = getThis;
o.getThis();
// Object { name="Object O",
getThis=getThis()}
14. bind callbacks (self, that, _this)
var o = {
fetch : function () {
function getThis () {
console.log(this);
};
$.ajax({ url : "url" })
.done(getThis);
}
};
o.fetch(); // ajax settings object
var o = {
fetch : function () {
function getThis () {
console.log(this);
};
$.ajax({ url : "url" })
.done(getThis.bind(this));
}
};
o.fetch(); // Object { fetch=function() }
15. bind to bind or not to bind
function onClick () {
console.log("Click");
};
$("body").on("click", onClick);
$("body").trigger("click"); // “Click”
$("body").off("click", onClick);
$("body").trigger("click");
function onClick () {
console.log("Click");
};
$("body").on("click", onClick.bind());
$("body").trigger("click"); // “Click”
$("body").off("click",???);
16. ES6 class syntactic sugar
class Person {
constructor(name) {
this.name = name;
}
describe() {
return this.name;
}
}
function Person(name) {
this.name = name;
};
Person.prototype.describe =
function () {
return this.name;
};
17. ES6 class inheritance
class Employee extends Person {
constructor(name, title) {
super.constructor(name);
this.title = title;
}
}
function Employee(name, title) {
Person.call(this, name);
this.title = title;
}
Employee.prototype =
Object.create(Person.prototype);
Employee.prototype.constructor =
Employee;
18. ES6 Object Literal Property Value Shorthand
var a = "Test",
b = 42,
c = {};
var oldObj = {
a : a,
b : b,
c : c
};
var es6Obj = { a, b, c };
var name = “Object”;
var o = {
name,
get name() {},
set name(value) {},
getThis() { return this; },
};
19. ES6 Computed Property Names
var i = 0,
param = “name”;
var obj = {
[param] : “Object O”,
[“value” + ++i] : i,
};
var obj = {};
obj[param] = “Object O”;
obj[“value” + ++i] = i;
20. ES6 Arrow Functions
var foo = () => { return this; };
foo(); // window
var bar = () => {
“use strict”;
return this;
};
bar(); // window
var o = {
fetch : function () {
$.ajax({ url : "url" })
.done(() => {
console.log(this);
});
}
};
o.fetch(); // Object { fetch=function() }