The document discusses the implementation of a Notification entity class that maps to database table and represents notifications for a social media user. The Notification class uses annotations like @Id, @ManyToOne and has fields for the notification ID, associated user, text, reaction details, date, whether it was read, and post/comment IDs. Getter and setter methods are also implemented.
Creating a Facebook Clone - Part XIX - Transcript.pdfShaiAlmog1
The document describes the implementation of a Post entity and related classes for the backend of a Facebook clone. It includes:
1) A Post entity with fields like user, date, title, content, visibility, styling, comments, and likes.
2) Post, Comment, and related DAO classes to transfer data to and from clients.
3) PostRepository and CommentRepository interfaces extending CrudRepository for database operations.
4) Methods in PostRepository like findPostsByUser() and findAllPostsByUser() to retrieve posts by user with paging support.
Creating a Facebook Clone - Part XVIII.pdfShaiAlmog1
This document discusses the Media class and MediaDAO class used for storing media data in a database. The Media class defines fields for the media id, filename, date, role, mime type, visibility, owner, and data. The MediaDAO class is used to transfer data between the Media entity and database. It includes fields for each property in Media and methods for getting and setting the field values.
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.
Creating a Facebook Clone - Part XIX - Transcript.pdfShaiAlmog1
The document describes the implementation of a Post entity and related classes for the backend of a Facebook clone. It includes:
1) A Post entity with fields like user, date, title, content, visibility, styling, comments, and likes.
2) Post, Comment, and related DAO classes to transfer data to and from clients.
3) PostRepository and CommentRepository interfaces extending CrudRepository for database operations.
4) Methods in PostRepository like findPostsByUser() and findAllPostsByUser() to retrieve posts by user with paging support.
Creating a Facebook Clone - Part XVIII.pdfShaiAlmog1
This document discusses the Media class and MediaDAO class used for storing media data in a database. The Media class defines fields for the media id, filename, date, role, mime type, visibility, owner, and data. The MediaDAO class is used to transfer data between the Media entity and database. It includes fields for each property in Media and methods for getting and setting the field values.
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.
GreenDao is an ORM library that provides a lightweight way to work with SQLite databases on Android. It allows developers to define entities using annotations and perform CRUD operations and queries on those entities through generated DAO classes. Some key features include high performance, small code size, easy to use API, and support for database encryption, RxJava, and SQLCipher. Configuration involves setting up Gradle dependencies, defining entities, and generating DAO classes to work with the database. Relationships between entities can be defined using @ToOne and @ToMany annotations.
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.
The document describes the setup and implementation of user authentication for a Spring Boot based Uber clone application. It defines a User entity and UserService with methods for registering, authenticating, and updating users. The service implements authentication via phone, Facebook, or Google ID and password validation. Security is configured with BCrypt password encoding and authorization of API requests.
Boost Your Development With Proper API DesignMarcusHeld1
“The ratio of time spent reading versus writing is well over 10 to 1.” – Robert C. Martin
Inspired by this fact, I present programming principles, design patterns and the benefits designing your API in favor of the caller of your module to achieve a highly maintainable code base. Through the use of numerous examples, you’ll learn how to design a module that is convenient to use, easy to maintain and hard to break.
For more information see also the related blog post: https://tech.innogames.com/boost-your-development-with-proper-api-design/
The document provides an overview of RecyclerView in Android, including:
1. RecyclerView components like LayoutManager, Adapter, ItemDecoration, and ItemAnimator and examples of how to set them up.
2. How to create ViewHolders and Adapters to display data in RecyclerView.
3. Techniques for handling click listeners and displaying multiple view types.
4. Examples of using item decorations and animators.
5. Recommended resources for further learning about RecyclerView.
This document discusses architecture components for building modern Android applications. It covers common app architecture problems and principles like separation of concerns. It introduces key Architecture Components like Activities, Fragments, Services, ContentProviders, ViewModels and LiveData. It also discusses architectural patterns like MVC, MVP, MVVM and recommendations like clean architecture. The document emphasizes principles like modularity, separation of concerns, and testability. It provides an overview of alternatives like Room, Paging Library, and recommendations for legacy apps.
This document discusses architecture components for building modern Android applications. It covers common app architecture problems and principles like separation of concerns. It introduces key Architecture Components like Activities, Fragments, Services, ContentProviders, ViewModels and LiveData. It also discusses architectural patterns like MVC, MVP, MVVM and recommendations like clean architecture. The document emphasizes principles like modularity, separation of concerns, and testability. It provides an overview of alternatives like Room, Paging Library, and recommendations for legacy apps.
The document discusses object/relational mapping and how to implement a domain model in Java using Hibernate. It covers creating POJO classes, mapping properties and associations, handling primary keys and inheritance. Key points include:
- Implement domain model as POJOs with getters/setters and use Hibernate XML mappings to connect to database
- Map properties and identifiers, handle one-to-many and many-to-one associations
- Support inheritance with single table, joined subclass, or table per concrete class strategies
- Ensure bidirectional relationships are properly managed
Java and Spring Data JPA: Easy SQL Data Access
Abstract
Presenter: Miya W. Longwe, MBA, MSE, Tech Lead, Staples, Inc, Framingham MA 01702
Accessing data repositories in various applications programming languages typically involves writing of tedious boilerplate lines of code. Some application development frameworks such as Spring have tried to make the experience more succinct by providing abstraction layers such as HibernateTemplate and JdbcTemplate, etc. Despite these APIs, the developers still spend a lot time writing repetitive code than concentrating on implementing business requirements. Developers at Spring, led by Oliver Gierke, introduced Spring Data JPA which “aims to significantly improve the implementation of data access layers by reducing the effort to the amount that's actually needed. As a developer you write your repository interfaces, including custom finder methods, and Spring will provide the implementation automatically”.
Spring Data JPA provides a powerful, out-of-the-box alternative to creating your own DAO framework. You declare custom repository operations on an interface, and the framework generates dynamic implementations (not code generation) automatically, based on conventions around method names. As part of the presentation, we'll also review a demo to look at Spring Java configuration (as opposed to XML configuration), and investigate the @Profile annotation – configuration details which may make life a bit easier in various ways when setting up unit testing of our repository classes, using out-of-the-box alternative to creating DAO framework, how to create custom repositories, pagination and support for custom queries among other features.
Presenter's Bio
Miya W. Longwe is a Senior Software Engineer and Tech Lead at Staples, Inc. where he is currently working on an initiative to re-platform the company’s ecommerce architecture to offer platform-driven, modular products that can be quickly customized, enhanced, and branded as needed.
Miya has been a software professional since 1997. His 16 years software development career includes working for large companies to small startups, building solutions for enterprises and consumers, working with a broad range of technologies.
Miya Longwe is a hands-on java developer. He believes that in order to be a relevant and effective software developer one needs to remain a deeply knowledgeable, up-to-date, and productive software developer. His research interests include model-driven engineering, domain specific languages, test driven development and project risk management.
Miya graduated from the University of Malawi (Lilongwe, Malawi) and has an MBA from the University of Wales Cardiff Business School (Wales, UK) and a Masters in Software Engineering from Brandeis University (MA, USA).
Occasionally, Miya can be spotted fishing the banks of the south shore (MA) with his two boys, William and Daniel.
An Android operating system is an open source Linux-based OS for mobile devices. It includes application building blocks like activities, intents, broadcast receivers and services. To set up the Android development environment, developers need to install the Android SDK, Eclipse IDE, ADT plugin and create an Android virtual device. The document then provides instructions on creating an Android project in Eclipse, understanding the project structure and running an Android application.
Knots - the Lazy Data Transfer Objects for Dealing with the Microservices CrazeAlexander Shopov
Microservices architectures are distributed ones, thus using them has perils. 'Knots' are a trivial, almost mechanical way to represent the flow of data in them that is composable, extendable and relatively easy to reason about. It simplifies refactors and maintenance and makes roundtrips easy to account. They are compatible with caching, different architectures. Just get an ID and promise to give what it corresponds to when you ask for it.
Microservices make database joins either redundant application level job or very difficult application level job depending on whether you are designing the microservice or are using it. Even though joins may be impossible you need to tie data together - that's why you use knots. A knot may tie several things together, it may even tie one knot to another.
In design patterns parlance knot is just your run of the mill lazily instantiated facade proxy for data transfer that you can observe when you have to. Except it is not! It is a knot.
Just have an id and you will get it.
And once you get it - keep it knotted together.
The Duck Teaches Learn to debug from the masters. Local to production- kill ...ShaiAlmog1
The document outlines an agenda for a workshop on debugging techniques. The workshop covers installing tools, flow and breakpoints debugging, watching variables, Kubernetes debugging, and developer observability. Key techniques discussed include tracepoints, memory debugging, exception breakpoints, object marking, and logs, snapshots, and metrics for observability. The goal is to teach practical debugging skills that can be applied at scale in production environments like Kubernetes.
GreenDao is an ORM library that provides a lightweight way to work with SQLite databases on Android. It allows developers to define entities using annotations and perform CRUD operations and queries on those entities through generated DAO classes. Some key features include high performance, small code size, easy to use API, and support for database encryption, RxJava, and SQLCipher. Configuration involves setting up Gradle dependencies, defining entities, and generating DAO classes to work with the database. Relationships between entities can be defined using @ToOne and @ToMany annotations.
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.
The document describes the setup and implementation of user authentication for a Spring Boot based Uber clone application. It defines a User entity and UserService with methods for registering, authenticating, and updating users. The service implements authentication via phone, Facebook, or Google ID and password validation. Security is configured with BCrypt password encoding and authorization of API requests.
Boost Your Development With Proper API DesignMarcusHeld1
“The ratio of time spent reading versus writing is well over 10 to 1.” – Robert C. Martin
Inspired by this fact, I present programming principles, design patterns and the benefits designing your API in favor of the caller of your module to achieve a highly maintainable code base. Through the use of numerous examples, you’ll learn how to design a module that is convenient to use, easy to maintain and hard to break.
For more information see also the related blog post: https://tech.innogames.com/boost-your-development-with-proper-api-design/
The document provides an overview of RecyclerView in Android, including:
1. RecyclerView components like LayoutManager, Adapter, ItemDecoration, and ItemAnimator and examples of how to set them up.
2. How to create ViewHolders and Adapters to display data in RecyclerView.
3. Techniques for handling click listeners and displaying multiple view types.
4. Examples of using item decorations and animators.
5. Recommended resources for further learning about RecyclerView.
This document discusses architecture components for building modern Android applications. It covers common app architecture problems and principles like separation of concerns. It introduces key Architecture Components like Activities, Fragments, Services, ContentProviders, ViewModels and LiveData. It also discusses architectural patterns like MVC, MVP, MVVM and recommendations like clean architecture. The document emphasizes principles like modularity, separation of concerns, and testability. It provides an overview of alternatives like Room, Paging Library, and recommendations for legacy apps.
This document discusses architecture components for building modern Android applications. It covers common app architecture problems and principles like separation of concerns. It introduces key Architecture Components like Activities, Fragments, Services, ContentProviders, ViewModels and LiveData. It also discusses architectural patterns like MVC, MVP, MVVM and recommendations like clean architecture. The document emphasizes principles like modularity, separation of concerns, and testability. It provides an overview of alternatives like Room, Paging Library, and recommendations for legacy apps.
The document discusses object/relational mapping and how to implement a domain model in Java using Hibernate. It covers creating POJO classes, mapping properties and associations, handling primary keys and inheritance. Key points include:
- Implement domain model as POJOs with getters/setters and use Hibernate XML mappings to connect to database
- Map properties and identifiers, handle one-to-many and many-to-one associations
- Support inheritance with single table, joined subclass, or table per concrete class strategies
- Ensure bidirectional relationships are properly managed
Java and Spring Data JPA: Easy SQL Data Access
Abstract
Presenter: Miya W. Longwe, MBA, MSE, Tech Lead, Staples, Inc, Framingham MA 01702
Accessing data repositories in various applications programming languages typically involves writing of tedious boilerplate lines of code. Some application development frameworks such as Spring have tried to make the experience more succinct by providing abstraction layers such as HibernateTemplate and JdbcTemplate, etc. Despite these APIs, the developers still spend a lot time writing repetitive code than concentrating on implementing business requirements. Developers at Spring, led by Oliver Gierke, introduced Spring Data JPA which “aims to significantly improve the implementation of data access layers by reducing the effort to the amount that's actually needed. As a developer you write your repository interfaces, including custom finder methods, and Spring will provide the implementation automatically”.
Spring Data JPA provides a powerful, out-of-the-box alternative to creating your own DAO framework. You declare custom repository operations on an interface, and the framework generates dynamic implementations (not code generation) automatically, based on conventions around method names. As part of the presentation, we'll also review a demo to look at Spring Java configuration (as opposed to XML configuration), and investigate the @Profile annotation – configuration details which may make life a bit easier in various ways when setting up unit testing of our repository classes, using out-of-the-box alternative to creating DAO framework, how to create custom repositories, pagination and support for custom queries among other features.
Presenter's Bio
Miya W. Longwe is a Senior Software Engineer and Tech Lead at Staples, Inc. where he is currently working on an initiative to re-platform the company’s ecommerce architecture to offer platform-driven, modular products that can be quickly customized, enhanced, and branded as needed.
Miya has been a software professional since 1997. His 16 years software development career includes working for large companies to small startups, building solutions for enterprises and consumers, working with a broad range of technologies.
Miya Longwe is a hands-on java developer. He believes that in order to be a relevant and effective software developer one needs to remain a deeply knowledgeable, up-to-date, and productive software developer. His research interests include model-driven engineering, domain specific languages, test driven development and project risk management.
Miya graduated from the University of Malawi (Lilongwe, Malawi) and has an MBA from the University of Wales Cardiff Business School (Wales, UK) and a Masters in Software Engineering from Brandeis University (MA, USA).
Occasionally, Miya can be spotted fishing the banks of the south shore (MA) with his two boys, William and Daniel.
An Android operating system is an open source Linux-based OS for mobile devices. It includes application building blocks like activities, intents, broadcast receivers and services. To set up the Android development environment, developers need to install the Android SDK, Eclipse IDE, ADT plugin and create an Android virtual device. The document then provides instructions on creating an Android project in Eclipse, understanding the project structure and running an Android application.
Knots - the Lazy Data Transfer Objects for Dealing with the Microservices CrazeAlexander Shopov
Microservices architectures are distributed ones, thus using them has perils. 'Knots' are a trivial, almost mechanical way to represent the flow of data in them that is composable, extendable and relatively easy to reason about. It simplifies refactors and maintenance and makes roundtrips easy to account. They are compatible with caching, different architectures. Just get an ID and promise to give what it corresponds to when you ask for it.
Microservices make database joins either redundant application level job or very difficult application level job depending on whether you are designing the microservice or are using it. Even though joins may be impossible you need to tie data together - that's why you use knots. A knot may tie several things together, it may even tie one knot to another.
In design patterns parlance knot is just your run of the mill lazily instantiated facade proxy for data transfer that you can observe when you have to. Except it is not! It is a knot.
Just have an id and you will get it.
And once you get it - keep it knotted together.
Similar to Creating a Facebook Clone - Part XX - Transcript.pdf (20)
The Duck Teaches Learn to debug from the masters. Local to production- kill ...ShaiAlmog1
The document outlines an agenda for a workshop on debugging techniques. The workshop covers installing tools, flow and breakpoints debugging, watching variables, Kubernetes debugging, and developer observability. Key techniques discussed include tracepoints, memory debugging, exception breakpoints, object marking, and logs, snapshots, and metrics for observability. The goal is to teach practical debugging skills that can be applied at scale in production environments like Kubernetes.
The document describes code for implementing the server-side functionality of a WhatsApp clone. It includes classes for representing users, messages, and server connections. The Server class initializes user and message data from files, handles login/signup, and establishes a websocket connection for real-time messaging. It can send and receive messages when connected, or queue messages when offline.
[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.
This talk will cover ScyllaDB Architecture from the cluster-level view and zoom in on data distribution and internal node architecture. In the process, we will learn the secret sauce used to get ScyllaDB's high availability and superior performance. We will also touch on the upcoming changes to ScyllaDB architecture, moving to strongly consistent metadata and tablets.
"NATO Hackathon Winner: AI-Powered Drug Search", Taras KlobaFwdays
This is a session that details how PostgreSQL's features and Azure AI Services can be effectively used to significantly enhance the search functionality in any application.
In this session, we'll share insights on how we used PostgreSQL to facilitate precise searches across multiple fields in our mobile application. The techniques include using LIKE and ILIKE operators and integrating a trigram-based search to handle potential misspellings, thereby increasing the search accuracy.
We'll also discuss how the azure_ai extension on PostgreSQL databases in Azure and Azure AI Services were utilized to create vectors from user input, a feature beneficial when users wish to find specific items based on text prompts. While our application's case study involves a drug search, the techniques and principles shared in this session can be adapted to improve search functionality in a wide range of applications. Join us to learn how PostgreSQL and Azure AI can be harnessed to enhance your application's search capability.
"Frontline Battles with DDoS: Best practices and Lessons Learned", Igor IvaniukFwdays
At this talk we will discuss DDoS protection tools and best practices, discuss network architectures and what AWS has to offer. Also, we will look into one of the largest DDoS attacks on Ukrainian infrastructure that happened in February 2022. We'll see, what techniques helped to keep the web resources available for Ukrainians and how AWS improved DDoS protection for all customers based on Ukraine experience
AppSec PNW: Android and iOS Application Security with MobSFAjin Abraham
Mobile Security Framework - MobSF is a free and open source automated mobile application security testing environment designed to help security engineers, researchers, developers, and penetration testers to identify security vulnerabilities, malicious behaviours and privacy concerns in mobile applications using static and dynamic analysis. It supports all the popular mobile application binaries and source code formats built for Android and iOS devices. In addition to automated security assessment, it also offers an interactive testing environment to build and execute scenario based test/fuzz cases against the application.
This talk covers:
Using MobSF for static analysis of mobile applications.
Interactive dynamic security assessment of Android and iOS applications.
Solving Mobile app CTF challenges.
Reverse engineering and runtime analysis of Mobile malware.
How to shift left and integrate MobSF/mobsfscan SAST and DAST in your build pipeline.
The Department of Veteran Affairs (VA) invited Taylor Paschal, Knowledge & Information Management Consultant at Enterprise Knowledge, to speak at a Knowledge Management Lunch and Learn hosted on June 12, 2024. All Office of Administration staff were invited to attend and received professional development credit for participating in the voluntary event.
The objectives of the Lunch and Learn presentation were to:
- Review what KM ‘is’ and ‘isn’t’
- Understand the value of KM and the benefits of engaging
- Define and reflect on your “what’s in it for me?”
- Share actionable ways you can participate in Knowledge - - Capture & Transfer
QR Secure: A Hybrid Approach Using Machine Learning and Security Validation F...AlexanderRichford
QR Secure: A Hybrid Approach Using Machine Learning and Security Validation Functions to Prevent Interaction with Malicious QR Codes.
Aim of the Study: The goal of this research was to develop a robust hybrid approach for identifying malicious and insecure URLs derived from QR codes, ensuring safe interactions.
This is achieved through:
Machine Learning Model: Predicts the likelihood of a URL being malicious.
Security Validation Functions: Ensures the derived URL has a valid certificate and proper URL format.
This innovative blend of technology aims to enhance cybersecurity measures and protect users from potential threats hidden within QR codes 🖥 🔒
This study was my first introduction to using ML which has shown me the immense potential of ML in creating more secure digital environments!
Conversational agents, or chatbots, are increasingly used to access all sorts of services using natural language. While open-domain chatbots - like ChatGPT - can converse on any topic, task-oriented chatbots - the focus of this paper - are designed for specific tasks, like booking a flight, obtaining customer support, or setting an appointment. Like any other software, task-oriented chatbots need to be properly tested, usually by defining and executing test scenarios (i.e., sequences of user-chatbot interactions). However, there is currently a lack of methods to quantify the completeness and strength of such test scenarios, which can lead to low-quality tests, and hence to buggy chatbots.
To fill this gap, we propose adapting mutation testing (MuT) for task-oriented chatbots. To this end, we introduce a set of mutation operators that emulate faults in chatbot designs, an architecture that enables MuT on chatbots built using heterogeneous technologies, and a practical realisation as an Eclipse plugin. Moreover, we evaluate the applicability, effectiveness and efficiency of our approach on open-source chatbots, with promising results.
QA or the Highway - Component Testing: Bridging the gap between frontend appl...zjhamm304
These are the slides for the presentation, "Component Testing: Bridging the gap between frontend applications" that was presented at QA or the Highway 2024 in Columbus, OH by Zachary Hamm.
Northern Engraving | Modern Metal Trim, Nameplates and Appliance PanelsNorthern Engraving
What began over 115 years ago as a supplier of precision gauges to the automotive industry has evolved into being an industry leader in the manufacture of product branding, automotive cockpit trim and decorative appliance trim. Value-added services include in-house Design, Engineering, Program Management, Test Lab and Tool Shops.
LF Energy Webinar: Carbon Data Specifications: Mechanisms to Improve Data Acc...DanBrown980551
This LF Energy webinar took place June 20, 2024. It featured:
-Alex Thornton, LF Energy
-Hallie Cramer, Google
-Daniel Roesler, UtilityAPI
-Henry Richardson, WattTime
In response to the urgency and scale required to effectively address climate change, open source solutions offer significant potential for driving innovation and progress. Currently, there is a growing demand for standardization and interoperability in energy data and modeling. Open source standards and specifications within the energy sector can also alleviate challenges associated with data fragmentation, transparency, and accessibility. At the same time, it is crucial to consider privacy and security concerns throughout the development of open source platforms.
This webinar will delve into the motivations behind establishing LF Energy’s Carbon Data Specification Consortium. It will provide an overview of the draft specifications and the ongoing progress made by the respective working groups.
Three primary specifications will be discussed:
-Discovery and client registration, emphasizing transparent processes and secure and private access
-Customer data, centering around customer tariffs, bills, energy usage, and full consumption disclosure
-Power systems data, focusing on grid data, inclusive of transmission and distribution networks, generation, intergrid power flows, and market settlement data
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).
Must Know Postgres Extension for DBA and Developer during MigrationMydbops
Mydbops Opensource Database Meetup 16
Topic: Must-Know PostgreSQL Extensions for Developers and DBAs During Migration
Speaker: Deepak Mahto, Founder of DataCloudGaze Consulting
Date & Time: 8th June | 10 AM - 1 PM IST
Venue: Bangalore International Centre, Bangalore
Abstract: Discover how PostgreSQL extensions can be your secret weapon! This talk explores how key extensions enhance database capabilities and streamline the migration process for users moving from other relational databases like Oracle.
Key Takeaways:
* Learn about crucial extensions like oracle_fdw, pgtt, and pg_audit that ease migration complexities.
* Gain valuable strategies for implementing these extensions in PostgreSQL to achieve license freedom.
* Discover how these key extensions can empower both developers and DBAs during the migration process.
* Don't miss this chance to gain practical knowledge from an industry expert and stay updated on the latest open-source database trends.
Mydbops Managed Services specializes in taking the pain out of database management while optimizing performance. Since 2015, we have been providing top-notch support and assistance for the top three open-source databases: MySQL, MongoDB, and PostgreSQL.
Our team offers a wide range of services, including assistance, support, consulting, 24/7 operations, and expertise in all relevant technologies. We help organizations improve their database's performance, scalability, efficiency, and availability.
Contact us: info@mydbops.com
Visit: https://www.mydbops.com/
Follow us on LinkedIn: https://in.linkedin.com/company/mydbops
For more details and updates, please follow up the below links.
Meetup Page : https://www.meetup.com/mydbops-databa...
Twitter: https://twitter.com/mydbopsofficial
Blogs: https://www.mydbops.com/blog/
Facebook(Meta): https://www.facebook.com/mydbops/
"Scaling RAG Applications to serve millions of users", Kevin GoedeckeFwdays
How we managed to grow and scale a RAG application from zero to thousands of users in 7 months. Lessons from technical challenges around managing high load for LLMs, RAGs and Vector databases.
"Scaling RAG Applications to serve millions of users", Kevin Goedecke
Creating a Facebook Clone - Part XX - Transcript.pdf
1. Creating a Facebook Clone - Part XX
Notification is the last client data class that maps to an entity. In that sense it will get more interesting after this point…
2. @Entity
public class Notification {
@Id
private String id;
@ManyToOne
private User user;
private String text;
private String reaction;
private int reactionColor;
private long date;
private boolean wasRead;
private String postId;
private String commentId;
public Notification() {
id = UUID.randomUUID().toString();
}
public NotificationDAO getDAO() {
return new NotificationDAO(id, user.getDAO(), text, reaction,
reactionColor, date, wasRead, postId, commentId);
Notification
The class is pretty standard
Again these map directly to the client side data
3. @Entity
public class Notification {
@Id
private String id;
@ManyToOne
private User user;
private String text;
private String reaction;
private int reactionColor;
private long date;
private boolean wasRead;
private String postId;
private String commentId;
public Notification() {
id = UUID.randomUUID().toString();
}
public NotificationDAO getDAO() {
return new NotificationDAO(id, user.getDAO(), text, reaction,
reactionColor, date, wasRead, postId, commentId);
Notification
A notification might relate to a post or a comment so having its id here might be useful to launch said post when the notification is clicked
4. private long date;
private boolean wasRead;
private String postId;
private String commentId;
public Notification() {
id = UUID.randomUUID().toString();
}
public NotificationDAO getDAO() {
return new NotificationDAO(id, user.getDAO(), text, reaction,
reactionColor, date, wasRead, postId, commentId);
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public User getUser() {
return user;
}
public void setUser(User user) {
this.user = user;
}
Notification
The constructor and DAO match the convention of the other classes
5. public long getDate() {
return date;
}
public void setDate(long date) {
this.date = date;
}
public boolean isWasRead() {
return wasRead;
}
public void setWasRead(boolean wasRead) {
this.wasRead = wasRead;
}
public String getPostId() {
return postId;
}
public void setPostId(String postId) {
this.postId = postId;
}
public String getCommentId() {
return commentId;
}
public void setCommentId(String commentId) {
this.commentId = commentId;
}
}
Notification
The rest is again getters & setters
6. public class NotificationDAO {
private String id;
private UserDAO user;
private String text;
private String reaction;
private int reactionColor;
private long date;
private boolean wasRead;
private String postId;
private String commentId;
public NotificationDAO() {
}
public NotificationDAO(String id, UserDAO user, String text,
String reaction, int reactionColor, long date, boolean wasRead,
String postId, String commentId) {
this.id = id;
this.user = user;
this.text = text;
this.reaction = reaction;
NotificationDAO
The next step is the DAO which again maps very closely.
There is literally nothing special here, we might as well have used the Notification entity to some degree.
7. return date;
}
public void setDate(long date) {
this.date = date;
}
public boolean isWasRead() {
return wasRead;
}
public void setWasRead(boolean wasRead) {
this.wasRead = wasRead;
}
public String getPostId() {
return postId;
}
public void setPostId(String postId) {
this.postId = postId;
}
public String getCommentId() {
return commentId;
}
public void setCommentId(String commentId) {
this.commentId = commentId;
}
}
NotificationDAO
As you can see the rest of the code is classic boilerplate
9. @Entity
public class Newsfeed {
@Id
@GeneratedValue(strategy=GenerationType.AUTO)
private Long id;
@ManyToOne
private User parent;
@ManyToOne
private Post entry;
private long postDay;
private long postTimestamp;
private int rank;
public Newsfeed() {
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
Newsfeed
This is getting a bit more interesting... Newsfeed represents the feed for a user. I could have just created a really complex join query on Post and called it a day but that's
problematic. The newsfeed isn't just a list of posts based on date. It's something that includes a complex algorithm behind it. Running that algorithm every time the user
pages through data might be very expensive.
Furthermore, changes to the algorithm shouldn't impact past placements. We'd want consistency and we'd also like to have a log of "what did the user see". In that
sense constructing the newsfeed as an entity in its own right makes a lot of sense.
We can place the articles into the newsfeed using a sort order that makes sense for a specific user without impacting everyone. We can tune and experiment with article
placement algorithms easily because our processing can be done offline on the table itself.
We use an auto-increment numeric id since this object isn't exposed to the client side at any stage the id doesn't matter as much and this id type is faster
10. @Entity
public class Newsfeed {
@Id
@GeneratedValue(strategy=GenerationType.AUTO)
private Long id;
@ManyToOne
private User parent;
@ManyToOne
private Post entry;
private long postDay;
private long postTimestamp;
private int rank;
public Newsfeed() {
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
Newsfeed
Every entry within the newsfeed has a user & post. Notice that the user is probably a different user from the one who submitted the post
11. @Entity
public class Newsfeed {
@Id
@GeneratedValue(strategy=GenerationType.AUTO)
private Long id;
@ManyToOne
private User parent;
@ManyToOne
private Post entry;
private long postDay;
private long postTimestamp;
private int rank;
public Newsfeed() {
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
Newsfeed
postDay is the number of days since epoch. This is useful for sorting, I want todays posts to always come before yesterdays posts even if they are higher quality
12. @Entity
public class Newsfeed {
@Id
@GeneratedValue(strategy=GenerationType.AUTO)
private Long id;
@ManyToOne
private User parent;
@ManyToOne
private Post entry;
private long postDay;
private long postTimestamp;
private int rank;
public Newsfeed() {
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
Newsfeed
Timestamp is also used for the sort but to a lesser degree
13. @Entity
public class Newsfeed {
@Id
@GeneratedValue(strategy=GenerationType.AUTO)
private Long id;
@ManyToOne
private User parent;
@ManyToOne
private Post entry;
private long postDay;
private long postTimestamp;
private int rank;
public Newsfeed() {
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
Newsfeed
Rank can be manipulated by a ranking algorithm to push good posts up within the day
14. private User parent;
@ManyToOne
private Post entry;
private long postDay;
private long postTimestamp;
private int rank;
public Newsfeed() {
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public User getParent() {
return parent;
}
public void setParent(User parent) {
this.parent = parent;
}
public Post getEntry() {
return entry;
}
Newsfeed
We have no DAO. We don't need it, this is a server side object
15. return entry;
}
public void setEntry(Post entry) {
this.entry = entry;
}
public int getRank() {
return rank;
}
public void setRank(int rank) {
this.rank = rank;
}
public long getPostDay() {
return postDay;
}
public void setPostDay(long postDay) {
this.postDay = postDay;
}
public long getPostTimestamp() {
return postTimestamp;
}
public void setPostTimestamp(long postTimestamp) {
this.postTimestamp = postTimestamp;
}
}
Newsfeed
We do need the getters/setters though for the entity
16. public interface NewsfeedRepository extends CrudRepository<Newsfeed, Long>{
@Query("select n from Newsfeed n where n.parent.authtoken = ?1")
public Page<Newsfeed> findNewsfeedForUser(
String auth, Pageable page);
}
NewsfeedRepository
The Newsfeed also requires a CrudRepository class. We need to use the auth and not the ID to prevent a case where another user gets a peek at my feed which might
include "friend only" posts
With that we only have one more item...
17. @Entity
public class ShadowUser {
@Id
@GeneratedValue(strategy=GenerationType.AUTO)
private Long id;
private String fullName;
private String phone;
private String email;
private String secondaryPhone;
@ManyToOne
private User owner;
public ShadowUser() {
}
public ShadowUser(ShadowUserDAO dao, User owner) {
this.fullName = dao.getFullName();
this.phone = dao.getPhone();
this.email = dao.getEmail();
this.secondaryPhone = dao.getSecondaryPhone();
ShadowUser
The shadow user is a "potential" user of whom we have knowledge but he might not be in the social network.
Do you ever wonder how Facebook seems to know so much about you before you even signed up? They keep suggesting people that they can't possibly know about...
Well, here's one of the tricks they use. When you agree to synchronize your contacts to Facebook (and they nag a lot about this) they upload the whole thing and store it.
If you have friends that are already in Facebook you'll get suggestions instantly but they keep everything anyway.
When one of your contacts signs up for Facebook they notice that you know and instantly add a suggestion. This works in reverse too, someone has your email or phone
number so you'd see them as a suggestion.
They go even further by associations e.g. you might have a connection like that through a 3rd party so even if you never synchronized contacts they'd still know.
I chose to implement a relatively simple version of this and didn't include all the meta-data that Facebook probably stores. This is mostly a simple proof of concept that
should be enough for us to provide friend suggestions.
We again use auto-increment for an internal entity
18. @Entity
public class ShadowUser {
@Id
@GeneratedValue(strategy=GenerationType.AUTO)
private Long id;
private String fullName;
private String phone;
private String email;
private String secondaryPhone;
@ManyToOne
private User owner;
public ShadowUser() {
}
public ShadowUser(ShadowUserDAO dao, User owner) {
this.fullName = dao.getFullName();
this.phone = dao.getPhone();
this.email = dao.getEmail();
this.secondaryPhone = dao.getSecondaryPhone();
ShadowUser
This is the meta-data we gather for a user, there is obviously a lot more we can gather
19. @Entity
public class ShadowUser {
@Id
@GeneratedValue(strategy=GenerationType.AUTO)
private Long id;
private String fullName;
private String phone;
private String email;
private String secondaryPhone;
@ManyToOne
private User owner;
public ShadowUser() {
}
public ShadowUser(ShadowUserDAO dao, User owner) {
this.fullName = dao.getFullName();
this.phone = dao.getPhone();
this.email = dao.getEmail();
this.secondaryPhone = dao.getSecondaryPhone();
ShadowUser
This is the user who uploaded the data so if the data in this record matches me then I probably know the owner
20. @Id
@GeneratedValue(strategy=GenerationType.AUTO)
private Long id;
private String fullName;
private String phone;
private String email;
private String secondaryPhone;
@ManyToOne
private User owner;
public ShadowUser() {
}
public ShadowUser(ShadowUserDAO dao, User owner) {
this.fullName = dao.getFullName();
this.phone = dao.getPhone();
this.email = dao.getEmail();
this.secondaryPhone = dao.getSecondaryPhone();
this.owner = owner;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
ShadowUser
We have a DAO object but this DAO is write only. So the entity isn't exposed to the outside world but the outside world is exposed to the entity. That’s why we don’t have
a getDAO method!
We do have a special constructor type that makes adding a new ShadowUser easier.
21. public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getSecondaryPhone() {
return secondaryPhone;
}
public void setSecondaryPhone(String secondaryPhone) {
this.secondaryPhone = secondaryPhone;
}
public User getOwner() {
return owner;
}
public void setOwner(User owner) {
this.owner = owner;
}
}
ShadowUser
As with the other entities the rest is just setters & getters.
22. public class ShadowUserDAO {
private String fullName;
private String phone;
private String email;
private String secondaryPhone;
public ShadowUserDAO() {
}
public String getFullName() {
return fullName;
}
public void setFullName(String fullName) {
this.fullName = fullName;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public String getEmail() {
return email;
ShadowUserDAO
In a sense the ShadowUserDAO is a bit different from the other DAO’s.
This is a pretty standard DAO with two big omissions: ID & Owner both of which are missing…
The ID is redundant as it's auto generated, the owner is also redundant as it's always the user that uploaded the contacts. There is no point of including either one of
these values in the DAO as they won't arrive through it from the client.
23. return fullName;
}
public void setFullName(String fullName) {
this.fullName = fullName;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getSecondaryPhone() {
return secondaryPhone;
}
public void setSecondaryPhone(String secondaryPhone) {
this.secondaryPhone = secondaryPhone;
}
}
ShadowUserDAO
The rest of the DAO is just getters and setters
24. public interface ShadowUserRepository extends
CrudRepository<ShadowUser, Long> {
@Query("select n from ShadowUser n where n.owner.authtoken = ?1")
public List<ShadowUser> findShadowUsers(String auth);
@Query("select n from ShadowUser n where n.phone = ?1 or "
+ "n.secondaryPhone = ?1")
public List<ShadowUser> findByPhone(String phone);
@Query("select n from ShadowUser n where n.email = ?1")
public List<ShadowUser> findByEmail(String email);
@Query("select count(n) from ShadowUser n where "
+ "n.owner.authtoken = ?1")
public Long countByUser(String auth);
@Query("select n from ShadowUser n where n.owner.authtoken = ?1 and "
+ "n.fullName = ?2")
public List<ShadowUser> findByFullName(String auth, String fullName);
}
ShadowUserRepository
In this case the CrudRepository is actually pretty interesting. We need it for the case where we create a new user or update data. We need to find all the related users.
Given a users phone we look through the database for users who might have that phone in their contacts, the same is true for email
25. public interface ShadowUserRepository extends
CrudRepository<ShadowUser, Long> {
@Query("select n from ShadowUser n where n.owner.authtoken = ?1")
public List<ShadowUser> findShadowUsers(String auth);
@Query("select n from ShadowUser n where n.phone = ?1 or "
+ "n.secondaryPhone = ?1")
public List<ShadowUser> findByPhone(String phone);
@Query("select n from ShadowUser n where n.email = ?1")
public List<ShadowUser> findByEmail(String email);
@Query("select count(n) from ShadowUser n where "
+ "n.owner.authtoken = ?1")
public Long countByUser(String auth);
@Query("select n from ShadowUser n where n.owner.authtoken = ?1 and "
+ "n.fullName = ?2")
public List<ShadowUser> findByFullName(String auth, String fullName);
}
ShadowUserRepository
We check if a user has uploaded contacts in the past by counting his entries, assuming he has we will try to merge the data
26. public interface ShadowUserRepository extends
CrudRepository<ShadowUser, Long> {
@Query("select n from ShadowUser n where n.owner.authtoken = ?1")
public List<ShadowUser> findShadowUsers(String auth);
@Query("select n from ShadowUser n where n.phone = ?1 or "
+ "n.secondaryPhone = ?1")
public List<ShadowUser> findByPhone(String phone);
@Query("select n from ShadowUser n where n.email = ?1")
public List<ShadowUser> findByEmail(String email);
@Query("select count(n) from ShadowUser n where "
+ "n.owner.authtoken = ?1")
public Long countByUser(String auth);
@Query("select n from ShadowUser n where n.owner.authtoken = ?1 and "
+ "n.fullName = ?2")
public List<ShadowUser> findByFullName(String auth, String fullName);
}
ShadowUserRepository
We use the full name of the user when merging contact data.
With that we finished all the entities and we are finally ready to move up the food chain to the service layer!