The document introduces Android Architecture Components and Room, which is a persistence library for Android. It provides an overview of Room concepts like entities, data access objects (DAOs), and databases. It also covers more advanced Room features such as relationships between entities, custom types, and database migrations.
As the developers we constantly ask ourselves a question - what architecture should we follow? MVP, MVVM, MVC - those are only a few which we know. Fortunately, our problems come to an end! Recently Google published a set of libraries called Architecture Components. During the presentation, we’ll find out how to use a database library Room, how to get control over activity lifecycle and how to be up to date with LiveData.
Jaoo - Open Social A Standard For The Social WebPatrick Chanezon
see http://jaoo.dk/presentation/OpenSocial%2C+a+Standard+for+the+Social+Web
OpenSocial is a standard for the social web managed by the OpenSocial foundation. Introduced by 18 social sites in november 2007, after 8 months OpenSocial is available to 275 million users, 2000 applications have been developed and 10 million users are using them daily.
The session will start with a status of OpenSocial after a year: the ecosystem that formed around the API: social sites, developers, advertisers, tool vendors, IT consulting firms, enterprise software vendors.
For developers of social application, the OpenSocial API JavaScript and REST APIs will be described, with demos of how to build a social application using each API.
For developers of social sites, or sites that want to become OpenSocial containers, the OpenSocial reference implementation is developed as an open source project, Apache Shindig, with a Java and PHP flavors. The stated goal of Shindig is to enable a social site developer to implement OpenSocial support on her site in 2 weeks. The Shindig Java architecture will be explained, followed by a demo of how to connect Shindig to a MySql backend.
Various related projects will also be demoed:
- Friend Connect, a Google offering enabling web sites to add social capabilities with a few lines of javascript.
- Socialsite, a Sun open source project based on Shindig, enabling web sites to become social sites with their own community, using gadgets to provide a user interface to manage the network.
- OpenSocket, a hosted service that allows OpenSocial applications to be deployed on Facebook.
As the developers we constantly ask ourselves a question - what architecture should we follow? MVP, MVVM, MVC - those are only a few which we know. Fortunately, our problems come to an end! Recently Google published a set of libraries called Architecture Components. During the presentation, we’ll find out how to use a database library Room, how to get control over activity lifecycle and how to be up to date with LiveData.
Jaoo - Open Social A Standard For The Social WebPatrick Chanezon
see http://jaoo.dk/presentation/OpenSocial%2C+a+Standard+for+the+Social+Web
OpenSocial is a standard for the social web managed by the OpenSocial foundation. Introduced by 18 social sites in november 2007, after 8 months OpenSocial is available to 275 million users, 2000 applications have been developed and 10 million users are using them daily.
The session will start with a status of OpenSocial after a year: the ecosystem that formed around the API: social sites, developers, advertisers, tool vendors, IT consulting firms, enterprise software vendors.
For developers of social application, the OpenSocial API JavaScript and REST APIs will be described, with demos of how to build a social application using each API.
For developers of social sites, or sites that want to become OpenSocial containers, the OpenSocial reference implementation is developed as an open source project, Apache Shindig, with a Java and PHP flavors. The stated goal of Shindig is to enable a social site developer to implement OpenSocial support on her site in 2 weeks. The Shindig Java architecture will be explained, followed by a demo of how to connect Shindig to a MySql backend.
Various related projects will also be demoed:
- Friend Connect, a Google offering enabling web sites to add social capabilities with a few lines of javascript.
- Socialsite, a Sun open source project based on Shindig, enabling web sites to become social sites with their own community, using gadgets to provide a user interface to manage the network.
- OpenSocket, a hosted service that allows OpenSocial applications to be deployed on Facebook.
자프링(자바 + 스프링) 외길 12년차 서버 개발자가 코프링(코틀린 + 스프링)을 만난 후 코틀린의 특징과 스프링의 코틀린 지원을 알아가며 코프링 월드에서 살아남은 이야기…
코드 저장소: https://github.com/arawn/kotlin-support-in-spring
The magic of jQuery's CSS-based selection makes it easy to think about our code in terms of the DOM, and sometimes that approach is exactly right. Other times, though, what we're trying to accomplish is only tangentially related to our nodes, and opting for an approach where we think in terms of functionality -- not how that functionality is manifested on our page -- can pay big dividends in terms of flexibility. In this talk, we'll look at a small sample application where the DOM takes a back seat to functionality-focused modules, and see how the approach can change the way we write and organize our code.
Pro bun-fighting - Working with JavaScript projectsFrances Berriman
This is the talk I gave at March's London Web Standards meet-up in London. It covers how we create Glow and make it a quality library. The talk has notes available for each slide and a video will be published soon.
Moje slajdy z prezentacji na GraphQL Wroclaw #3 https://www.meetup.com/GraphQL-Wroclaw/events/261828347/
Większość prezentacji dotyczących GraphQL opowiada o JavaSkryptowych narzędziach, natomiast mało kto mówi o tym jak korzystać z GraphQL w Javie. Prezentacja będzie o tym, jak sprawić aby nasz backendowy, Javowy serwer korzystał z GraphQL. Będzie o możliwych podejściach w implementacji, dobrych praktykach i 4-letnim doświadczeniu z GraphQL na produkcji.
※다운로드하시면 더 선명한 자료를 보실 수 있습니다.
서버 사이드에서도 Spring 5를 통해 공식적으로 지원이 시작된 후,
Spring을 이용한 많은 서비스가 Java를 대신하여 Kotlin을 적용하고 있습니다.
본 세션에서는 PAYCO 매거진 프로젝트에 Kotlin을 적용했던 경험과 시행착오를 나누어 보려 합니다.
목차
1. Introduction
2. Motivation
3. Kotlin
4. Migration
5. Refactoring
6. Report
7. Conclusion
대상
Kotlin이라는 언어를 들어보신 분이라면 누구나
■관련 동영상: https://youtu.be/wiJqu7xoH58
자프링(자바 + 스프링) 외길 12년차 서버 개발자가 코프링(코틀린 + 스프링)을 만난 후 코틀린의 특징과 스프링의 코틀린 지원을 알아가며 코프링 월드에서 살아남은 이야기…
코드 저장소: https://github.com/arawn/kotlin-support-in-spring
The magic of jQuery's CSS-based selection makes it easy to think about our code in terms of the DOM, and sometimes that approach is exactly right. Other times, though, what we're trying to accomplish is only tangentially related to our nodes, and opting for an approach where we think in terms of functionality -- not how that functionality is manifested on our page -- can pay big dividends in terms of flexibility. In this talk, we'll look at a small sample application where the DOM takes a back seat to functionality-focused modules, and see how the approach can change the way we write and organize our code.
Pro bun-fighting - Working with JavaScript projectsFrances Berriman
This is the talk I gave at March's London Web Standards meet-up in London. It covers how we create Glow and make it a quality library. The talk has notes available for each slide and a video will be published soon.
Moje slajdy z prezentacji na GraphQL Wroclaw #3 https://www.meetup.com/GraphQL-Wroclaw/events/261828347/
Większość prezentacji dotyczących GraphQL opowiada o JavaSkryptowych narzędziach, natomiast mało kto mówi o tym jak korzystać z GraphQL w Javie. Prezentacja będzie o tym, jak sprawić aby nasz backendowy, Javowy serwer korzystał z GraphQL. Będzie o możliwych podejściach w implementacji, dobrych praktykach i 4-letnim doświadczeniu z GraphQL na produkcji.
※다운로드하시면 더 선명한 자료를 보실 수 있습니다.
서버 사이드에서도 Spring 5를 통해 공식적으로 지원이 시작된 후,
Spring을 이용한 많은 서비스가 Java를 대신하여 Kotlin을 적용하고 있습니다.
본 세션에서는 PAYCO 매거진 프로젝트에 Kotlin을 적용했던 경험과 시행착오를 나누어 보려 합니다.
목차
1. Introduction
2. Motivation
3. Kotlin
4. Migration
5. Refactoring
6. Report
7. Conclusion
대상
Kotlin이라는 언어를 들어보신 분이라면 누구나
■관련 동영상: https://youtu.be/wiJqu7xoH58
Alternatives of JPA
Requery provide simple Object Mapping & Generate SQL to execute without reflection and session, so fast than JPA, simple and easy to learn.
Create an advance data type to represent web page history. Name this .pdfsanuoptical
Create an advance data type to represent web page history. Name this class \'WebHistory\'. The
following should be the private members of this class: 1- int totalPagesVisited; 2- WebPagell
pages; As you can see, you also need to class \"WebPage\" which should have the following
private members: 1- Date visitedOn; 2- String url; 3- String content; Implement all the
necessary. constructors and all the getters/setters for these classes. Now, inside main(), write a
test code to test the working of your class. The test code should be something like this: public
static void main(String[] args) {//this is just a sample, you must test every function you wrote.
WebHistory myhist = new WebHistory(2);//totalPagesVisited should be 2 Date today = new
Date(10, 10, 2016); Date yesterday = new Date(9, 10, 2016); WebPage pi = new
WebPage(today, \"www.google.com\", \"This is Google\'s webpage\"); WebPage p2 = new
WebPage(yesterday, \"www.yahoo.com\", \"This is Yahoo\'s webpage\"); myhis.t.Add(pl);
myhist. Add(p2); System.out.printIn(myhist);
Solution
import java.util.Date;
public class WebPage {
Date visitedOn;
String url;
String content;
/**
* @param visitedOn
* @param url
* @param content
*/
public WebPage(Date visitedOn, String url, String content) {
this.visitedOn = visitedOn;
this.url = url;
this.content = content;
}
/**
* @return the visitedOn
*/
public Date getVisitedOn() {
return visitedOn;
}
/**
* @param visitedOn
* the visitedOn to set
*/
public void setVisitedOn(Date visitedOn) {
this.visitedOn = visitedOn;
}
/**
* @return the url
*/
public String getUrl() {
return url;
}
/**
* @param url
* the url to set
*/
public void setUrl(String url) {
this.url = url;
}
/**
* @return the content
*/
public String getContent() {
return content;
}
/**
* @param content
* the content to set
*/
public void setContent(String content) {
this.content = content;
}
/*
* (non-Javadoc)
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
return \"WebPage [visitedOn=\" + visitedOn + \", url=\" + url
+ \", content=\" + content + \"]\";
}
}
import java.util.Arrays;
public class WebHistory {
int totalPagesVisited;
WebPage[] pages;
/**
* @param totalPagesVisited
* @param pages
*/
public WebHistory(int totalPages) {
this.totalPagesVisited = 0;
this.pages = new WebPage[totalPages];
}
public boolean Add(WebPage p) {
if (totalPagesVisited < pages.length) {
pages[totalPagesVisited] = p;
totalPagesVisited++;
return true;
} else
return false;
}
/*
* (non-Javadoc)
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
return \"WebHistory [totalPagesVisited=\" + totalPagesVisited
+ \", pages=\" + Arrays.toString(pages) + \"]\";
}
}
import java.util.Date;
public class TestWebHistory {
public static void main(String[] args) {
WebHistory myhist = new WebHistory(2);
Date today = new Date(10, 10, 2016);
Date yesterday = new Date(9, 10, 2016);
WebPage p1 = new WebPage(today, \"www.google.com\",
\"This is Google\'s webpage\");
WebPage p2 = new WebPa.
Webinar: MongoDB Persistence with Java and MorphiaMongoDB
MongoDB is the leading noSQL database and as with any new technology, some of the biggest questions are about tools and integration. This webinar will cover how to use MongoDB from a Java application and introduce Morphia, the object document mapping library. It will cover the essential features of the framework with examples before moving on to some of the more advanced and upcoming features such as text search and aggregation framework support.
Prezentacja z meetupu Women in Technology Warszawa
Get Inspired: Po co nam UX? O edukacji i nie tylko
27.06
Prelekcja: Karolina Plaskowicka, UX Magazyn
Prezentacja poprowadzona przez Tomasza Kurowskiego, Tomasza Korwin-Gajkowskiego oraz Jacka Sieradzkiego na 43 spotkaniu Women in Technology w Krakowie.
Agnieszka Pocha - Od surowych danych do gotowego modelu - uczenie maszynowe w...Women in Technology Poland
Czym zajmuje się uczenie maszynowe? Wczytywanie danych? Zbalansowanie klas (klasyfikacja)? Metody histogramowe? Skalowanie, centrowanie, wybielanie? Klątwa wymiarowości?
W prezentacji znajdziesz omówienie:
-organizację kodu i pracy w trochę większych projektach
-wykorzystanie narzędzi takich jak npm, gulp, sass, bower do automatyzacji zadań
-efektywną pracę w zespole z wykorzystaniem gita
-zasady tworzenia zwartego, łatwego w utrzymaniu kodu w oparciu o podejście SMACSS i BEM
-wzorce i podejście do tworzenia modularnego javascriptu
-przydatne narzędzia i biblioteki wraz z ich praktycznym zastosowaniem
-testowanie stron i aplikacji
-przyjrzymy się też nowej wersji Javascript: ES6/ES2015
Large Language Models and the End of ProgrammingMatt Welsh
Talk by Matt Welsh at Craft Conference 2024 on the impact that Large Language Models will have on the future of software development. In this talk, I discuss the ways in which LLMs will impact the software industry, from replacing human software developers with AI, to replacing conventional software with models that perform reasoning, computation, and problem-solving.
Modern design is crucial in today's digital environment, and this is especially true for SharePoint intranets. The design of these digital hubs is critical to user engagement and productivity enhancement. They are the cornerstone of internal collaboration and interaction within enterprises.
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoamtakuyayamamoto1800
In this slide, we show the simulation example and the way to compile this solver.
In this solver, the Helmholtz equation can be solved by helmholtzFoam. Also, the Helmholtz equation with uniformly dispersed bubbles can be simulated by helmholtzBubbleFoam.
Globus Compute wth IRI Workflows - GlobusWorld 2024Globus
As part of the DOE Integrated Research Infrastructure (IRI) program, NERSC at Lawrence Berkeley National Lab and ALCF at Argonne National Lab are working closely with General Atomics on accelerating the computing requirements of the DIII-D experiment. As part of the work the team is investigating ways to speedup the time to solution for many different parts of the DIII-D workflow including how they run jobs on HPC systems. One of these routes is looking at Globus Compute as a way to replace the current method for managing tasks and we describe a brief proof of concept showing how Globus Compute could help to schedule jobs and be a tool to connect compute at different facilities.
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...Globus
The U.S. Geological Survey (USGS) has made substantial investments in meeting evolving scientific, technical, and policy driven demands on storing, managing, and delivering data. As these demands continue to grow in complexity and scale, the USGS must continue to explore innovative solutions to improve its management, curation, sharing, delivering, and preservation approaches for large-scale research data. Supporting these needs, the USGS has partnered with the University of Chicago-Globus to research and develop advanced repository components and workflows leveraging its current investment in Globus. The primary outcome of this partnership includes the development of a prototype enterprise repository, driven by USGS Data Release requirements, through exploration and implementation of the entire suite of the Globus platform offerings, including Globus Flow, Globus Auth, Globus Transfer, and Globus Search. This presentation will provide insights into this research partnership, introduce the unique requirements and challenges being addressed and provide relevant project progress.
Understanding Globus Data Transfers with NetSageGlobus
NetSage is an open privacy-aware network measurement, analysis, and visualization service designed to help end-users visualize and reason about large data transfers. NetSage traditionally has used a combination of passive measurements, including SNMP and flow data, as well as active measurements, mainly perfSONAR, to provide longitudinal network performance data visualization. It has been deployed by dozens of networks world wide, and is supported domestically by the Engagement and Performance Operations Center (EPOC), NSF #2328479. We have recently expanded the NetSage data sources to include logs for Globus data transfers, following the same privacy-preserving approach as for Flow data. Using the logs for the Texas Advanced Computing Center (TACC) as an example, this talk will walk through several different example use cases that NetSage can answer, including: Who is using Globus to share data with my institution, and what kind of performance are they able to achieve? How many transfers has Globus supported for us? Which sites are we sharing the most data with, and how is that changing over time? How is my site using Globus to move data internally, and what kind of performance do we see for those transfers? What percentage of data transfers at my institution used Globus, and how did the overall data transfer performance compare to the Globus users?
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...Anthony Dahanne
Les Buildpacks existent depuis plus de 10 ans ! D’abord, ils étaient utilisés pour détecter et construire une application avant de la déployer sur certains PaaS. Ensuite, nous avons pu créer des images Docker (OCI) avec leur dernière génération, les Cloud Native Buildpacks (CNCF en incubation). Sont-ils une bonne alternative au Dockerfile ? Que sont les buildpacks Paketo ? Quelles communautés les soutiennent et comment ?
Venez le découvrir lors de cette session ignite
Multiple Your Crypto Portfolio with the Innovative Features of Advanced Crypt...Hivelance Technology
Cryptocurrency trading bots are computer programs designed to automate buying, selling, and managing cryptocurrency transactions. These bots utilize advanced algorithms and machine learning techniques to analyze market data, identify trading opportunities, and execute trades on behalf of their users. By automating the decision-making process, crypto trading bots can react to market changes faster than human traders
Hivelance, a leading provider of cryptocurrency trading bot development services, stands out as the premier choice for crypto traders and developers. Hivelance boasts a team of seasoned cryptocurrency experts and software engineers who deeply understand the crypto market and the latest trends in automated trading, Hivelance leverages the latest technologies and tools in the industry, including advanced AI and machine learning algorithms, to create highly efficient and adaptable crypto trading bots
Providing Globus Services to Users of JASMIN for Environmental Data AnalysisGlobus
JASMIN is the UK’s high-performance data analysis platform for environmental science, operated by STFC on behalf of the UK Natural Environment Research Council (NERC). In addition to its role in hosting the CEDA Archive (NERC’s long-term repository for climate, atmospheric science & Earth observation data in the UK), JASMIN provides a collaborative platform to a community of around 2,000 scientists in the UK and beyond, providing nearly 400 environmental science projects with working space, compute resources and tools to facilitate their work. High-performance data transfer into and out of JASMIN has always been a key feature, with many scientists bringing model outputs from supercomputers elsewhere in the UK, to analyse against observational or other model data in the CEDA Archive. A growing number of JASMIN users are now realising the benefits of using the Globus service to provide reliable and efficient data movement and other tasks in this and other contexts. Further use cases involve long-distance (intercontinental) transfers to and from JASMIN, and collecting results from a mobile atmospheric radar system, pushing data to JASMIN via a lightweight Globus deployment. We provide details of how Globus fits into our current infrastructure, our experience of the recent migration to GCSv5.4, and of our interest in developing use of the wider ecosystem of Globus services for the benefit of our user community.
Check out the webinar slides to learn more about how XfilesPro transforms Salesforce document management by leveraging its world-class applications. For more details, please connect with sales@xfilespro.com
If you want to watch the on-demand webinar, please click here: https://www.xfilespro.com/webinars/salesforce-document-management-2-0-smarter-faster-better/
We describe the deployment and use of Globus Compute for remote computation. This content is aimed at researchers who wish to compute on remote resources using a unified programming interface, as well as system administrators who will deploy and operate Globus Compute services on their research computing infrastructure.
Why React Native as a Strategic Advantage for Startup Innovation.pdfayushiqss
Do you know that React Native is being increasingly adopted by startups as well as big companies in the mobile app development industry? Big names like Facebook, Instagram, and Pinterest have already integrated this robust open-source framework.
In fact, according to a report by Statista, the number of React Native developers has been steadily increasing over the years, reaching an estimated 1.9 million by the end of 2024. This means that the demand for this framework in the job market has been growing making it a valuable skill.
But what makes React Native so popular for mobile application development? It offers excellent cross-platform capabilities among other benefits. This way, with React Native, developers can write code once and run it on both iOS and Android devices thus saving time and resources leading to shorter development cycles hence faster time-to-market for your app.
Let’s take the example of a startup, which wanted to release their app on both iOS and Android at once. Through the use of React Native they managed to create an app and bring it into the market within a very short period. This helped them gain an advantage over their competitors because they had access to a large user base who were able to generate revenue quickly for them.
Software Engineering, Software Consulting, Tech Lead.
Spring Boot, Spring Cloud, Spring Core, Spring JDBC, Spring Security,
Spring Transaction, Spring MVC,
Log4j, REST/SOAP WEB-SERVICES.
Listen to the keynote address and hear about the latest developments from Rachana Ananthakrishnan and Ian Foster who review the updates to the Globus Platform and Service, and the relevance of Globus to the scientific community as an automation platform to accelerate scientific discovery.
How to Position Your Globus Data Portal for Success Ten Good PracticesGlobus
Science gateways allow science and engineering communities to access shared data, software, computing services, and instruments. Science gateways have gained a lot of traction in the last twenty years, as evidenced by projects such as the Science Gateways Community Institute (SGCI) and the Center of Excellence on Science Gateways (SGX3) in the US, The Australian Research Data Commons (ARDC) and its platforms in Australia, and the projects around Virtual Research Environments in Europe. A few mature frameworks have evolved with their different strengths and foci and have been taken up by a larger community such as the Globus Data Portal, Hubzero, Tapis, and Galaxy. However, even when gateways are built on successful frameworks, they continue to face the challenges of ongoing maintenance costs and how to meet the ever-expanding needs of the community they serve with enhanced features. It is not uncommon that gateways with compelling use cases are nonetheless unable to get past the prototype phase and become a full production service, or if they do, they don't survive more than a couple of years. While there is no guaranteed pathway to success, it seems likely that for any gateway there is a need for a strong community and/or solid funding streams to create and sustain its success. With over twenty years of examples to draw from, this presentation goes into detail for ten factors common to successful and enduring gateways that effectively serve as best practices for any new or developing gateway.
Globus Connect Server Deep Dive - GlobusWorld 2024Globus
We explore the Globus Connect Server (GCS) architecture and experiment with advanced configuration options and use cases. This content is targeted at system administrators who are familiar with GCS and currently operate—or are planning to operate—broader deployments at their institution.
Code reviews are vital for ensuring good code quality. They serve as one of our last lines of defense against bugs and subpar code reaching production.
Yet, they often turn into annoying tasks riddled with frustration, hostility, unclear feedback and lack of standards. How can we improve this crucial process?
In this session we will cover:
- The Art of Effective Code Reviews
- Streamlining the Review Process
- Elevating Reviews with Automated Tools
By the end of this presentation, you'll have the knowledge on how to organize and improve your code review proces
Cyaniclab : Software Development Agency Portfolio.pdfCyanic lab
CyanicLab, an offshore custom software development company based in Sweden,India, Finland, is your go-to partner for startup development and innovative web design solutions. Our expert team specializes in crafting cutting-edge software tailored to meet the unique needs of startups and established enterprises alike. From conceptualization to execution, we offer comprehensive services including web and mobile app development, UI/UX design, and ongoing software maintenance. Ready to elevate your business? Contact CyanicLab today and let us propel your vision to success with our top-notch IT solutions.
Enhancing Research Orchestration Capabilities at ORNL.pdfGlobus
Cross-facility research orchestration comes with ever-changing constraints regarding the availability and suitability of various compute and data resources. In short, a flexible data and processing fabric is needed to enable the dynamic redirection of data and compute tasks throughout the lifecycle of an experiment. In this talk, we illustrate how we easily leveraged Globus services to instrument the ACE research testbed at the Oak Ridge Leadership Computing Facility with flexible data and task orchestration capabilities.
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...Juraj Vysvader
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I didn't get rich from it but it did have 63K downloads (powered possible tens of thousands of websites).
11. Why
another
database
library?
• less boilerplate code (thanks to annotations)
• SQL statement compile-time validation (less
crashes)
• full compatibility with other Architecture
Components (LiveData) and RxJava
• easy to use
• easy to test
• easy to migrate
14. public class Cat {
public int id;
public String name;
public String url;
public Cat(int id, String name, String url) {
this.id = id;
this.name = name;
this.url = url;
}a
}a
15. @Entity
public class Cat {
public int id;
public String name;
public String url;
public Cat(int id, String name, String url) {
this.id = id;
this.name = name;
this.url = url;
}a
}a
16. @Entity
public class Cat {
@PrimaryKey
public int id;
public String name;
public String url;
public Cat(int id, String name, String url) {
this.id = id;
this.name = name;
this.url = url;
}a
}a
17. @Entity(tableName = „kittens”)
public class Cat {
@PrimaryKey
public int id;
public String name;
public String url;
public Cat(int id, String name, String url) {
this.id = id;
this.name = name;
this.url = url;
}a
}a
18. @Entity(tableName = „kittens”)
public class Cat {
@PrimaryKey(autoGenerate = true)
public int id;
public String name;
public String url;
public Cat(String name, String url) {
this.name = name;
this.url = url;
}a
}a
19. @Entity(tableName = „kittens”)
public class Cat {
@PrimaryKey(autoGenerate = true)
public int id;
public String name;
@ColumnInfo(name = „photo_url”)
public String url;
public Cat(String name, String url) {
this.name = name;
this.url = url;
}a
}a
40. @Entity
public class Owner {
@PrimaryKey
public int id;
public String login;
public String avatarUrl;
public Owner(int id, String login, String avatarUrl) {
this.id = id;
this.login = login;
this.avatarUrl = avatarUrl;
}a
}a
41. @Entity
public class Cat {
@PrimaryKey
public int id;
public String name;
public String url;
public int ownerId;
public Cat(int id, String name, String url, int ownerId) {
this.id = id;
this.name = name;
this.url = url;
this.ownerId = ownerId;
}a
}a
42. @Entity(foreignKeys = @ForeignKey(entity = Owner.class))
public class Cat {
@PrimaryKey
public int id;
public String name;
public String url;
public int ownerId;
public Cat(int id, String name, String url, int ownerId) {
this.id = id;
this.name = name;
this.url = url;
this.ownerId = ownerId;
}a
}a
43. @Entity(foreignKeys = @ForeignKey(entity = Owner.class,
parentColumns = "id"))
public class Cat {
@PrimaryKey
public int id;
public String name;
public String url;
public int ownerId;
public Cat(int id, String name, String url, int ownerId) {
this.id = id;
this.name = name;
this.url = url;
this.ownerId = ownerId;
}a
}a
44. @Entity(foreignKeys = @ForeignKey(entity = Owner.class,
parentColumns = "id",
childColumns = "ownerId"))
public class Cat {
@PrimaryKey
public int id;
public String name;
public String url;
public int ownerId;
public Cat(int id, String name, String url, int ownerId) {
this.id = id;
this.name = name;
this.url = url;
this.ownerId = ownerId;
}a
}a
45. @Entity(foreignKeys = @ForeignKey(entity = Owner.class,
parentColumns = "id",
childColumns = "ownerId",
onDelete = CASCADE))
public class Cat {
@PrimaryKey
public int id;
public String name;
public String url;
public int ownerId;
public Cat(int id, String name, String url, int ownerId) {
this.id = id;
this.name = name;
this.url = url;
this.ownerId = ownerId;
}a
}a
46. @Dao
public interface CatDao {
@Query("SELECT * FROM kittens WHERE ownerId=:ownerId")
List<Cat> findCatsForOwner(int ownerId);
}a
48. @Entity
public class Owner {
@PrimaryKey
public int id;
public String login;
public String avatarUrl;
public Owner(int id, String login, String avatarUrl) {
this.id = id;
this.login = login;
this.avatarUrl = avatarUrl;
}a
}a
49. @Entity
public class Cat {
@PrimaryKey
public int id;
public String name;
public String url;
public int ownerId;
public Cat(int id, String name, String url, int ownerId) {
this.id = id;
this.name = name;
this.url = url;
this.ownerId = ownerId;
}a
}a
50. public class OwnerWithCats {
@Embedded public Owner owner;
@Relation(parentColumn = "id",
entityColumn = "ownerId")
public List<Cat> catList;
}a
53. @Entity
public class Cat {
@PrimaryKey
public int id;
public String name;
public LocalDate birthday;
public Cat(int id, String name, LocalDate birthday) {
this.id = id;
this.name = name;
this.birthday = birthday;
}a
}a
54. public class DateConverter {
@TypeConverter
public LocalDate toDate(long dateLong) {
return LocalDate.ofEpochDay(dateLong);
}
@TypeConverter
public long fromDate(LocalDate date) {
return date.toEpochDay();
}
}
55. @Database(entities = { Cat.class }, version = 1)
public abstract class CatDatabase extends RoomDatabase {
}a
56. @Database(entities = { Cat.class }, version = 1)
@TypeConverters(DateConverter.class)
public abstract class CatDatabase extends RoomDatabase {
}a
59. @Entity
public class Cat {
@PrimaryKey public int id;
public String name;
public String url;
public String age;
}a
60. java.lang.IllegalStateException: Room cannot verify the data
integrity. Looks like you've changed schema but forgot to
update the version number. You can simply fix this by
increasing the version number.
63. java.lang.IllegalStateException: A migration from 1 to 2 is necessary.
Please provide a Migration in the builder or call
fallbackToDestructiveMigration in the builder in which case Room will
re-create all of the tables.
76. tl;dr • less boilerplate code
• SQL statement compile-time validation
• full compatibility with other Architecture
Components and RxJava
• easy to use
• easy to test
• easy to migrate
88. public class MainActivity extends AppCompatActivity implements LocationListener {
private LocationManager locationManager;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
locationManager = new LocationManager(this);
}a
@Override
public void onLocationChanged(final Location location) {
Log.d(„MainActivity", „Location changed: " + location.toString());
}a
}a
89. Lifecycle
Observer
It’s the LocationManager which cares
about the Lifecycle. So it should be able
to do it without the activity
babysitting itself.
I’m sure if you look at your code today,
your onStart(), onStop() methods are
like, at least 20, 30 lines of code. We
want them to be zero lines of code.
~Yigit Boyar, Software Enginner, Google,
Google I/O ‚17
90. public class GithubApplication extends Application {
@Override
public void onCreate() {
super.onCreate();
ProcessLifecycleOwner.get()
.getLifecycle()
.addObserver(new AppLifecycleObserver());
}
}
91. public class AppLifecycleObserver implements LifecycleObserver {
@OnLifecycleEvent(Lifecycle.Event.ON_CREATE)
void onFirstActivityCreated() {
// app is in the foreground now
}
@OnLifecycleEvent(Lifecycle.Event.ON_PAUSE)
void onLastActivityPaused() {
// app is in the background now
}
}
109. tl;dr • keeps your UI always updated (follows
observer pattern)
• no memory leaks (data bound with
lifecycle)
• no data sent to stopped activity
110. @Dao
public interface CatDao {
@Query("SELECT * FROM cats WHERE name=:name")
LiveData<List<Cat>> getCatsByName(String name);
@Query("SELECT * FROM cats WHERE name=:name")
Flowable<List<Cat>> getCatsByName(String name);
}a
111. Resources Android Architecture Documentation:
https://developer.android.com/topic/libraries/
architecture/index.html
Guide To App Architecture:
https://developer.android.com/topic/libraries/
architecture/guide.html
Google Samples Repository:
https://github.com/googlesamples/android-
architecture-components
Medium series about Architecture Components:
https://medium.com/@pszklarska