I used these slides to present the benefits of using Kotlin to a group of people I work with. The presentation focuses on comparing Kotlin to Java, and in particular showing how Kotlin can help in writing safer, more concise and readable code. I used a few java gotchas/puzzles to demonstrate how Kotlin may prevent us from doing silly things.
Droidcon Berlin 2021 - With coroutines being the de facto way of exposing async work and streams of changes for Kotlin on Android, developers are obviously attempting to use the same approaches when moving their code to Multiplatform.
But due to the way the memory model differs between JVM and Kotlin Native, it can be a painful experience.
In this talk, we will take a deep dive into the Coroutine API for Kotlin Multiplatform. You will learn how to expose your API with Coroutines while working with the Kotlin Native memory model instead of against it, and avoid the dragons along the way.
With the announcement on officially supporting Kotlin for Android, this presentation tries to compare Java and Kotlin to encourage people to switch to Kotlin
This document provides an overview of Spring Boot and some of its key features. It discusses the origins and modules of Spring, how Spring Boot simplifies configuration and dependency management. It then covers examples of building Spring Boot applications that connect to a SQL database, use RabbitMQ for messaging, and schedule and run asynchronous tasks.
There are several JavaScript libraries available in the world of web programming. And, as the usage and complexity is increasing day by day, sometimes it becomes very difficult and confusing to understand and create modules using those libraries, especially for those having strong background of Object Oriented Languages.
So this one hour session will make an effort to go into the very basics of JavaScript and put a base for writing modular JavaScript code.
Kotlin is a concise, safe, and statically typed programming language that compiles to JVM bytecode and JavaScript. It focuses on interoperability with Java and solves many Java pitfalls. Kotlin removes verbosity like semicolons and replaces "extends" and "implement" with a colon. Functions are defined with the "fun" keyword and return types follow. Properties are treated like fields. Kotlin avoids null references through null safety features like the safe call operator and non-null assertion operator. When expressions replace switch statements. Extension functions can extend existing classes without subclassing.
If you still haven't heard of it, there is a new star in JVM sky - Kotlin. This short presentation will serve as intro for those who wan't to hear what's all the fuss about and dive deeper into this new alternative to Java
Introduction to Koltin for Android Part I Atif AbbAsi
Welcome to Android Basics in Kotlin! In this course, you'll learn the basics of building Android apps with the Kotlin programming language. Along the way, you'll develop a collection of apps to start your journey as an Android developer.
This talk introduces Spring's REST stack - Spring MVC, Spring HATEOAS, Spring Data REST, Spring Security OAuth and Spring Social - while refining an API to move higher up the Richardson maturity model
Rasheed Amir presents on Spring Boot. He discusses how Spring Boot aims to help developers build production-grade Spring applications quickly with minimal configuration. It provides default functionality for tasks like embedding servers and externalizing configuration. Spring Boot favors convention over configuration and aims to get developers started quickly with a single focus. It also exposes auto-configuration for common Spring and related technologies so that applications can take advantage of them without needing to explicitly configure them.
The document discusses the Kotlin programming language. It highlights that Kotlin is a modern, pragmatic language that provides good tooling and interoperability with Java. It has grown significantly in popularity since its initial release. The document then discusses various features of Kotlin like its concise and readable syntax, null safety, support for lambdas and extensions, and how it can be used for multi-platform projects. Kotlin aims to be an improvement over Java by making code more concise, safe, and expressive while maintaining interoperability with existing Java code and libraries.
The document discusses JUnit 5, the next generation of the JUnit testing framework for Java. Key aspects include a new programming model using extensions, support for Java 8 features, and ways to migrate from earlier JUnit versions. The new framework consists of the JUnit Platform launcher, the JUnit Jupiter API for writing tests, and the JUnit Vintage engine for running JUnit 3 and 4 tests.
The document discusses the benefits of using Gradle over other build tools like Eclipse, Ant, and Maven. Gradle combines features from Ant like flexibility with Maven's lifecycle and ease of use. It uses Groovy for its build scripts and supports plugins, dependencies, and conventions over configuration similar to Maven. Gradle allows building multiple projects with dependencies and supports composite builds that include other complete builds. The document provides examples of using Gradle with Java, web, and multi-project builds.
Lecture 8 from the IAG0040 Java course in TTÜ.
See the accompanying source code written during the lectures: https://github.com/angryziber/java-course
Data Persistence in Android with Room LibraryReinvently
Android developer Dmitry Dogar talks on how to organize data persistence in Android using the new Room library. Topic inspired by Google Developer Group meetup.
This document compares Kotlin and Java programming languages. It discusses what Kotlin and Java are, their key features and parameters for comparison such as compilation time, null safety, lambda functions, and community support. While Java has a larger community and is more established, Kotlin has advantages like easier learning curve, concise syntax, and null safety. The document also questions whether Kotlin will replace Java in the future.
LINQ
The acronym LINQ stands for Language Integrated Query. Microsoft’s query language is fully integrated and offers easy data access from in-memory objects, databases, XML documents, and many more. It is through a set of extensions, LINQ ably integrates queries in C# and Visual Basic. This tutorial offers a complete insight into LINQ with ample examples and coding. The entire tutorial is divided into various topics with subtopics that a beginner can be able to move gradually to more complex topics of LINQ.
This document provides an introduction to unit testing in Python and the Pytest framework. It discusses writing unit test code using the unittest framework and Pytest, how to test functions and handle failures. It also covers features of Pytest like skipping and expected failures, fixture setup/teardown, and distributed testing using the xdist plugin.
The document introduces the Kotlin programming language developed by JetBrains. It provides an overview of Kotlin's motivation, features, syntax and tooling. Key points include Kotlin being a statically typed JVM language intended for industrial use, its focus on common sense features from other languages, and full interoperability with Java.
JPA and Hibernate are specifications and frameworks for object-relational mapping (ORM) in Java. JPA is a specification for ORM that is vendor-neutral, while Hibernate is an open-source implementation of JPA. Both use annotations to map Java classes to database tables. JPA queries use JPAQL while Hibernate supports both JPAQL and its own HQL. Additional features covered include relationships, inheritance mapping strategies, custom types, and querying.
Coroutines are Kotlin's solution for concurrency and allow doing something else while waiting for results. They avoid issues with threading like memory usage and bottlenecks. Coroutines use suspending functions to pause execution and switch to other coroutines. They can be cancelled, have timeouts set, and structured hierarchically with jobs. Common coroutine patterns include producers that return values on channels and actors that receive messages on inbound channels. Coroutines are backed by event loops and may require yield() if CPU bound to allow other coroutines to run.
Presented on 27th September 2017 to a joint meeting of 'Cork Functional Programmers' and the 'Cork Java Users Group'
Based on the Kotlin Language programming course from Instil. For more details see https://instil.co/courses/kotlin-development/
Kotlin Coroutines Flow is coming to provide a cold asynchronous data stream that emits values sequentially within a coroutine. Flow allows mapping, filtering, and collecting values, handles exceptions transparently, and preserves context. It can integrate with existing APIs like Room and Retrofit using adapters, and is the primary way to handle async streams going forward. Channels will still be used for hot streams and synchronization between coroutines.
The document provides an introduction to asynchronous JavaScript. It discusses callbacks and their disadvantages like callback hell. Promises are introduced as a better way to handle asynchronous code by making it easier to write and chain asynchronous operations. Async/await is described as syntactic sugar that allows asynchronous code to be written more readably in a synchronous style using await and try/catch. Key aspects like the event loop, microtask queue, and Promise methods like all and race are explained. Overall the document aims to help understand what makes asynchronous code different and newer methods like promises and async/await that improve handling asynchronous operations in JavaScript.
Welcome to presentation on Spring boot which is really great and relatively a new project from Spring.io. Its aim is to simplify creating new spring framework based projects and unify their configurations by applying some conventions. This convention over configuration is already successfully applied in so called modern web based frameworks like Grails, Django, Play framework, Rails etc.
Introduction to Koltin for Android Part I Atif AbbAsi
Welcome to Android Basics in Kotlin! In this course, you'll learn the basics of building Android apps with the Kotlin programming language. Along the way, you'll develop a collection of apps to start your journey as an Android developer.
This talk introduces Spring's REST stack - Spring MVC, Spring HATEOAS, Spring Data REST, Spring Security OAuth and Spring Social - while refining an API to move higher up the Richardson maturity model
Rasheed Amir presents on Spring Boot. He discusses how Spring Boot aims to help developers build production-grade Spring applications quickly with minimal configuration. It provides default functionality for tasks like embedding servers and externalizing configuration. Spring Boot favors convention over configuration and aims to get developers started quickly with a single focus. It also exposes auto-configuration for common Spring and related technologies so that applications can take advantage of them without needing to explicitly configure them.
The document discusses the Kotlin programming language. It highlights that Kotlin is a modern, pragmatic language that provides good tooling and interoperability with Java. It has grown significantly in popularity since its initial release. The document then discusses various features of Kotlin like its concise and readable syntax, null safety, support for lambdas and extensions, and how it can be used for multi-platform projects. Kotlin aims to be an improvement over Java by making code more concise, safe, and expressive while maintaining interoperability with existing Java code and libraries.
The document discusses JUnit 5, the next generation of the JUnit testing framework for Java. Key aspects include a new programming model using extensions, support for Java 8 features, and ways to migrate from earlier JUnit versions. The new framework consists of the JUnit Platform launcher, the JUnit Jupiter API for writing tests, and the JUnit Vintage engine for running JUnit 3 and 4 tests.
The document discusses the benefits of using Gradle over other build tools like Eclipse, Ant, and Maven. Gradle combines features from Ant like flexibility with Maven's lifecycle and ease of use. It uses Groovy for its build scripts and supports plugins, dependencies, and conventions over configuration similar to Maven. Gradle allows building multiple projects with dependencies and supports composite builds that include other complete builds. The document provides examples of using Gradle with Java, web, and multi-project builds.
Lecture 8 from the IAG0040 Java course in TTÜ.
See the accompanying source code written during the lectures: https://github.com/angryziber/java-course
Data Persistence in Android with Room LibraryReinvently
Android developer Dmitry Dogar talks on how to organize data persistence in Android using the new Room library. Topic inspired by Google Developer Group meetup.
This document compares Kotlin and Java programming languages. It discusses what Kotlin and Java are, their key features and parameters for comparison such as compilation time, null safety, lambda functions, and community support. While Java has a larger community and is more established, Kotlin has advantages like easier learning curve, concise syntax, and null safety. The document also questions whether Kotlin will replace Java in the future.
LINQ
The acronym LINQ stands for Language Integrated Query. Microsoft’s query language is fully integrated and offers easy data access from in-memory objects, databases, XML documents, and many more. It is through a set of extensions, LINQ ably integrates queries in C# and Visual Basic. This tutorial offers a complete insight into LINQ with ample examples and coding. The entire tutorial is divided into various topics with subtopics that a beginner can be able to move gradually to more complex topics of LINQ.
This document provides an introduction to unit testing in Python and the Pytest framework. It discusses writing unit test code using the unittest framework and Pytest, how to test functions and handle failures. It also covers features of Pytest like skipping and expected failures, fixture setup/teardown, and distributed testing using the xdist plugin.
The document introduces the Kotlin programming language developed by JetBrains. It provides an overview of Kotlin's motivation, features, syntax and tooling. Key points include Kotlin being a statically typed JVM language intended for industrial use, its focus on common sense features from other languages, and full interoperability with Java.
JPA and Hibernate are specifications and frameworks for object-relational mapping (ORM) in Java. JPA is a specification for ORM that is vendor-neutral, while Hibernate is an open-source implementation of JPA. Both use annotations to map Java classes to database tables. JPA queries use JPAQL while Hibernate supports both JPAQL and its own HQL. Additional features covered include relationships, inheritance mapping strategies, custom types, and querying.
Coroutines are Kotlin's solution for concurrency and allow doing something else while waiting for results. They avoid issues with threading like memory usage and bottlenecks. Coroutines use suspending functions to pause execution and switch to other coroutines. They can be cancelled, have timeouts set, and structured hierarchically with jobs. Common coroutine patterns include producers that return values on channels and actors that receive messages on inbound channels. Coroutines are backed by event loops and may require yield() if CPU bound to allow other coroutines to run.
Presented on 27th September 2017 to a joint meeting of 'Cork Functional Programmers' and the 'Cork Java Users Group'
Based on the Kotlin Language programming course from Instil. For more details see https://instil.co/courses/kotlin-development/
Kotlin Coroutines Flow is coming to provide a cold asynchronous data stream that emits values sequentially within a coroutine. Flow allows mapping, filtering, and collecting values, handles exceptions transparently, and preserves context. It can integrate with existing APIs like Room and Retrofit using adapters, and is the primary way to handle async streams going forward. Channels will still be used for hot streams and synchronization between coroutines.
The document provides an introduction to asynchronous JavaScript. It discusses callbacks and their disadvantages like callback hell. Promises are introduced as a better way to handle asynchronous code by making it easier to write and chain asynchronous operations. Async/await is described as syntactic sugar that allows asynchronous code to be written more readably in a synchronous style using await and try/catch. Key aspects like the event loop, microtask queue, and Promise methods like all and race are explained. Overall the document aims to help understand what makes asynchronous code different and newer methods like promises and async/await that improve handling asynchronous operations in JavaScript.
Welcome to presentation on Spring boot which is really great and relatively a new project from Spring.io. Its aim is to simplify creating new spring framework based projects and unify their configurations by applying some conventions. This convention over configuration is already successfully applied in so called modern web based frameworks like Grails, Django, Play framework, Rails etc.
Control Flow Statements
Last Week Homework "Stack" Solution
Function pointer (函式指標)
Static Class Members (靜態類別成員)
Constructor & Destructor (建構子與解構子)
Class Templates (類別樣板)
My inspiration from reading *C++ Primer*, *Effective C++*, *More Effective C++*, *The C++ Standard Library* and some experience from coding.
Include:
* Debug
* C++ Syntax
* Habit && Optimization
* Trick
* Trap
* Reference
加上 AI 人工智慧與 ML 機器學習的需求, Kubernetes (K8s) 的基礎建設更為重要。
什麼?你想要地端全自建?這是什麼巫術?
在這場演講中,我們會介紹一些常見的 Kubernetes 安裝需要的關鍵元件,分享地端建置甚至到 GPU 主機建置遇到的問題,給大家做一個指引,少走一些彎路
(主題亦有在 KaLUG Kaohsiung Linux User Group 再次分享)
與 Sign in with Apple 的愛恨情仇 @ iPlayground2020Johnny Sung
注重用戶隱私的 Apple 在開發者大會 WWDC 2019 發表了 Sign in with Apple 的功能,iOS 13 後皆支援。今年(2020 年) 4 月之後強制要求所有新上架的 App(包含更新)皆要支援這個服務。
Sign in with Apple 怎麼接?跟其他第三方服務有什麼不同?
App 端、網站前端、後端要如何因應?會有什麼樣的雷?
讓我來跟你娓娓到來...
#iPlayground2020
This document discusses building an Android app to provide sunset times. It covers using permissions to vibrate the device, designing screens for success, loading, and error states, integrating APIs and JSON data to obtain sunset times, and writing unit tests following the Arrange-Act-Assert pattern. Code examples demonstrate making network requests using OkHttp, parsing JSON with Gson, and handling asynchronous results with jDeferred. Completing the app would allow users to view local sunset times.
Speaker: Young Fang, Johnny Sung
---
How visually impaired people use their phone?
How mobile developer fix their problems they encountered?
Here is the small tips for that.
Johnny Sung introduced various messaging platforms and APIs that can be used to build messaging bots, including Slack, Line, Facebook Messenger, Skype, and others. He covered the key features of each platform's bot APIs, including how to set up webhooks, send and receive messages, and provided code examples in PHP. The presentation aimed to help developers learn how to connect their services to popular messaging platforms through bots.
Everything About Bluetooth (淺談藍牙 4.0) - Peripheral 篇Johnny Sung
2016.01.22 @ Android Taipei
講解 Bluetooth 的 GATT 的概念,並以 Android 實作
Example code:
Peripheral - BLE CPU Temp
https://github.com/j796160836/Ble-CPUTemp-Android
Central - BLE Temperature Receiver
https://github.com/j796160836/BleTemperatureReceiver-Android
Everything About Bluetooth (淺談藍牙 4.0) - Central 篇Johnny Sung
講解 Bluetooth 的 GATT 的概念,並以 Android 實作
Example code:
Peripheral - BLE CPU Temp
https://github.com/j796160836/Ble-CPUTemp-Android
Central - BLE Temperature Receiver
https://github.com/j796160836/BleTemperatureReceiver-Android
2. Mobile device developer
Johnny Sung
https://fb.com/j796160836
https://blog.jks.coffee/
https://www.slideshare.net/j796160836
https://github.com/j796160836
27. var isCreature = true
if (isCreature) {
print("是⽣生物")
} else {
print("不是⽣生物")
}
(⾃自動判斷為布林林值,省略略型態寫法)
28. 常⽤用運算元
== 等於
> ⼤大於
>= ⼤大於等於
< ⼩小於
<= ⼩小於等於
&& AND
|| OR
! NOT
真值表
A B A && B A || B
false false false false
false true false true
true false false true
true true true true
31. val viewType: Int = 1
when (viewType) {
1, 2 -> {
// Do something with value 1 or 2
}
3 -> {
// Do something with value 3
}
else -> {
// Do something with default
}
}
32. switch (viewType) {
case 1:
case 2:
// Do something with value 1 or 2
break;
case 3:
// Do something with value 3
break;
default:
// Do something with default
}
val viewType: Int = 1
when (viewType) {
1, 2 -> {
// Do something with value 1 or 2
}
3 -> {
// Do something with value 3
}
else -> {
// Do something with default
}
}
Java Kotlin
😮
33. Java Kotlin
if (item instanceof ModelA) {
// ...
} else if (item instanceof ModelB) {
// ...
} else if (item instanceof ModelC) {
// ...
} else {
// ...
}
when (item) {
is ModelA -> {
// ...
}
is ModelB -> {
// ...
}
is ModelC -> {
// ...
}
else -> {
// ...
}
}
😎
型態判斷
型態判斷
43. Java
Kotlin
val strings = arrayOf("a", "b", "c")
for ((index, value) in strings.withIndex()) {
println("The element at $index is $value")
}
String[] strings = new String[]{"a", "b", "c"};
for (int index = 0; index < strings.length; index++) {
String value = strings[index];
System.out.println("The element at " + index + " is " + value);
}
44. Kotlin
型態省略略
val strings = arrayOf("a", "b")
val strings = ArrayList<String>()
strings.add("a")
strings.add("b")
strings.add("c")
型態省略略
val num = 1
val str = "hello"
型態省略略
型態省略略
val str:String = "hello"
val num:Int = 1
45. Java
Kotlin
for (int i = 0; i < strings.length; i++) {
String string = strings[i];
// ...
}
for (String string : strings) {
// ...
}
for (string in strings) {
// ...
}
String[] strings = new String[]{"a", "b"};
陣列列
陣列列
val strings: Array<String> = arrayOf("a", "b")
for (i in 0 until strings.size) {
// ...
}
62. class MyClass {
private val str = "hello"
public fun printHello() {
println(str)
}
}
類別名
類別變數
類別⽅方法
63. public class MyClass {
private String str = "hello";
public void printHello() {
System.out.println(str);
}
}
class MyClass {
private val str = "hello"
public fun printHello() {
println(str)
}
}
Java Kotlin
64. class 類別 object 物件
https://auto.epochtimes.com/car-b5-36337-%E6%96%B0%E8%BB%8A%E4%BB%8B%E7%B4%B9%EF%BC%9A2019%E6%AC%BE%E5%A5%A7%E8%BF%AAAudi%20A6.html
https://itw01.com/V25GNEJ.html
65. class MyDataModel {
var name: String? = ""
var num: Int = 0
}
val model = MyDataModel()
model.name = "John"
model.num = 123
建立 MyDataModel 物件
67. Java Kotlin
class Student {
private String name;
public Student(String name) {
this.name = name;
}
public void printName() {
System.out.println(name);
}
}
class Student {
var name: String
constructor(name: String) {
this.name = name
}
fun printName(){
println(name)
}
}
建構⼦子
68. 建構⼦子的變形
class Student {
var name: String
constructor(name: String) {
this.name = name
}
fun printName(){
println(name)
}
}
class Student(var name: String) {
fun printName(){
println(name)
}
}
80. 變數轉型
• 物件的轉型
• 要是繼承樹裡的才能轉型
open class Father {
// ...
}
class Brother: Father() {
// ...
}
var a: Father = Brother()
var b = a as? Brother
如果轉型失敗就回傳 null
變數型態為:Brother?
102. class HairClipperForDog {
fun haircut(dog: Dog) {
println("(理理髮器聲...)")
dog.sound()
println("頭⽑毛理理好了了!")
}
}
class HairClipperForCat {
fun haircut(cat: Cat) {
println("(理理髮器聲...)")
cat.sound()
println("頭⽑毛理理好了了!")
}
}
val myCat = Cat()
val catClipper = HairClipperForCat()
catClipper.haircut(myCat)
val myDog = Dog()
val dogClipper = HairClipperForDog()
dogClipper.haircut(myDog)
103. class HairClipper<T : Animal> {
fun haircut(animal: T) {
println("(理理髮器聲...)")
animal.sound()
println("頭⽑毛理理好了了!")
}
}
https://tw.buy.yahoo.com/gdsale/
%E6%97%A5%E8%B1%A1%E9%BB%91%E9%91%BD%E9%9B%BB%E5%8B%95%E7%90%86%E9%AB%AE%E5%99%A8%E5%85%85%E6%8F%92%E6%9C%89%E7%B7%9A%E7%84%A1%E7%B7%9AZOH-2600C-5289698.html
⾃自⼰己取的型態 T
只限於 Animal 繼承樹上的
104. val myDog = Dog()
val hairClipperForDog = HairClipper<Dog>()
hairClipperForDog.haircut(myDog)
val myCat = Cat()
val hairClipperForCat = HairClipper<Cat>()
hairClipperForCat.haircut(myCat)