This document discusses the Open Data Protocol (OData) which aims to break down "data silos" by providing standard web APIs and allowing data from different sources to be accessed in a uniform way. OData defines a set of best practices for building and consuming RESTful APIs and provides conventions for querying and managing data over HTTP. The document outlines the basics of OData including URIs, query options, data types, expressions and service operations. It also discusses how OData can be implemented using various technologies and consumed by both web and native applications.
Improving RDF Search Performance with Lucene and SIRENMike Hugo
This document discusses improving the performance of semantic web applications by indexing RDF datasets with Lucene, SIREn, and RDF. It begins with an overview of SPARQL and its limitations for querying large datasets. It then introduces Lucene as a way to index and search text fields from RDF triples for improved query performance. Finally, it discusses how SIREn can be used to extend Lucene indexing to support semi-structured data from RDF triples beyond just text fields.
Exploring type level programming in ScalaJorge Vásquez
In this introduction to type-level programming in Scala, we are going to discuss how we can leverage the full power of the type system to verify domain properties of an application at compile-time, instead of doing runtime verifications at the value-level
Some parts of our applications don't need to be asynchronous or interact with the outside world: it's enough that they are stateful, possibly with the ability to handle failure, context, and logging. Although you can use ZIO 2 or monad transformers for this task, both come with drawbacks. In this presentation, Jorge Vásquez will introduce you to ZPure, a data type from ZIO Prelude, which lets you scale back on the power of ZIO 2, but with the same high-performance, type-inference, and ergonomics you expect from ZIO 2 libraries.
Customizing the list control - Sencha Touch mobile web applicationJoseph Khan
A tutorial from my blog http://jbkflex.wordpress.com on how to customize the look and feel of the default Sencha Touch List control and give it something of your own.
This document introduces Spring Data, an open source framework that provides a consistent programming model for data access while retaining store-specific features. It supports both relational and non-relational data stores. Spring Data offers mapping support, template classes, and repositories that provide a common interface for querying different data sources. It aims to simplify data access and reduce boilerplate code.
This document discusses the Open Data Protocol (OData) which aims to break down "data silos" by providing standard web APIs and allowing data from different sources to be accessed in a uniform way. OData defines a set of best practices for building and consuming RESTful APIs and provides conventions for querying and managing data over HTTP. The document outlines the basics of OData including URIs, query options, data types, expressions and service operations. It also discusses how OData can be implemented using various technologies and consumed by both web and native applications.
Improving RDF Search Performance with Lucene and SIRENMike Hugo
This document discusses improving the performance of semantic web applications by indexing RDF datasets with Lucene, SIREn, and RDF. It begins with an overview of SPARQL and its limitations for querying large datasets. It then introduces Lucene as a way to index and search text fields from RDF triples for improved query performance. Finally, it discusses how SIREn can be used to extend Lucene indexing to support semi-structured data from RDF triples beyond just text fields.
Exploring type level programming in ScalaJorge Vásquez
In this introduction to type-level programming in Scala, we are going to discuss how we can leverage the full power of the type system to verify domain properties of an application at compile-time, instead of doing runtime verifications at the value-level
Some parts of our applications don't need to be asynchronous or interact with the outside world: it's enough that they are stateful, possibly with the ability to handle failure, context, and logging. Although you can use ZIO 2 or monad transformers for this task, both come with drawbacks. In this presentation, Jorge Vásquez will introduce you to ZPure, a data type from ZIO Prelude, which lets you scale back on the power of ZIO 2, but with the same high-performance, type-inference, and ergonomics you expect from ZIO 2 libraries.
Customizing the list control - Sencha Touch mobile web applicationJoseph Khan
A tutorial from my blog http://jbkflex.wordpress.com on how to customize the look and feel of the default Sencha Touch List control and give it something of your own.
This document introduces Spring Data, an open source framework that provides a consistent programming model for data access while retaining store-specific features. It supports both relational and non-relational data stores. Spring Data offers mapping support, template classes, and repositories that provide a common interface for querying different data sources. It aims to simplify data access and reduce boilerplate code.
Commonality and Variability Analysis: Avoiding Duplicate CodeAlistair McKinnell
Duplicate code is something to be avoided. And yet, everyday developers make copies of working code, make edits to the copy, and create duplicate code.
Some developers have the discipline and the skill to refactor to eliminate this duplicate code. Many do not.
Airline reservation project using JAVA in NetBeans IDEHimanshiSingh71
This project is based on the database connectivity JDBC . In this application user can book airline flight . This is offline airline program in which the user can book and cancelled their flight and payment through credit and debit card .
User can take the information of different types of airline flight . In this application user can also see and take knowledge about the famous historical places without moving to another website .
This application is also secure from hacker.
Overall , this application is very much useful for users because they can do offline flight booking and it is secure application for booking flight and other purposes.
R Markdown allows users to:
1. Combine narrative text and code to produce dynamic reports or presentations.
2. Choose output formats like HTML, PDF, Word, and slideshows to share results.
3. Reproduce analyses through embedded R code chunks that can be re-executed.
The Ring programming language version 1.9 book - Part 54 of 210Mahmoud Samir Fayed
This document discusses using the RingLibCurl library in Ring to make HTTP requests. It provides examples of making GET and POST requests, using cURL to log into Facebook, saving the output of a request to a string, and retrieving stock data from Yahoo Finance by extracting cookie and crumb values. The examples demonstrate initializing cURL handles, setting options like the URL, headers, and cookies, performing requests, and cleaning up handles after requests are completed.
Exploring ZIO Prelude: The game changer for typeclasses in ScalaJorge Vásquez
The document discusses ZIO Prelude, a Scala library that provides typeclasses. It motivates ZIO Prelude by explaining limitations of Scalaz in Scala compared to Haskell. It then provides an overview and tour of capabilities in ZIO Prelude, including validating data with Validation to accumulate all errors, combining nested data structures by summing stats, and executing pure computations. The document uses examples to demonstrate how ZIO Prelude provides a more Scala-centric approach to functional programming compared to porting Haskell concepts.
Moving to hybrid relational/JSON data modelsMariaDB plc
While some data is best modeled as rows, other data is best modeled as JSON documents. JSON is the de facto standard for REST and microservices. MariaDB is the leading enterprise open source relational database, but it includes a comprehensive set of SQL functions for storing, indexing and querying JSON documents, too. In this session, you’ll learn how to extend relational data models with JSON documents to get the flexibility and agility you need when building modern applications.
NOSQL part of the SpringOne 2GX 2010 keynoteEmil Eifrem
The document discusses Spring Data support for non-relational databases (NOSQL) to address challenges of proliferating and complex data not suitable for relational databases. It provides examples of using Spring Data with the Neo4j graph database to model complex domains like social networks by adding graph features to existing JPA data models and handling relationships as entities rather than raw database operations. A new Spring Roo add-on is presented for simplified Neo4j integration.
The document discusses functions and objects in JavaScript. It defines a function as a reusable block of code that performs operations to fulfill a specific task. Functions can be invoked to execute their code. Objects are collections of properties and methods that represent real-world entities. The document describes how to create user-defined functions and objects in JavaScript, including defining properties and methods. It also provides examples of the built-in String and Math objects and their properties and methods.
This document outlines topics covered in a lecture on object oriented JavaScript using the Prototype framework, including:
- Revision of object oriented JavaScript concepts like objects, prototypes, and classes
- Prototype framework utilities like $, $$ and Enumerable
- Extending DOM elements using Prototype methods
- Templates, form management, and getting element dimensions
- Event handling and classes/inheritance in Prototype
- JSON encoding/parsing
- Ajax utilities like Ajax.Request and Ajax.Updater
Parameterization is nothing but giving multiple inputuanna
The document discusses different ways to parameterize test data in automation scripts, including inputting data from external files, using a datatable, looping, and interactive submission. It provides code examples of creating a FileSystemObject to work with files and folders, and using methods like CreateTextFile, CopyFile, DeleteFile, CreateFolder, and others.
The document discusses elementary sorting algorithms including selection sort, insertion sort, and shellsort. It provides examples of how sorting can be used to sort various data types like numbers, strings, and files by implementing callbacks that allow the sorting routines to compare objects. The key point is that sorting routines do not need specific information about the types of objects being sorted since clients can pass a compare method through an interface like Comparable.
From java to kotlin beyond alt+shift+cmd+k - Droidcon italyFabio Collini
Kotlin is a first-class language for Android development since Google I/O 2017. And it’s here to stay!
Thanks to Android Studio it’s really easy to introduce Kotlin in an existing project, the configuration is trivial and then we can convert Java classes to Kotlin using a Alt+Shift+Cmd+K. But the new syntax is the just beginning, using Kotlin we can improve our code making it more readable and simpler to write.
In this talk we’ll see how to use some Kotlin features (for example data classes, collections, coroutines and delegates) to simplify Android development comparing the code with the equivalent “modern” Java code. It’s not fair to compare Kotlin code with plain Java 6 code so the Java examples will use lambdas and some external libraries like RxJava and AutoValue.
Scala presentation by Aleksandar ProkopecLoïc Descotte
This document provides an introduction to the Scala programming language. It discusses how Scala runs on the Java Virtual Machine, supports both object-oriented and functional programming paradigms, and provides features like pattern matching, immutable data structures, lazy evaluation, and parallel collections. Scala aims to be concise, expressive, and extensible.
This document provides an overview of schema design and data modeling for both relational and non-relational databases. It discusses the history of data modeling including hierarchical and relational models. The goals of data modeling are to avoid anomalies, minimize redesign, and make the model informative for users. Common data modeling patterns like one-to-many, many-to-many, and tree structures are explained. Specific examples are given for modeling comments, products, and categories in a non-relational database.
Async code on kotlin: rx java or/and coroutines - Kotlin Night TurinFabio Collini
It’s never easy to write async code but luckily there are many libraries to manage asynchronicity without adding too much complexity. In the last years RxJava and the other ReactiveX libraries have been very popular but lately there is a new way to manage async code in Kotlin: the coroutines. In this talk we’ll pros and cons of there two approaches and how to leverage them to simplify asynchronous code on Android.
Do they solve the same problem? Can we use them together? Which one can be used to write functional code? How can we use them effectively in Android development?
Spoiler alert: They are both great!
In this talk we’ll see how to solve common problems using RxJava or Coroutines, starting from basic concepts (for example the Retrofit support and how to cancel a task) to some more advanced (like threading, error management and how to combine multiple tasks).
All example of the talk are available on this repository:
https://github.com/fabioCollini/RxJavaVsCoroutines
From Java to Kotlin beyond alt+shift+cmd+k - Kotlin Community Conf MilanFabio Collini
Kotlin is a first-class language for Android development since Google I/O 2017. And it’s here to stay!
Thanks to Android Studio it’s really easy to introduce Kotlin in an existing project, the configuration is trivial and then we can convert Java classes to Kotlin using a Alt+Shift+Cmd+K. But the new syntax is the just beginning, using Kotlin we can improve our code making it more readable and simpler to write.
In this talk we’ll see how to use some Kotlin features (for example data classes, collections, coroutines and delegates) to simplify Android development comparing the code with the equivalent “modern” Java code. It’s not fair to compare Kotlin code with plain Java 6 code so the Java examples will use lambdas and some external libraries like RxJava and AutoValue.
Phactory is an alternative to database fixtures for defining test data in PHP unit tests. It allows developers to define database objects in code and dynamically create them, rather than loading static datasets. Phactory provides a lightweight ORM and works with MySQL, SQLite, and MongoDB. It supports defining object blueprints, creating objects with associations, retrieving objects, and integrating with PHPUnit for testing database code.
This document provides a quick reference guide for EJBQL 3.0, including:
1) How to write queries using parameters, perform updates and deletes, use subqueries, ordering, and aggregates.
2) Details on query structure, available where clause methods, and using SQL queries.
3) How to map query results to custom result classes and aliases.
jQuery is a JavaScript library that makes it easier to write JavaScript code that runs on different browsers. It allows selecting DOM elements, traversing through them and manipulating them. jQuery simplifies tasks like handling events, animating elements, and making AJAX calls. Some key features include selecting elements by tag name, ID, or CSS class; traversing DOM elements; binding event handlers; animating elements with effects like show, hide, fade; and making asynchronous HTTP requests via AJAX.
Room is an Android framework that provides an abstraction layer over SQLite to allow for more robust database access while harnessing the full power of SQLite. It provides entities, data access objects (DAOs), and a database class to simplify data persistence. Key aspects include using annotations to define entities and SQL operations, verifying SQL at compile time, supporting relationships between entities and migrations. Room also integrates with LiveData and RxJava for observable data streams.
The document summarizes the key concepts of Java Persistence API (JPA) and EntityManager for managing object-relational mapping and persistence of data. It discusses how JPA simplifies data access using plain old Java objects (POJOs), standardizes annotations and configuration, and supports pluggable persistence providers. Entities, relationships, inheritance mapping strategies, identity, and the entity lifecycle involving the entity manager are described at a high level.
Commonality and Variability Analysis: Avoiding Duplicate CodeAlistair McKinnell
Duplicate code is something to be avoided. And yet, everyday developers make copies of working code, make edits to the copy, and create duplicate code.
Some developers have the discipline and the skill to refactor to eliminate this duplicate code. Many do not.
Airline reservation project using JAVA in NetBeans IDEHimanshiSingh71
This project is based on the database connectivity JDBC . In this application user can book airline flight . This is offline airline program in which the user can book and cancelled their flight and payment through credit and debit card .
User can take the information of different types of airline flight . In this application user can also see and take knowledge about the famous historical places without moving to another website .
This application is also secure from hacker.
Overall , this application is very much useful for users because they can do offline flight booking and it is secure application for booking flight and other purposes.
R Markdown allows users to:
1. Combine narrative text and code to produce dynamic reports or presentations.
2. Choose output formats like HTML, PDF, Word, and slideshows to share results.
3. Reproduce analyses through embedded R code chunks that can be re-executed.
The Ring programming language version 1.9 book - Part 54 of 210Mahmoud Samir Fayed
This document discusses using the RingLibCurl library in Ring to make HTTP requests. It provides examples of making GET and POST requests, using cURL to log into Facebook, saving the output of a request to a string, and retrieving stock data from Yahoo Finance by extracting cookie and crumb values. The examples demonstrate initializing cURL handles, setting options like the URL, headers, and cookies, performing requests, and cleaning up handles after requests are completed.
Exploring ZIO Prelude: The game changer for typeclasses in ScalaJorge Vásquez
The document discusses ZIO Prelude, a Scala library that provides typeclasses. It motivates ZIO Prelude by explaining limitations of Scalaz in Scala compared to Haskell. It then provides an overview and tour of capabilities in ZIO Prelude, including validating data with Validation to accumulate all errors, combining nested data structures by summing stats, and executing pure computations. The document uses examples to demonstrate how ZIO Prelude provides a more Scala-centric approach to functional programming compared to porting Haskell concepts.
Moving to hybrid relational/JSON data modelsMariaDB plc
While some data is best modeled as rows, other data is best modeled as JSON documents. JSON is the de facto standard for REST and microservices. MariaDB is the leading enterprise open source relational database, but it includes a comprehensive set of SQL functions for storing, indexing and querying JSON documents, too. In this session, you’ll learn how to extend relational data models with JSON documents to get the flexibility and agility you need when building modern applications.
NOSQL part of the SpringOne 2GX 2010 keynoteEmil Eifrem
The document discusses Spring Data support for non-relational databases (NOSQL) to address challenges of proliferating and complex data not suitable for relational databases. It provides examples of using Spring Data with the Neo4j graph database to model complex domains like social networks by adding graph features to existing JPA data models and handling relationships as entities rather than raw database operations. A new Spring Roo add-on is presented for simplified Neo4j integration.
The document discusses functions and objects in JavaScript. It defines a function as a reusable block of code that performs operations to fulfill a specific task. Functions can be invoked to execute their code. Objects are collections of properties and methods that represent real-world entities. The document describes how to create user-defined functions and objects in JavaScript, including defining properties and methods. It also provides examples of the built-in String and Math objects and their properties and methods.
This document outlines topics covered in a lecture on object oriented JavaScript using the Prototype framework, including:
- Revision of object oriented JavaScript concepts like objects, prototypes, and classes
- Prototype framework utilities like $, $$ and Enumerable
- Extending DOM elements using Prototype methods
- Templates, form management, and getting element dimensions
- Event handling and classes/inheritance in Prototype
- JSON encoding/parsing
- Ajax utilities like Ajax.Request and Ajax.Updater
Parameterization is nothing but giving multiple inputuanna
The document discusses different ways to parameterize test data in automation scripts, including inputting data from external files, using a datatable, looping, and interactive submission. It provides code examples of creating a FileSystemObject to work with files and folders, and using methods like CreateTextFile, CopyFile, DeleteFile, CreateFolder, and others.
The document discusses elementary sorting algorithms including selection sort, insertion sort, and shellsort. It provides examples of how sorting can be used to sort various data types like numbers, strings, and files by implementing callbacks that allow the sorting routines to compare objects. The key point is that sorting routines do not need specific information about the types of objects being sorted since clients can pass a compare method through an interface like Comparable.
From java to kotlin beyond alt+shift+cmd+k - Droidcon italyFabio Collini
Kotlin is a first-class language for Android development since Google I/O 2017. And it’s here to stay!
Thanks to Android Studio it’s really easy to introduce Kotlin in an existing project, the configuration is trivial and then we can convert Java classes to Kotlin using a Alt+Shift+Cmd+K. But the new syntax is the just beginning, using Kotlin we can improve our code making it more readable and simpler to write.
In this talk we’ll see how to use some Kotlin features (for example data classes, collections, coroutines and delegates) to simplify Android development comparing the code with the equivalent “modern” Java code. It’s not fair to compare Kotlin code with plain Java 6 code so the Java examples will use lambdas and some external libraries like RxJava and AutoValue.
Scala presentation by Aleksandar ProkopecLoïc Descotte
This document provides an introduction to the Scala programming language. It discusses how Scala runs on the Java Virtual Machine, supports both object-oriented and functional programming paradigms, and provides features like pattern matching, immutable data structures, lazy evaluation, and parallel collections. Scala aims to be concise, expressive, and extensible.
This document provides an overview of schema design and data modeling for both relational and non-relational databases. It discusses the history of data modeling including hierarchical and relational models. The goals of data modeling are to avoid anomalies, minimize redesign, and make the model informative for users. Common data modeling patterns like one-to-many, many-to-many, and tree structures are explained. Specific examples are given for modeling comments, products, and categories in a non-relational database.
Async code on kotlin: rx java or/and coroutines - Kotlin Night TurinFabio Collini
It’s never easy to write async code but luckily there are many libraries to manage asynchronicity without adding too much complexity. In the last years RxJava and the other ReactiveX libraries have been very popular but lately there is a new way to manage async code in Kotlin: the coroutines. In this talk we’ll pros and cons of there two approaches and how to leverage them to simplify asynchronous code on Android.
Do they solve the same problem? Can we use them together? Which one can be used to write functional code? How can we use them effectively in Android development?
Spoiler alert: They are both great!
In this talk we’ll see how to solve common problems using RxJava or Coroutines, starting from basic concepts (for example the Retrofit support and how to cancel a task) to some more advanced (like threading, error management and how to combine multiple tasks).
All example of the talk are available on this repository:
https://github.com/fabioCollini/RxJavaVsCoroutines
From Java to Kotlin beyond alt+shift+cmd+k - Kotlin Community Conf MilanFabio Collini
Kotlin is a first-class language for Android development since Google I/O 2017. And it’s here to stay!
Thanks to Android Studio it’s really easy to introduce Kotlin in an existing project, the configuration is trivial and then we can convert Java classes to Kotlin using a Alt+Shift+Cmd+K. But the new syntax is the just beginning, using Kotlin we can improve our code making it more readable and simpler to write.
In this talk we’ll see how to use some Kotlin features (for example data classes, collections, coroutines and delegates) to simplify Android development comparing the code with the equivalent “modern” Java code. It’s not fair to compare Kotlin code with plain Java 6 code so the Java examples will use lambdas and some external libraries like RxJava and AutoValue.
Phactory is an alternative to database fixtures for defining test data in PHP unit tests. It allows developers to define database objects in code and dynamically create them, rather than loading static datasets. Phactory provides a lightweight ORM and works with MySQL, SQLite, and MongoDB. It supports defining object blueprints, creating objects with associations, retrieving objects, and integrating with PHPUnit for testing database code.
This document provides a quick reference guide for EJBQL 3.0, including:
1) How to write queries using parameters, perform updates and deletes, use subqueries, ordering, and aggregates.
2) Details on query structure, available where clause methods, and using SQL queries.
3) How to map query results to custom result classes and aliases.
jQuery is a JavaScript library that makes it easier to write JavaScript code that runs on different browsers. It allows selecting DOM elements, traversing through them and manipulating them. jQuery simplifies tasks like handling events, animating elements, and making AJAX calls. Some key features include selecting elements by tag name, ID, or CSS class; traversing DOM elements; binding event handlers; animating elements with effects like show, hide, fade; and making asynchronous HTTP requests via AJAX.
Room is an Android framework that provides an abstraction layer over SQLite to allow for more robust database access while harnessing the full power of SQLite. It provides entities, data access objects (DAOs), and a database class to simplify data persistence. Key aspects include using annotations to define entities and SQL operations, verifying SQL at compile time, supporting relationships between entities and migrations. Room also integrates with LiveData and RxJava for observable data streams.
The document summarizes the key concepts of Java Persistence API (JPA) and EntityManager for managing object-relational mapping and persistence of data. It discusses how JPA simplifies data access using plain old Java objects (POJOs), standardizes annotations and configuration, and supports pluggable persistence providers. Entities, relationships, inheritance mapping strategies, identity, and the entity lifecycle involving the entity manager are described at a high level.
Dapper is an object mapper for ADO.NET that aims to simplify data access and mapping between .NET objects and SQL databases. It provides extension methods for querying and mapping database results to .NET objects with minimal code. Micro ORMs like Dapper, Massive, PetaPoco, and SimpleData aim to simplify data access without requiring complex infrastructure or configuration. They emphasize performance, simplicity and working directly with SQL and database objects.
The document discusses Wicket testing and models. It provides an overview of different types of Wicket test classes for components, pages, and forms. It also discusses different model types in Wicket like PropertyModel, LoadableDetachableModel, and how models allow for dynamic updates and serialization. The document then presents examples of using a UserLoadableDetachableModel and FormTester. It also discusses making components more abstract and removing assumptions when designing them. Finally, it introduces the concept of a "CSS component" for creating consistent UI elements through CSS alone.
Mastering Java Bytecode With ASM - 33rd degree, 2012Anton Arhipov
The document discusses bytecode and the ASM library for manipulating Java bytecode. It provides an overview of bytecode structure and instructions. ASM is introduced as a low-level API for working with bytecode using visitors and nodes. Examples are given for generating bytecode using ASM, such as creating a ClassWriter, visiting classes, fields and methods, and generating instructions.
Na maioria das vezes, ao criar uma nova API, opta-se pelo Rest. Mas será que não tem outras opções?
Essa palestra aponta outras opções para o Rest como GraphQl, Falcor, gRPC, ou até mesmo criar o seu padrão
The document discusses implementing an Entity-Attribute-Value (EAV) pattern for ActiveRecord models. It describes saving entity types as strings in an entity table, keeping attributes directly in the model, and using a polymorphic association between the entity and value. The implementation creates tables for each attribute type (string, integer, float, boolean), generates attribute models, and adds getter/setter methods to the entity model to access attribute values. It also discusses more advanced functionality like querying, ordering, and selecting specific attributes.
The document discusses jQuery and its uses and methods. It introduces jQuery as a way to write JavaScript code that works across browsers. It provides examples of how jQuery can be used to select and manipulate HTML elements using simpler syntax compared to vanilla JavaScript. Key jQuery methods are also summarized, including how to select elements, modify attributes, handle events, add/move elements, and perform animations and AJAX requests.
EclipseCon2011 Cross-Platform Mobile Development with EclipseHeiko Behrens
This document discusses cross-platform mobile development using Eclipse. It highlights that mobile devices now have more computing power than NASA did in 1969. It also covers developing for the diversity of mobile platforms like Java, C#, and Objective-C. The document discusses object-oriented principles like statelessness and the app anatomy of views, cells, navigation, and entities/content providers. It also introduces a DSL for defining mobile apps and demos cross-platform mobile development.
Paintfree Object-Document Mapping for MongoDB by Philipp KrennJavaDayUA
This document summarizes a talk on using Morphia, an object-document mapping library for MongoDB. Morphia allows mapping Java objects to MongoDB documents using annotations, providing an object-relational mapping-style interface for MongoDB. The talk covers Morphia features like collections, indexes, queries, and patterns for normalization and inheritance. While Morphia simplifies development, the speaker notes it does not provide transactions or joins like traditional ORMs.
TDC218SP | Trilha Kotlin - DSLs in a Kotlin Waytdc-globalcode
This document discusses Domain Specific Languages (DSLs) in Kotlin and provides examples of building DSLs using Kotlin features like extension functions, operators, and receivers. It covers topics like infix notation, operator overloading, building query DSLs, mocking HTTP responses, and more. The document concludes that DSLs can improve existing domains and encourage designing your own DSLs for fun and learning.
Improving Correctness with Types Kats ConfIain Hull
A talk I gave at Functional Kats in September 2015
http://workday.github.io/scala/2015/03/17/scala-days-improving-correctness-with-types/
This talk is aimed at Scala developers with a background in object oriented programming who want to learn new ways to use types to improve the correctness of their code. It introduces the topic in a practical fashion, concentrating on the “easy wins” developers can apply to their code today.
http://functionalkats.com/#nav-speakers
Getting the most out of Java [Nordic Coding-2010]Sven Efftinge
In this talk we explain how we use the more recent concepts of the Java programming language in order to improve readability and maintainability of our code.
1 MVC – Ajax and Modal Views AJAX stands for Asynch.docxhoney725342
1
MVC – Ajax and Modal Views
AJAX stands for Asynchronous JavaScript and XML. It is a client-side capability that allows
silent updates of parts of a web page. Every browser provides a component called
XmlHttpRequest that is invoked via Javascript and has the capability to make asynchronous calls
back to the web server from where the page was obtained. One can set up Javascript timers to
automate the periodic retrieval of data using the XmlHttpRequest object.
Even though we can program the XmlHttpRequest object directly using Javascript, JQuery
makes it a lot easier to set it up and issue an asynchronous request to the web server. ASP.Net
MVC also provides a server-side solution to AJAX via the Ajax.BeginForm extension method.
We will demonstrate the two approaches to AJAX i.e., via JQuery and serializable partial views,
and via the Ajax.BeginForm.
Using SQL Server Management Studo, create a database called ProductsDB. Add a table called
Categories with the folling data.
The CategoryId column is of type int, and the CategoryName column is of type carchar(50).
Add another table called Products with the following design.
Then put the following data in the Products table.
2
Using Visual Studio, create a new project. Choose the web type of project, and select the MVC
template as shown below.
Add the following connection string information to the web.config file. Replace ALPHA with
the name of your database server.
<configuration>
<connectionStrings>
<add name="PRODUCTSDB" connectionString="server=ALPHA;integrated
security=true;database=ProductsDB" />
</connectionStrings>
<appSettings>
Add a class to the Models folder called Category with the following code in it.
public class Category
{
public int CategoryId { get; set; }
public string CategoryName { get; set; }
}
3
Add a folder called DataLayer to the project. Then add an interface called IEntity to it with the
following code in it.
public interface IEntity
{ // any class that needs conversion to a List from a DataTable will implement this
void PopulateFields(DataRow dr);
}
Add a class called MyEntityBase to the Models folder with the following code in it. This class
uses reflection to populate the fields of a class from a given DataRow of a DataTable. All
repository methods that need to convert a DataTable to a list will indirectly use this method via
the generic DBList class..
public class MyEntityBase : IEntity
{
public void PopulateFields(DataRow dr)
{
// use reflection to populate the fields of this class from DataRow
Type tp = this.GetType();
foreach (PropertyInfo pi in tp.GetProperties())
pi.SetValue(this, dr[pi.Name]);
}
}
Add a class called DBList to the DataLayer folder with the following code in it.
class DBList
{
...
자프링(자바 + 스프링) 외길 12년차 서버 개발자가 코프링(코틀린 + 스프링)을 만난 후 코틀린의 특징과 스프링의 코틀린 지원을 알아가며 코프링 월드에서 살아남은 이야기…
코드 저장소: https://github.com/arawn/kotlin-support-in-spring
Talk on how to think when building Android apps using a reactive Clean Architecture. This talk was held at the Stockholm Android Meetup group April 17 2018 at Developers bay.
Getting started with Elasticsearch and .NETTomas Jansson
This document provides an introduction to using Elasticsearch with .NET and the NEST client library. It demonstrates how to install and configure Elasticsearch on Windows, define mappings and index documents using NEST, perform various queries including fuzzy, highlighted, faceted queries, and add filters. NEST provides a strongly typed, fluent abstraction over Elasticsearch that allows querying and filtering Elasticsearch in a similar manner to Elasticsearch JSON queries. The document encourages attendees to view the demo code on GitHub for examples of indexing, querying, highlighting, faceting, and filtering documents using NEST.
The document provides information about jQuery:
1) jQuery is an open-source JavaScript library developed by John Resig in 2006 that simplifies HTML document traversal and manipulation, events, animations and Ajax interactions for rapid web development.
2) It is used by many large companies and websites and has two versions: compressed and uncompressed, under both MIT and GPL licenses.
3) The document outlines jQuery's main features including being lightweight, having a large plugin library, easy to learn and use, CSS3 support, documentation and examples. It then provides examples of how to implement jQuery.
Kotlin, a modern language for modern timesSergi Martínez
Kotlin is a programming language created by JetBrains that runs on the JVM and JavaScript. It is a modern language that aims to interoperate well with Java code and improve on Java in several ways, such as by avoiding null references and supporting features like lambdas. The document provides examples of how Kotlin code compares to Java code for tasks like defining functions and classes, handling null values, using streams and lambdas. It also includes a code sample that transforms a list of keyword strings.
Realm or: How I learned to stop worrying and love my app databaseSergi Martínez
This document provides an overview of using Realm as a mobile database solution instead of SQLite. Some key points:
- Realm stores objects rather than rows/tables and has no boilerplate code for common SQLite tasks like SQL queries.
- Objects are defined by creating RealmObject subclasses with getter/setter properties. These objects can then be stored, queried, and related to each other in the Realm database.
- Relationships between objects can be defined to support one-to-many and many-to-many relationships. Objects are queried using a fluent query language rather than raw SQL.
- Realm uses transactions to ensure data integrity. Objects are added/updated by beginning a transaction, making changes
Data binding is a process that establishes a connection between an application's UI and its business logic so that when data changes, it is reflected in the UI and vice versa. Android introduced data binding in 2015 to minimize glue code between layouts and logic. The key steps to using data binding are: 1) adding the data binding library, 2) applying binding to layouts, 3) creating data binding objects, and 4) doing the binding in activities/fragments. Data binding supports observable objects to automatically update views when data changes. It allows binding layout properties like visibility and text fields.
Fragments allow modular and reusable components in an Android application. They are portions of UI for an activity that have their own lifecycle and can be added or removed during runtime. The key aspects are:
- Fragments were introduced in Android 3.0 but can be used in older versions with the compatibility library.
- Their lifecycle is directly tied to the host activity - pausing/destroying the activity also pauses/destroys fragments.
- They are defined as subclasses of Fragment and implement lifecycle methods like onCreateView to define the UI.
- Fragments can be added to activities declaratively in XML layouts or programmatically using transactions.
Este documento presenta una introducción al desarrollo de aplicaciones para Android. Cubre temas como la instalación del entorno de desarrollo, la creación de un proyecto "Hola Mundo", el ciclo de vida de las actividades, el uso de recursos, la interacción con el usuario, menús, preferencias e intents. El objetivo final es proporcionar una guía básica pero completa para que los desarrolladores puedan crear sus primeras aplicaciones en la plataforma Android.
The document discusses creating multilingual Android applications. It defines key concepts like globalization, internationalization and localization. It then provides guidance on identifying localizable items, separating them from code, performing development, translating content, and integrating different languages into the app. The document recommends using resource folders to organize localized assets and strings. It also offers tips for ensuring high quality localization, including being politically correct and evaluating translation needs.
Este documento presenta Mobclix, un SDK de publicidad móvil para desarrolladores de aplicaciones Android e iOS. Explica cómo crear una cuenta de desarrollador, integrar el SDK en una aplicación, configurar anunciantes y banners, e instalar el SDK. También identifica algunos inconvenientes iniciales como errores en Android y falta de funcionalidades, aunque reconoce que Mobclix escucha comentarios para mejorar.
El documento resume la experiencia de Sergi Martínez con Admob y el desarrollo de aplicaciones móviles. Martínez no se dedica al desarrollo como profesión y ha creado 9 aplicaciones, 4 de ellas clones, con las que ha obtenido ingresos modestos. El documento analiza la evolución de los ingresos por día, semana y país, así como el efecto de las actualizaciones en los ingresos. Finalmente, Martínez ofrece su contacto para responder preguntas.
Ivanti’s Patch Tuesday breakdown goes beyond patching your applications and brings you the intelligence and guidance needed to prioritize where to focus your attention first. Catch early analysis on our Ivanti blog, then join industry expert Chris Goettl for the Patch Tuesday Webinar Event. There we’ll do a deep dive into each of the bulletins and give guidance on the risks associated with the newly-identified vulnerabilities.
For the full video of this presentation, please visit: https://www.edge-ai-vision.com/2024/06/temporal-event-neural-networks-a-more-efficient-alternative-to-the-transformer-a-presentation-from-brainchip/
Chris Jones, Director of Product Management at BrainChip , presents the “Temporal Event Neural Networks: A More Efficient Alternative to the Transformer” tutorial at the May 2024 Embedded Vision Summit.
The expansion of AI services necessitates enhanced computational capabilities on edge devices. Temporal Event Neural Networks (TENNs), developed by BrainChip, represent a novel and highly efficient state-space network. TENNs demonstrate exceptional proficiency in handling multi-dimensional streaming data, facilitating advancements in object detection, action recognition, speech enhancement and language model/sequence generation. Through the utilization of polynomial-based continuous convolutions, TENNs streamline models, expedite training processes and significantly diminish memory requirements, achieving notable reductions of up to 50x in parameters and 5,000x in energy consumption compared to prevailing methodologies like transformers.
Integration with BrainChip’s Akida neuromorphic hardware IP further enhances TENNs’ capabilities, enabling the realization of highly capable, portable and passively cooled edge devices. This presentation delves into the technical innovations underlying TENNs, presents real-world benchmarks, and elucidates how this cutting-edge approach is positioned to revolutionize edge AI across diverse applications.
Discover top-tier mobile app development services, offering innovative solutions for iOS and Android. Enhance your business with custom, user-friendly mobile applications.
Digital Banking in the Cloud: How Citizens Bank Unlocked Their MainframePrecisely
Inconsistent user experience and siloed data, high costs, and changing customer expectations – Citizens Bank was experiencing these challenges while it was attempting to deliver a superior digital banking experience for its clients. Its core banking applications run on the mainframe and Citizens was using legacy utilities to get the critical mainframe data to feed customer-facing channels, like call centers, web, and mobile. Ultimately, this led to higher operating costs (MIPS), delayed response times, and longer time to market.
Ever-changing customer expectations demand more modern digital experiences, and the bank needed to find a solution that could provide real-time data to its customer channels with low latency and operating costs. Join this session to learn how Citizens is leveraging Precisely to replicate mainframe data to its customer channels and deliver on their “modern digital bank” experiences.
HCL Notes and Domino License Cost Reduction in the World of DLAUpanagenda
Webinar Recording: https://www.panagenda.com/webinars/hcl-notes-and-domino-license-cost-reduction-in-the-world-of-dlau/
The introduction of DLAU and the CCB & CCX licensing model caused quite a stir in the HCL community. As a Notes and Domino customer, you may have faced challenges with unexpected user counts and license costs. You probably have questions on how this new licensing approach works and how to benefit from it. Most importantly, you likely have budget constraints and want to save money where possible. Don’t worry, we can help with all of this!
We’ll show you how to fix common misconfigurations that cause higher-than-expected user counts, and how to identify accounts which you can deactivate to save money. There are also frequent patterns that can cause unnecessary cost, like using a person document instead of a mail-in for shared mailboxes. We’ll provide examples and solutions for those as well. And naturally we’ll explain the new licensing model.
Join HCL Ambassador Marc Thomas in this webinar with a special guest appearance from Franz Walder. It will give you the tools and know-how to stay on top of what is going on with Domino licensing. You will be able lower your cost through an optimized configuration and keep it low going forward.
These topics will be covered
- Reducing license cost by finding and fixing misconfigurations and superfluous accounts
- How do CCB and CCX licenses really work?
- Understanding the DLAU tool and how to best utilize it
- Tips for common problem areas, like team mailboxes, functional/test users, etc
- Practical examples and best practices to implement right away
Fueling AI with Great Data with Airbyte WebinarZilliz
This talk will focus on how to collect data from a variety of sources, leveraging this data for RAG and other GenAI use cases, and finally charting your course to productionalization.
zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...Alex Pruden
Folding is a recent technique for building efficient recursive SNARKs. Several elegant folding protocols have been proposed, such as Nova, Supernova, Hypernova, Protostar, and others. However, all of them rely on an additively homomorphic commitment scheme based on discrete log, and are therefore not post-quantum secure. In this work we present LatticeFold, the first lattice-based folding protocol based on the Module SIS problem. This folding protocol naturally leads to an efficient recursive lattice-based SNARK and an efficient PCD scheme. LatticeFold supports folding low-degree relations, such as R1CS, as well as high-degree relations, such as CCS. The key challenge is to construct a secure folding protocol that works with the Ajtai commitment scheme. The difficulty, is ensuring that extracted witnesses are low norm through many rounds of folding. We present a novel technique using the sumcheck protocol to ensure that extracted witnesses are always low norm no matter how many rounds of folding are used. Our evaluation of the final proof system suggests that it is as performant as Hypernova, while providing post-quantum security.
Paper Link: https://eprint.iacr.org/2024/257
For the full video of this presentation, please visit: https://www.edge-ai-vision.com/2024/06/how-axelera-ai-uses-digital-compute-in-memory-to-deliver-fast-and-energy-efficient-computer-vision-a-presentation-from-axelera-ai/
Bram Verhoef, Head of Machine Learning at Axelera AI, presents the “How Axelera AI Uses Digital Compute-in-memory to Deliver Fast and Energy-efficient Computer Vision” tutorial at the May 2024 Embedded Vision Summit.
As artificial intelligence inference transitions from cloud environments to edge locations, computer vision applications achieve heightened responsiveness, reliability and privacy. This migration, however, introduces the challenge of operating within the stringent confines of resource constraints typical at the edge, including small form factors, low energy budgets and diminished memory and computational capacities. Axelera AI addresses these challenges through an innovative approach of performing digital computations within memory itself. This technique facilitates the realization of high-performance, energy-efficient and cost-effective computer vision capabilities at the thin and thick edge, extending the frontier of what is achievable with current technologies.
In this presentation, Verhoef unveils his company’s pioneering chip technology and demonstrates its capacity to deliver exceptional frames-per-second performance across a range of standard computer vision networks typical of applications in security, surveillance and the industrial sector. This shows that advanced computer vision can be accessible and efficient, even at the very edge of our technological ecosystem.
Introduction of Cybersecurity with OSS at Code Europe 2024Hiroshi SHIBATA
I develop the Ruby programming language, RubyGems, and Bundler, which are package managers for Ruby. Today, I will introduce how to enhance the security of your application using open-source software (OSS) examples from Ruby and RubyGems.
The first topic is CVE (Common Vulnerabilities and Exposures). I have published CVEs many times. But what exactly is a CVE? I'll provide a basic understanding of CVEs and explain how to detect and handle vulnerabilities in OSS.
Next, let's discuss package managers. Package managers play a critical role in the OSS ecosystem. I'll explain how to manage library dependencies in your application.
I'll share insights into how the Ruby and RubyGems core team works to keep our ecosystem safe. By the end of this talk, you'll have a better understanding of how to safeguard your code.
[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...Jason Yip
The typical problem in product engineering is not bad strategy, so much as “no strategy”. This leads to confusion, lack of motivation, and incoherent action. The next time you look for a strategy and find an empty space, instead of waiting for it to be filled, I will show you how to fill it in yourself. If you’re wrong, it forces a correction. If you’re right, it helps create focus. I’ll share how I’ve approached this in the past, both what works and lessons for what didn’t work so well.
Freshworks Rethinks NoSQL for Rapid Scaling & Cost-EfficiencyScyllaDB
Freshworks creates AI-boosted business software that helps employees work more efficiently and effectively. Managing data across multiple RDBMS and NoSQL databases was already a challenge at their current scale. To prepare for 10X growth, they knew it was time to rethink their database strategy. Learn how they architected a solution that would simplify scaling while keeping costs under control.
Dandelion Hashtable: beyond billion requests per second on a commodity serverAntonios Katsarakis
This slide deck presents DLHT, a concurrent in-memory hashtable. Despite efforts to optimize hashtables, that go as far as sacrificing core functionality, state-of-the-art designs still incur multiple memory accesses per request and block request processing in three cases. First, most hashtables block while waiting for data to be retrieved from memory. Second, open-addressing designs, which represent the current state-of-the-art, either cannot free index slots on deletes or must block all requests to do so. Third, index resizes block every request until all objects are copied to the new index. Defying folklore wisdom, DLHT forgoes open-addressing and adopts a fully-featured and memory-aware closed-addressing design based on bounded cache-line-chaining. This design offers lock-free index operations and deletes that free slots instantly, (2) completes most requests with a single memory access, (3) utilizes software prefetching to hide memory latencies, and (4) employs a novel non-blocking and parallel resizing. In a commodity server and a memory-resident workload, DLHT surpasses 1.6B requests per second and provides 3.5x (12x) the throughput of the state-of-the-art closed-addressing (open-addressing) resizable hashtable on Gets (Deletes).
13. Simple entity
@Entity(tableName = "products")
class ProductEntity(
@PrimaryKey() @ColumnInfo(name = "id") var id: Long,
@ColumnInfo(name = "name") var name: String,
@ColumnInfo(name = "description") var description: String,
@ColumnInfo(name = "qty") var quantity: Long
)
14. Simple entity
@Entity(tableName = "products")
class ProductEntity(
@PrimaryKey() @ColumnInfo(name = "id") var id: Long,
@ColumnInfo(name = "name") var name: String,
@ColumnInfo(name = "description") var description: String,
@ColumnInfo(name = "qty") var quantity: Long
)
15. Simple entity
@Entity(tableName = "products")
class ProductEntity(
@PrimaryKey() @ColumnInfo(name = "id") var id: Long,
@ColumnInfo(name = "name") var name: String,
@ColumnInfo(name = "description") var description: String,
@ColumnInfo(name = "qty") var quantity: Long
)
16. Simple entity
@Entity(tableName = "products")
class ProductEntity(
@PrimaryKey() @ColumnInfo(name = "id") var id: Long,
@ColumnInfo(name = "name") var name: String,
@ColumnInfo(name = "description") var description: String,
@ColumnInfo(name = "qty") var quantity: Long
)
17. Indexes
@Entity(tableName = "inventory",
indices = arrayOf(Index("provider_id", "product_id", unique = true)))
class InventoryEntity(
@PrimaryKey() var id: Long,
@ColumnInfo(name = "provider_id") var providerId: Long,
@ColumnInfo(name = "product_id") var productId: Long,
@ColumnInfo(name = "qty") var quantity: Long
)
18. Composed PK
@Entity(tableName = "inventory",
primaryKeys = arrayOf("provider_id", "product_id"))
class InventoryEntity(
@ColumnInfo(name = "provider_id") var providerId: Long,
@ColumnInfo(name = "product_id") var productId: Long,
@ColumnInfo(name = "qty") var quantity: Long
)
19. Foreign keys
@Entity(
tableName = "inventory",
foreignKeys = arrayOf(
ForeignKey(
entity = ProductEntity::class,
parentColumns = arrayOf("id"),
childColumns = arrayOf("product_id")
)
)
)
class InventoryEntity(
@PrimaryKey() var id: Long,
@ColumnInfo(name = "provider_id") var providerId: Long,
@ColumnInfo(name = "product_id") var productId: Long,
@ColumnInfo(name = "qty") var quantity: Long
)
20. Foreign keys
@Entity(
tableName = "inventory",
foreignKeys = arrayOf(
ForeignKey(
entity = ProductEntity::class,
parentColumns = arrayOf("id"),
childColumns = arrayOf("product_id")
)
)
)
class InventoryEntity(
@PrimaryKey() var id: Long,
@ColumnInfo(name = "provider_id") var providerId: Long,
@ColumnInfo(name = "product_id") var productId: Long,
@ColumnInfo(name = "qty") var quantity: Long
)
21. Foreign keys
@Entity(
tableName = "inventory",
foreignKeys = arrayOf(
ForeignKey(
entity = ProductEntity::class,
parentColumns = arrayOf("id"),
childColumns = arrayOf("product_id")
)
)
)
class InventoryEntity(
@PrimaryKey() var id: Long,
@ColumnInfo(name = "provider_id") var providerId: Long,
@ColumnInfo(name = "product_id") var productId: Long,
@ColumnInfo(name = "qty") var quantity: Long
)
22. Foreign keys
@Entity(
tableName = "inventory",
foreignKeys = arrayOf(
ForeignKey(
entity = ProductEntity::class,
parentColumns = arrayOf("id"),
childColumns = arrayOf("product_id")
)
)
)
class InventoryEntity(
@PrimaryKey() var id: Long,
@ColumnInfo(name = "provider_id") var providerId: Long,
@ColumnInfo(name = "product_id") var productId: Long,
@ColumnInfo(name = "qty") var quantity: Long
)
23. Foreign keys
@Entity(
tableName = "inventory",
foreignKeys = arrayOf(
ForeignKey(
entity = ProductEntity::class,
parentColumns = arrayOf("id"),
childColumns = arrayOf("product_id")
)
)
)
class InventoryEntity(
@PrimaryKey() var id: Long,
@ColumnInfo(name = "provider_id") var providerId: Long,
@ColumnInfo(name = "product_id") var productId: Long,
@ColumnInfo(name = "qty") var quantity: Long
)
24. Foreign keys
@Entity(
tableName = "inventory",
foreignKeys = arrayOf(
ForeignKey(
entity = ProductEntity::class,
parentColumns = arrayOf("id"),
childColumns = arrayOf("product_id")
)
)
)
class InventoryEntity(
@PrimaryKey() var id: Long,
@ColumnInfo(name = "provider_id") var providerId: Long,
@ColumnInfo(name = "product_id") var productId: Long,
@ColumnInfo(name = "qty") var quantity: Long
)
25. Nested objects
@Entity(tableName = "products")
class ProductEntity(
@PrimaryKey() @ColumnInfo(name = "id") var id: Long,
@ColumnInfo(name = "name") var name: String,
@ColumnInfo(name = "description") var description: String,
@Embedded var info: ProductInfo
)
class ProductInfo(
@ColumnInfo(name = "color") var color: String,
@ColumnInfo(name = "size") var size: String
)
products
id name description color size
26. Nested objects
@Entity(tableName = "products")
class ProductEntity(
@PrimaryKey() @ColumnInfo(name = "id") var id: Long,
@ColumnInfo(name = "name") var name: String,
@ColumnInfo(name = "description") var description: String,
@Embedded var info: ProductInfo
)
class ProductInfo(
@ColumnInfo(name = "color") var color: String,
@ColumnInfo(name = "size") var size: String
)
products
id name description color size
27. Nested objects
@Entity(tableName = "products")
class ProductEntity(
@PrimaryKey() @ColumnInfo(name = "id") var id: Long,
@ColumnInfo(name = "name") var name: String,
@ColumnInfo(name = "description") var description: String,
@Embedded var info: ProductInfo
)
class ProductInfo(
@ColumnInfo(name = "color") var color: String,
@ColumnInfo(name = "size") var size: String
)
products
id name description color size
28. Nested objects
@Entity(tableName = "products")
class ProductEntity(
@PrimaryKey() @ColumnInfo(name = "id") var id: Long,
@ColumnInfo(name = "name") var name: String,
@ColumnInfo(name = "description") var description: String,
@Embedded var info: ProductInfo
)
class ProductInfo(
@ColumnInfo(name = "color") var color: String,
@ColumnInfo(name = "size") var size: String
)
products
id name description color size
30. Simple DAO
@Dao
interface ProductsDao {
@Insert(onConflict = REPLACE)
fun insert(productEntity: ProductEntity): Long
@Query("Select * from products")
fun getAll(): List<ProductEntity>
@Update
fun update(productEntity: ProductEntity): Int
@Delete
fun delete(productEntity: ProductEntity): Int
}
31. Simple DAO
@Dao
interface ProductsDao {
@Insert(onConflict = REPLACE)
fun insert(productEntity: ProductEntity): Long
@Query("Select * from products")
fun getAll(): List<ProductEntity>
@Update
fun update(productEntity: ProductEntity): Int
@Delete
fun delete(productEntity: ProductEntity): Int
}
32. Simple DAO
@Dao
interface ProductsDao {
@Insert(onConflict = REPLACE)
fun insert(productEntity: ProductEntity): Long
@Query("Select * from products")
fun getAll(): List<ProductEntity>
@Update
fun update(productEntity: ProductEntity): Int
@Delete
fun delete(productEntity: ProductEntity): Int
}
Row id
33. Simple DAO
@Dao
interface ProductsDao {
@Insert(onConflict = REPLACE)
fun insert(productEntity: ProductEntity): Long
@Query("Select * from products")
fun getAll(): List<ProductEntity>
@Update
fun update(productEntity: ProductEntity): Int
@Delete
fun delete(productEntity: ProductEntity): Int
}
34. Simple DAO
@Dao
interface ProductsDao {
@Insert(onConflict = REPLACE)
fun insert(productEntity: ProductEntity): Long
@Query("Select * from products")
fun getAll(): List<ProductEntity>
@Update
fun update(productEntity: ProductEntity): Int
@Delete
fun delete(productEntity: ProductEntity): Int
}
# Modified rows
35. Simple DAO
@Dao
interface ProductsDao {
@Insert(onConflict = REPLACE)
fun insert(productEntity: ProductEntity): Long
@Query("Select * from products")
fun getAll(): List<ProductEntity>
@Update
fun update(productEntity: ProductEntity): Int
@Delete
fun delete(productEntity: ProductEntity): Int
}
36. Insert
@Dao
interface ProductsDao {
@Insert(onConflict = REPLACE)
fun insert(product: ProductEntity): Long
@Insert(onConflict = REPLACE)
fun insertAll(vararg products: ProductEntity) : List<Long>
@Insert(onConflict = ROLLBACK)
fun insertTwo(product: ProductEntity, otherProduct: ProductEntity): List<Long>
@Insert(onConflict = ABORT)
fun weirdInsert(product: ProductEntity, products: List<ProductEntity>): List<Long>
}
39. Query
@Dao
interface ProductsDao {
@Query("Select * from products")
fun getAllAsList(): List<ProductEntity>
@Query("SELECT * FROM products")
fun getAllAsArray(): Array<ProductEntity>
@Query("SELECT * FROM products WHERE name = :name")
fun getProductsWithName(name: String): List<ProductEntity>
@Query("SELECT * FROM products WHERE name like :name OR description like :name")
fun searchProduct(term: String): List<ProductEntity>
@Query("SELECT * FROM products WHERE name in (:names)")
fun getProductsByName(names: List<String>): List<ProductEntity>
@Query("SELECT * FROM products WHERE qty >= :minQty AND qty <= :maxQty")
fun getProductsWithinInventory(minQty: Int, maxQty: Int): List<ProductEntity>
}
40. Query
@Dao
interface ProductsDao {
@Query("Select * from products")
fun getAllAsList(): List<ProductEntity>
@Query("SELECT * FROM products")
fun getAllAsArray(): Array<ProductEntity>
@Query("SELECT * FROM products WHERE name = :name")
fun getProductsWithName(name: String): List<ProductEntity>
@Query("SELECT * FROM products WHERE name like :name OR description like :name")
fun searchProduct(term: String): List<ProductEntity>
@Query("SELECT * FROM products WHERE name in (:names)")
fun getProductsByName(names: List<String>): List<ProductEntity>
@Query("SELECT * FROM products WHERE qty >= :minQty AND qty <= :maxQty")
fun getProductsWithinInventory(minQty: Int, maxQty: Int): List<ProductEntity>
}
41. Query
@Dao
interface ProductsDao {
@Query("Select * from products")
fun getAllAsList(): List<ProductEntity>
@Query("SELECT * FROM products")
fun getAllAsArray(): Array<ProductEntity>
@Query("SELECT * FROM products WHERE name = :name")
fun getProductsWithName(name: String): List<ProductEntity>
@Query("SELECT * FROM products WHERE name like :name OR description like :name")
fun searchProduct(term: String): List<ProductEntity>
@Query("SELECT * FROM products WHERE name in (:names)")
fun getProductsByName(names: List<String>): List<ProductEntity>
@Query("SELECT * FROM products WHERE qty >= :minQty AND qty <= :maxQty")
fun getProductsWithinInventory(minQty: Int, maxQty: Int): List<ProductEntity>
}
42. Query
@Dao
interface ProductsDao {
@Query("Select * from products")
fun getAllAsList(): List<ProductEntity>
@Query("SELECT * FROM products")
fun getAllAsArray(): Array<ProductEntity>
@Query("SELECT * FROM products WHERE name = :name")
fun getProductsWithName(name: String): List<ProductEntity>
@Query("SELECT * FROM products WHERE name like :name OR description like :name")
fun searchProduct(term: String): List<ProductEntity>
@Query("SELECT * FROM products WHERE name in (:names)")
fun getProductsByName(names: List<String>): List<ProductEntity>
@Query("SELECT * FROM products WHERE qty >= :minQty AND qty <= :maxQty")
fun getProductsWithinInventory(minQty: Int, maxQty: Int): List<ProductEntity>
}
43. Query
@Dao
interface ProductsDao {
@Query("Select * from products")
fun getAllAsList(): List<ProductEntity>
@Query("SELECT * FROM products")
fun getAllAsArray(): Array<ProductEntity>
@Query("SELECT * FROM products WHERE name = :name")
fun getProductsWithName(name: String): List<ProductEntity>
@Query("SELECT * FROM products WHERE name like :name OR description like :name")
fun searchProduct(term: String): List<ProductEntity>
@Query("SELECT * FROM products WHERE name in (:names)")
fun getProductsByName(names: List<String>): List<ProductEntity>
@Query("SELECT * FROM products WHERE qty >= :minQty AND qty <= :maxQty")
fun getProductsWithinInventory(minQty: Int, maxQty: Int): List<ProductEntity>
}
44. Query
@Dao
interface ProductsDao {
@Query("Select * from products")
fun getAllAsList(): List<ProductEntity>
@Query("SELECT * FROM products")
fun getAllAsArray(): Array<ProductEntity>
@Query("SELECT * FROM products WHERE name = :name")
fun getProductsWithName(name: String): List<ProductEntity>
@Query("SELECT * FROM products WHERE name like :name OR description like :name")
fun searchProduct(term: String): List<ProductEntity>
@Query("SELECT * FROM products WHERE name in (:names)")
fun getProductsByName(names: List<String>): List<ProductEntity>
@Query("SELECT * FROM products WHERE qty >= :minQty AND qty <= :maxQty")
fun getProductsWithinInventory(minQty: Int, maxQty: Int): List<ProductEntity>
}
45. Query
@Dao
interface ProductsDao {
@Query("Select * from products")
fun getAllAsList(): List<ProductEntity>
@Query("SELECT * FROM products")
fun getAllAsArray(): Array<ProductEntity>
@Query("SELECT * FROM products WHERE name = :name")
fun getProductsWithName(name: String): List<ProductEntity>
@Query("SELECT * FROM products WHERE name like :name OR description like :name")
fun searchProduct(term: String): List<ProductEntity>
@Query("SELECT * FROM products WHERE name in (:names)")
fun getProductsByName(names: List<String>): List<ProductEntity>
@Query("SELECT * FROM products WHERE qty >= :minQty AND qty <= :maxQty")
fun getProductsWithinInventory(minQty: Int, maxQty: Int): List<ProductEntity>
}
46. Query
@Dao
interface ProductsDao {
@Query("SELECT * FROM products WHERE id = :id")
fun getProducts(id: Long): ProductEntity
@Query("SELECT COUNT(*) FROM products")
fun getProductsCount(): Int
@Query("SELECT COUNT(*) AS count, name FROM products GROUP BY name")
fun getProductsCountByName(): List<ProductCountEntity>
}
class ProductCountEntity(
@ColumnInfo(name = "name") var name: String,
@ColumnInfo(name = "count") var count: Int
)
47. Query
@Dao
interface ProductsDao {
@Query("SELECT * FROM products WHERE id = :id")
fun getProducts(id: Long): ProductEntity
@Query("SELECT COUNT(*) FROM products")
fun getProductsCount(): Int
@Query("SELECT COUNT(*) AS count, name FROM products GROUP BY name")
fun getProductsCountByName(): List<ProductCountEntity>
}
class ProductCountEntity(
@ColumnInfo(name = "name") var name: String,
@ColumnInfo(name = "count") var count: Int
)
48. Query
@Dao
interface ProductsDao {
@Query("SELECT * FROM products WHERE id = :id")
fun getProducts(id: Long): ProductEntity
@Query("SELECT COUNT(*) FROM products")
fun getProductsCount(): Int
@Query("SELECT COUNT(*) AS count, name FROM products GROUP BY name")
fun getProductsCountByName(): List<ProductCountEntity>
}
class ProductCountEntity(
@ColumnInfo(name = "name") var name: String,
@ColumnInfo(name = "count") var count: Int
)
49. Query
@Dao
interface ProductsDao {
@Query("SELECT * FROM products WHERE id = :id")
fun getProducts(id: Long): ProductEntity
@Query("SELECT COUNT(*) FROM products")
fun getProductsCount(): Int
@Query("SELECT COUNT(*) AS count, name FROM products GROUP BY name")
fun getProductsCountByName(): List<ProductCountEntity>
}
class ProductCountEntity(
@ColumnInfo(name = "name") var name: String,
@ColumnInfo(name = "count") var count: Int
)
65. Type converters
@Dao
interface InventoryDao {
@Query("Select * from inventory where date = :date")
@TypeConverters(DateTimeConverter::class)
fun getByDate(date: LocalDateTime)
@Query("Select * from inventory where date = :date")
fun getByDate2(date: LocalDateTime)
}
66. Type converters
@Dao
interface InventoryDao {
@Query("Select * from inventory where date = :date")
fun getByDate(date: LocalDateTime)
@Query("Select * from inventory where date = :date")
fun getByDate2(@TypeConverters(DateTimeConverter::class) date: LocalDateTime)
}
67. Type converters
@Entity(tableName = "products")
class ProductEntity(
@PrimaryKey() @ColumnInfo(name = "id") var id: Long,
@ColumnInfo(name = "name") var name: String,
@ColumnInfo(name = "description") var description: String,
@ColumnInfo(name = "qty") var quantity: Long,
@ColumnInfo(name = "purchase_date") var purchaseDate: LocalDateTime
)
68. Type converters
@Entity(tableName = "products")
@TypeConverters(DateTimeConverter::class)
class ProductEntity(
@PrimaryKey() @ColumnInfo(name = "id") var id: Long,
@ColumnInfo(name = "name") var name: String,
@ColumnInfo(name = "description") var description: String,
@ColumnInfo(name = "qty") var quantity: Long,
@ColumnInfo(name = "purchase_date") var purchaseDate: LocalDateTime
)
69. Type converters
@Entity(tableName = "products")
class ProductEntity(
@PrimaryKey() @ColumnInfo(name = "id") var id: Long,
@ColumnInfo(name = "name") var name: String,
@ColumnInfo(name = "description") var description: String,
@ColumnInfo(name = "qty") var quantity: Long,
@TypeConverters(DateTimeConverter::class)
@ColumnInfo(name = "purchase_date") var purchaseDate: LocalDateTime
)
70. Migrations
val migrationFrom1To2 = object : Migration(1, 2) {
override fun migrate(database: SupportSQLiteDatabase) {
database.execSQL("ALTER TABLE products ADD COLUMN prices INTEGER")
}
}
val migrationFrom2To3 = object : Migration(2, 3) {
override fun migrate(database: SupportSQLiteDatabase) {
database.execSQL("ALTER TABLE products ADD COLUMN color TEXT")
}
}
val database: MyDatabase = Room
.databaseBuilder(applicationContext, MyDatabase::class.java, "database")
.addMigrations(migrationFrom1To2, migrationFrom2To3)
.build()
71. Migrations
val migrationFrom1To2 = object : Migration(1, 2) {
override fun migrate(database: SupportSQLiteDatabase) {
database.execSQL("ALTER TABLE products ADD COLUMN prices INTEGER")
}
}
val migrationFrom2To3 = object : Migration(2, 3) {
override fun migrate(database: SupportSQLiteDatabase) {
database.execSQL("ALTER TABLE products ADD COLUMN color TEXT")
}
}
val database: MyDatabase = Room
.databaseBuilder(applicationContext, MyDatabase::class.java, "database")
.addMigrations(migrationFrom1To2, migrationFrom2To3)
.build()
72. Migrations
val migrationFrom1To2 = object : Migration(1, 2) {
override fun migrate(database: SupportSQLiteDatabase) {
database.execSQL("ALTER TABLE products ADD COLUMN prices INTEGER")
}
}
val migrationFrom2To3 = object : Migration(2, 3) {
override fun migrate(database: SupportSQLiteDatabase) {
database.execSQL("ALTER TABLE products ADD COLUMN color TEXT")
}
}
val database: MyDatabase = Room
.databaseBuilder(applicationContext, MyDatabase::class.java, "database")
.addMigrations(migrationFrom1To2, migrationFrom2To3)
.build()
73. Migrations
val migrationFrom1To2 = object : Migration(1, 2) {
override fun migrate(database: SupportSQLiteDatabase) {
database.execSQL("ALTER TABLE products ADD COLUMN prices INTEGER")
}
}
val migrationFrom2To3 = object : Migration(2, 3) {
override fun migrate(database: SupportSQLiteDatabase) {
database.execSQL("ALTER TABLE products ADD COLUMN color TEXT")
}
}
val database: MyDatabase = Room
.databaseBuilder(applicationContext, MyDatabase::class.java, "database")
.addMigrations(migrationFrom1To2, migrationFrom2To3)
.build()
78. RxJava 2
@Query("Select * from products")
fun getAllAsList(): Flowable<List<ProductEntity>>
@Query("SELECT * FROM products WHERE id = :id")
fun getProductById(id: Long): Single<ProductEntity>
@Query("SELECT * FROM products WHERE name = :name")
fun getProductByName(name: String): Maybe<ProductEntity>
79. RxJava 2
Flowable Maybe Single
No data - Just onComplete onError
Data onNext onSuccess onSuccess
Update onNext - -