Kotlin for Android Developers - Victor Kropp - Codemotion Rome 2018Codemotion
Kotlin is a programming language developed by JetBrains that targets multiple platforms including the JVM, JavaScript, and native binaries. A year ago it has been adopted as an officially supported language for Android development. Kotlin offers clean and concise syntax, interoperability, both object-oriented and functional code constructs, and a lot of other cool features with little or no overhead. Let's find out together why developers love this language and how it helps them to be productive and have fun!
Wolltest du schon immer die Vorteile und Ideen von Scala in deinen Java oder Kotlin Projekten nutzen? Dann ist Vavr (ehemals Javaslang) genau die richtige Bibliothek für dich.
Anhand echter Projektbeispiele schauen wir uns den Nutzen an, den Vavr mit seinen syntaktischen Erweiterungen und Features bei der täglichen Arbeit bietet. Wir schauen uns Value Types, echte funktionale Datentypen an und werden lernen, wie wir Exceptions sinnvoller behandeln können. Alles für besser wartbaren und sauberen Code!
Vavr bietet die Möglichkeit, die Vorteile objekt-funktionaler Programmierung zu nutzen, ohne Java den Rücken kehren zu müssen.
Kotlin for Android Developers - Victor Kropp - Codemotion Rome 2018Codemotion
Kotlin is a programming language developed by JetBrains that targets multiple platforms including the JVM, JavaScript, and native binaries. A year ago it has been adopted as an officially supported language for Android development. Kotlin offers clean and concise syntax, interoperability, both object-oriented and functional code constructs, and a lot of other cool features with little or no overhead. Let's find out together why developers love this language and how it helps them to be productive and have fun!
Wolltest du schon immer die Vorteile und Ideen von Scala in deinen Java oder Kotlin Projekten nutzen? Dann ist Vavr (ehemals Javaslang) genau die richtige Bibliothek für dich.
Anhand echter Projektbeispiele schauen wir uns den Nutzen an, den Vavr mit seinen syntaktischen Erweiterungen und Features bei der täglichen Arbeit bietet. Wir schauen uns Value Types, echte funktionale Datentypen an und werden lernen, wie wir Exceptions sinnvoller behandeln können. Alles für besser wartbaren und sauberen Code!
Vavr bietet die Möglichkeit, die Vorteile objekt-funktionaler Programmierung zu nutzen, ohne Java den Rücken kehren zu müssen.
The Android world is full of great people that built great stuff and published it for saving other a lot of time. In this talk, we’ll
go over a list of must-have libraries, tools, and resources every Android developer should know to make their Android development much
easier and help them build better apps in less time.
자프링(자바 + 스프링) 외길 12년차 서버 개발자가 코프링(코틀린 + 스프링)을 만난 후 코틀린의 특징과 스프링의 코틀린 지원을 알아가며 코프링 월드에서 살아남은 이야기…
코드 저장소: https://github.com/arawn/kotlin-support-in-spring
JavaScript Fundamentals with Angular and LodashBret Little
The purpose of this presentation is also largely to explain some of the fun parts of JavaScript (dynamic function invocation with reflection, dynamic arguments, etc). I don't necessarily encourage putting complex logic throughout your templates with lodash, though there may be times it is appropriate.
Lets talk about lodash and how it can easily be married to Angular. Using a six line filter, I will expose the power of lodash directly within angular templates. This will be an introduction to lodash, angular templates, and we'll talk about scope and reflection within JavaScript.
With Launchers and Choosers in Windows Phone, 3rd party apps integrate more closely into the underlying operating system while allowing end-users to perform common tasks. With Launchers and Choosers you will provide more functionality to your end-users while still maintaining that consistent user experience that will make your app feel like a native app. In this session we’ll cover how to use Windows Phone resources including camera, video and Bing maps. We’ll also cover accessing contacts and calendar as well as sensors (including accelerometer, compass, gyroscope and motion).
Callbacks, Promises, and Coroutines (oh my!): Asynchronous Programming Patter...Domenic Denicola
This talk takes a deep dive into asynchronous programming patterns and practices, with an emphasis on the promise pattern.
We go through the basics of the event loop, highlighting the drawbacks of asynchronous programming in a naive callback style. Fortunately, we can use the magic of promises to escape from callback hell with a powerful and unified interface for async APIs. Finally, we take a quick look at the possibilities for using coroutines both in current and future (ECMAScript Harmony) JavaScript.
public class Person { private String name; private int age;.pdfarjuncp10
public class Person
{
private String name;
private int age;
public Person()
{
name=\"\";
age=0;
}
/**
Create a person with a given name and age.
@param name the name
@param age the age
*/
public Person(String name, int age)
{
this.name = name;
this.age = age;
}
/**
Get the name.
@return the name
*/
public String getName()
{
return name;
}
/**
Change the name.
@param name the name
*/
public void setName(String name)
{
this.name = name;
}
/**
Get the age.
@return the age
*/
public int getAge()
{
return age;
}
/**
Change the age.
@param age the age
*/
public void setAge()
{
this.age = age;
}
/**
Convert person to string form.
*/
public String toString()
{
return \"Name: \" + name + \"\\t\" + \"Age: \" + age;
}
}
OUTPUT should look like this!
Solution
solution
package com.prt.test;
public class Person
{
protected String name;
protected int age;
public Person()
{
name=\"\";
age=0;
}
/**
Create a person with a given name and age.
@param name the name
@param age the age
*/
public Person(String name, int age)
{
this.name = name;
this.age = age;
}
/**
Get the name.
@return the name
*/
public String getName()
{
return name;
}
/**
Change the name.
@param name the name
*/
public void setName(String name)
{
this.name = name;
}
/**
Get the age.
@return the age
*/
public int getAge()
{
return age;
}
/**
Change the age.
@param age the age
*/
public void setAge()
{
this.age = age;
}
/**
Convert person to string form.
*/
public String toString()
{
return \"Name: \" + name + \"\\t\" + \"Age: \" + age;
}
}
package com.prt.test;
public class Student extends Person implements Comparable{
private int studentId;
private String major;
/**
* @return the studentId
*/
public int getStudentId() {
return studentId;
}
/**
* @param studentId the studentId to set
*/
public void setStudentId(int studentId) {
this.studentId = studentId;
}
/**
* @return the major
*/
public String getMajor() {
return major;
}
/**
* @param major the major to set
*/
public void setMajor(String major) {
this.major = major;
}
public Student(String name, int age, int studentId, String major) {
super(name, age);
this.studentId = studentId;
this.major = major;
}
/* (non-Javadoc)
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
return \"name:\" + name+ \"\\t\"+\"\\t\"+\"age:\"+ age+\"\\t\"+ \"studentId :\"+ studentId +
\"\\t\" +\" major:\"+ major;
}
public int compareTo(Student st){
if(studentId==st.studentId)
return 0;
else if(studentId>st.studentId)
return 1;
else
return -1;
}
}
package com.prt.test;
public class Instructor extends Person implements Comparable {
private double salary;
public Instructor(String name, int age, double salary) {
super(name, age);
this.salary = salary;
}
/**
* @return the salary
*/
public double getSalary() {
return salary;
}
/**
* @param salary
* the salary to set
*/
public void setSalary(double salary) {
this.salary = salary;
}
public int compareTo(Instructor is) {
if (salary == is.salary)
return 0;
else if (salary > is.salary)
return 1;
else
ret.
The Android world is full of great people that built great stuff and published it for saving other a lot of time. In this talk, we’ll
go over a list of must-have libraries, tools, and resources every Android developer should know to make their Android development much
easier and help them build better apps in less time.
자프링(자바 + 스프링) 외길 12년차 서버 개발자가 코프링(코틀린 + 스프링)을 만난 후 코틀린의 특징과 스프링의 코틀린 지원을 알아가며 코프링 월드에서 살아남은 이야기…
코드 저장소: https://github.com/arawn/kotlin-support-in-spring
JavaScript Fundamentals with Angular and LodashBret Little
The purpose of this presentation is also largely to explain some of the fun parts of JavaScript (dynamic function invocation with reflection, dynamic arguments, etc). I don't necessarily encourage putting complex logic throughout your templates with lodash, though there may be times it is appropriate.
Lets talk about lodash and how it can easily be married to Angular. Using a six line filter, I will expose the power of lodash directly within angular templates. This will be an introduction to lodash, angular templates, and we'll talk about scope and reflection within JavaScript.
With Launchers and Choosers in Windows Phone, 3rd party apps integrate more closely into the underlying operating system while allowing end-users to perform common tasks. With Launchers and Choosers you will provide more functionality to your end-users while still maintaining that consistent user experience that will make your app feel like a native app. In this session we’ll cover how to use Windows Phone resources including camera, video and Bing maps. We’ll also cover accessing contacts and calendar as well as sensors (including accelerometer, compass, gyroscope and motion).
Callbacks, Promises, and Coroutines (oh my!): Asynchronous Programming Patter...Domenic Denicola
This talk takes a deep dive into asynchronous programming patterns and practices, with an emphasis on the promise pattern.
We go through the basics of the event loop, highlighting the drawbacks of asynchronous programming in a naive callback style. Fortunately, we can use the magic of promises to escape from callback hell with a powerful and unified interface for async APIs. Finally, we take a quick look at the possibilities for using coroutines both in current and future (ECMAScript Harmony) JavaScript.
public class Person { private String name; private int age;.pdfarjuncp10
public class Person
{
private String name;
private int age;
public Person()
{
name=\"\";
age=0;
}
/**
Create a person with a given name and age.
@param name the name
@param age the age
*/
public Person(String name, int age)
{
this.name = name;
this.age = age;
}
/**
Get the name.
@return the name
*/
public String getName()
{
return name;
}
/**
Change the name.
@param name the name
*/
public void setName(String name)
{
this.name = name;
}
/**
Get the age.
@return the age
*/
public int getAge()
{
return age;
}
/**
Change the age.
@param age the age
*/
public void setAge()
{
this.age = age;
}
/**
Convert person to string form.
*/
public String toString()
{
return \"Name: \" + name + \"\\t\" + \"Age: \" + age;
}
}
OUTPUT should look like this!
Solution
solution
package com.prt.test;
public class Person
{
protected String name;
protected int age;
public Person()
{
name=\"\";
age=0;
}
/**
Create a person with a given name and age.
@param name the name
@param age the age
*/
public Person(String name, int age)
{
this.name = name;
this.age = age;
}
/**
Get the name.
@return the name
*/
public String getName()
{
return name;
}
/**
Change the name.
@param name the name
*/
public void setName(String name)
{
this.name = name;
}
/**
Get the age.
@return the age
*/
public int getAge()
{
return age;
}
/**
Change the age.
@param age the age
*/
public void setAge()
{
this.age = age;
}
/**
Convert person to string form.
*/
public String toString()
{
return \"Name: \" + name + \"\\t\" + \"Age: \" + age;
}
}
package com.prt.test;
public class Student extends Person implements Comparable{
private int studentId;
private String major;
/**
* @return the studentId
*/
public int getStudentId() {
return studentId;
}
/**
* @param studentId the studentId to set
*/
public void setStudentId(int studentId) {
this.studentId = studentId;
}
/**
* @return the major
*/
public String getMajor() {
return major;
}
/**
* @param major the major to set
*/
public void setMajor(String major) {
this.major = major;
}
public Student(String name, int age, int studentId, String major) {
super(name, age);
this.studentId = studentId;
this.major = major;
}
/* (non-Javadoc)
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
return \"name:\" + name+ \"\\t\"+\"\\t\"+\"age:\"+ age+\"\\t\"+ \"studentId :\"+ studentId +
\"\\t\" +\" major:\"+ major;
}
public int compareTo(Student st){
if(studentId==st.studentId)
return 0;
else if(studentId>st.studentId)
return 1;
else
return -1;
}
}
package com.prt.test;
public class Instructor extends Person implements Comparable {
private double salary;
public Instructor(String name, int age, double salary) {
super(name, age);
this.salary = salary;
}
/**
* @return the salary
*/
public double getSalary() {
return salary;
}
/**
* @param salary
* the salary to set
*/
public void setSalary(double salary) {
this.salary = salary;
}
public int compareTo(Instructor is) {
if (salary == is.salary)
return 0;
else if (salary > is.salary)
return 1;
else
ret.
Code to copy:
/******************** Person.java **********************/
// Create a class Person
publicclass Person
{
// Declare variables
private String name;
private MyDate birthdate; // This is a date based on a Person\'s birthday
// Create accessor method for the name
public String getName()
{
return name;
}
// Create mutator method for name
publicvoid setName(String name)
{
this.name = name;
}
// Create accessor method for the name
public MyDate getBirthdate()
{
return birthdate;
}
// Create mutator method for name
publicvoid setBirthdate(MyDate birthdate)
{
this.birthdate = birthdate;
}
// Create a parameter constructor
public Person(String name, int pp, int kk, int vv)
{
this(name, new MyDate(pp, kk, vv));
}
// Create a parameter constructor
public Person(String name, MyDate birthday)
{
this(name);
this.birthdate = birthday;
}
// Create a parameter constructor
public Person(String name) {
this.name = name;
}
// Create to string method to display person data
@Override
public String toString() {
return \"Person [name=\" + name + \", birthdate=\" + birthdate + \"]\";
}
}
/******************** MyDate.java **********************/
// Create a class named MyDate
class MyDate
{
// Declare variables
privateint day;
privateint month;
privateint year;
// Create a default constructor
public MyDate(int month, int day, int year)
{
this.day = day;
this.month = month;
this.year = year;
}
// Create a compareTo method to compare the date objects
int compareTo(MyDate obj)
{
if(obj.day==this.day && obj.month==this.month && obj.year==this.year)
{
return 0;
}
elseif(obj.year>this.year)
{
return 1;
}
elseif(obj.year > this.year && obj.month > this.month)
{
return 1;
}
elseif(obj.year > this.year && obj.month > this.month && obj.day==this.day)
{
return 1;
}
else
return -1;
}
// Create a toString() method to display the date
@Override
public String toString()
{
return \"MyDate [day=\" + day + \", month=\" + month + \", year=\" + year + \"]\";
}
}
/******************** PersonSort.java **********************/
// import statements
import java.util.*;
import java.io.*;
// Create a class PersonSort
publicclass PersonSort implements Comparator
{
// Create compare method to compare two objects
@Override
publicint compare(Person o1, Person o2)
{
return 0;
}
// Create a main method to test the program
publicstaticvoid main(String [] args)
{
// Declare variables
String line;
String fileName=\"dataFile.txt\";
String data=\"\";
// Create a array list for the person class
ArrayList person= new ArrayList();
// Create a try block to handle the run time exceptions
try
{
// Create an object for the FileReader class
FileReader fileReader = new FileReader(fileName);
BufferedReader bufferedReader = new BufferedReader(fileReader);
// Create a for loop to read the data in the file dataFile.txt
while ((line = bufferedReader.readLine()) != null)
{
data+=line;
}
}
// Create a catch block to catch run time exceptions.
catch (FileNotFoundException ex)
{
System.out.println(\"Unable to op.
Alternatives of JPA
Requery provide simple Object Mapping & Generate SQL to execute without reflection and session, so fast than JPA, simple and easy to learn.
HEAP SORT ILLUSTRATED WITH HEAPIFY, BUILD HEAP FOR DYNAMIC ARRAYS.
Heap sort is a comparison-based sorting technique based on Binary Heap data structure. It is similar to the selection sort where we first find the minimum element and place the minimum element at the beginning. Repeat the same process for the remaining elements.
CW RADAR, FMCW RADAR, FMCW ALTIMETER, AND THEIR PARAMETERSveerababupersonal22
It consists of cw radar and fmcw radar ,range measurement,if amplifier and fmcw altimeterThe CW radar operates using continuous wave transmission, while the FMCW radar employs frequency-modulated continuous wave technology. Range measurement is a crucial aspect of radar systems, providing information about the distance to a target. The IF amplifier plays a key role in signal processing, amplifying intermediate frequency signals for further analysis. The FMCW altimeter utilizes frequency-modulated continuous wave technology to accurately measure altitude above a reference point.
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdffxintegritypublishin
Advancements in technology unveil a myriad of electrical and electronic breakthroughs geared towards efficiently harnessing limited resources to meet human energy demands. The optimization of hybrid solar PV panels and pumped hydro energy supply systems plays a pivotal role in utilizing natural resources effectively. This initiative not only benefits humanity but also fosters environmental sustainability. The study investigated the design optimization of these hybrid systems, focusing on understanding solar radiation patterns, identifying geographical influences on solar radiation, formulating a mathematical model for system optimization, and determining the optimal configuration of PV panels and pumped hydro storage. Through a comparative analysis approach and eight weeks of data collection, the study addressed key research questions related to solar radiation patterns and optimal system design. The findings highlighted regions with heightened solar radiation levels, showcasing substantial potential for power generation and emphasizing the system's efficiency. Optimizing system design significantly boosted power generation, promoted renewable energy utilization, and enhanced energy storage capacity. The study underscored the benefits of optimizing hybrid solar PV panels and pumped hydro energy supply systems for sustainable energy usage. Optimizing the design of solar PV panels and pumped hydro energy supply systems as examined across diverse climatic conditions in a developing country, not only enhances power generation but also improves the integration of renewable energy sources and boosts energy storage capacities, particularly beneficial for less economically prosperous regions. Additionally, the study provides valuable insights for advancing energy research in economically viable areas. Recommendations included conducting site-specific assessments, utilizing advanced modeling tools, implementing regular maintenance protocols, and enhancing communication among system components.
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...Dr.Costas Sachpazis
Terzaghi's soil bearing capacity theory, developed by Karl Terzaghi, is a fundamental principle in geotechnical engineering used to determine the bearing capacity of shallow foundations. This theory provides a method to calculate the ultimate bearing capacity of soil, which is the maximum load per unit area that the soil can support without undergoing shear failure. The Calculation HTML Code included.
Immunizing Image Classifiers Against Localized Adversary Attacksgerogepatton
This paper addresses the vulnerability of deep learning models, particularly convolutional neural networks
(CNN)s, to adversarial attacks and presents a proactive training technique designed to counter them. We
introduce a novel volumization algorithm, which transforms 2D images into 3D volumetric representations.
When combined with 3D convolution and deep curriculum learning optimization (CLO), itsignificantly improves
the immunity of models against localized universal attacks by up to 40%. We evaluate our proposed approach
using contemporary CNN architectures and the modified Canadian Institute for Advanced Research (CIFAR-10
and CIFAR-100) and ImageNet Large Scale Visual Recognition Challenge (ILSVRC12) datasets, showcasing
accuracy improvements over previous techniques. The results indicate that the combination of the volumetric
input and curriculum learning holds significant promise for mitigating adversarial attacks without necessitating
adversary training.
Final project report on grocery store management system..pdfKamal Acharya
In today’s fast-changing business environment, it’s extremely important to be able to respond to client needs in the most effective and timely manner. If your customers wish to see your business online and have instant access to your products or services.
Online Grocery Store is an e-commerce website, which retails various grocery products. This project allows viewing various products available enables registered users to purchase desired products instantly using Paytm, UPI payment processor (Instant Pay) and also can place order by using Cash on Delivery (Pay Later) option. This project provides an easy access to Administrators and Managers to view orders placed using Pay Later and Instant Pay options.
In order to develop an e-commerce website, a number of Technologies must be studied and understood. These include multi-tiered architecture, server and client-side scripting techniques, implementation technologies, programming language (such as PHP, HTML, CSS, JavaScript) and MySQL relational databases. This is a project with the objective to develop a basic website where a consumer is provided with a shopping cart website and also to know about the technologies used to develop such a website.
This document will discuss each of the underlying technologies to create and implement an e- commerce website.
NUMERICAL SIMULATIONS OF HEAT AND MASS TRANSFER IN CONDENSING HEAT EXCHANGERS...ssuser7dcef0
Power plants release a large amount of water vapor into the
atmosphere through the stack. The flue gas can be a potential
source for obtaining much needed cooling water for a power
plant. If a power plant could recover and reuse a portion of this
moisture, it could reduce its total cooling water intake
requirement. One of the most practical way to recover water
from flue gas is to use a condensing heat exchanger. The power
plant could also recover latent heat due to condensation as well
as sensible heat due to lowering the flue gas exit temperature.
Additionally, harmful acids released from the stack can be
reduced in a condensing heat exchanger by acid condensation. reduced in a condensing heat exchanger by acid condensation.
Condensation of vapors in flue gas is a complicated
phenomenon since heat and mass transfer of water vapor and
various acids simultaneously occur in the presence of noncondensable
gases such as nitrogen and oxygen. Design of a
condenser depends on the knowledge and understanding of the
heat and mass transfer processes. A computer program for
numerical simulations of water (H2O) and sulfuric acid (H2SO4)
condensation in a flue gas condensing heat exchanger was
developed using MATLAB. Governing equations based on
mass and energy balances for the system were derived to
predict variables such as flue gas exit temperature, cooling
water outlet temperature, mole fraction and condensation rates
of water and sulfuric acid vapors. The equations were solved
using an iterative solution technique with calculations of heat
and mass transfer coefficients and physical properties.
21. @AutoValue
public abstract class User implements Parcelable {
public abstract String name();
@Nullable
public abstract String email();
public abstract int age();
public abstract Date createdAt();
public static User create(String name, String email, int age, Date createdAt) {
return builder()
.name(name)
.email(email)
.age(age)
.createdAt(createdAt)
.build();
}
public static Builder builder() {return new AutoValue_User.Builder();}
@AutoValue.Builder
public abstract static class Builder {
public abstract Builder name(String name);
public abstract Builder email(String email);
public abstract Builder age(int age);
public abstract Builder createdAt(Date createdAt);
public abstract User build();
}
}
23. @AutoValue
public abstract class User implements Parcelable {
public abstract String name();
@Nullable
public abstract String email();
public abstract int age();
public abstract Date createdAt();
public static User create(String name, String email, int age, Date createdAt) {
return builder()
.name(name)
.email(email)
.age(age)
.createdAt(createdAt)
.build();
}
public static Builder builder() {return new AutoValue_User.Builder();}
@AutoValue.Builder
public abstract static class Builder {
public abstract Builder name(String name);
public abstract Builder email(String email);
public abstract Builder age(int age);
public abstract Builder createdAt(Date createdAt);
public abstract User build();
}
}
34. class User(
name: String,
email: String?,
age: Int,
createdAt: Date
) {
var name: String = name,
var email: String? = email,
var age: Int = age,
var createdAt: Date = createdAt
}
• 定義 properties
35. class User(
var name: String,
var email: String?,
var age: Int,
var createdAt: Date
) { }
• 更更簡單的寫法
36. class User(
val name: String,
val email: String?,
val age: Int,
val createdAt: Date
) { }
• 定義 immutable properties
37. class User(
val name: String = "No Name",
val email: String? = null,
val age: Int = 0,
val createdAt: Date = Date()
) { }
• 給預設值
38. Data Classes
• The compiler automatically derives the following members from all
properties declared in the primary constructor:
• 根據你定義的 properties,⾃自動幫你產⽣生以下四種內容
• equals()/hashCode()
• toString()
• componentN() functions
• copy()
49. class User(
val name: String,
val email: String?
) {
fun copy(name: String = this.name, email: String? = this.email): User {
return User(name = name, email = email)
}
}
• copy() 的實作如下
50. data class User(
val name: String,
val email: String?,
val age: Int,
val createdAt: Date
) : AutoParcelable { }
51. data class User(
val name: String,
val email: String?,
val age: Int,
val createdAt: Date
) : AutoParcelable {
fun updateAge(newAge: Int): User {
return copy(age = newAge)
}
}
52. data class User(
val name: String,
val email: String?,
val age: Int,
val createdAt: Date
) : AutoParcelable {
fun updateAge(newAge: Int): User {
return copy(age = newAge)
}
}
53. data class User(
val name: String,
val email: String?,
val age: Int,
val createdAt: Date
) : AutoParcelable {
fun updateAge(newAge: Int): User {
return copy(age = newAge)
}
}
user = user.updateAge(18);
assertThat(user.getAge()).isEqualTo(18);
77. Unit Test
• Kotlin 所有的東⻄西,預設都是 final
• 當要 Mock (2.0) 時,會出現以下問題:
org.mockito.exceptions.base.MockitoException:
Cannot mock/spy class com.example.kotlindataclass.model.xxx
cannot mock/spy because :
- final class
80. 如何開始導入 Kotlin
1.挑選最少⽤用到的 Data Model
2.對此 Data Model 寫測試 (encode/decode)
3.透過 Android Studio Converter (command+shift+a)
4.在⼀一個 commit 裡⼀一次做完 (要反悔悔也容易易)