Friday, August 30, 2019

Monorepo :

A syllabic abbreviation for "Monolithic Repository".

        A monorepo is a software development strategy where code for many projects are stored in the same repository.

Definitions vary, but we define a monorepo as follows:

  • The repositorycontains more than one logical project. (e.g. an iOS client and a web application)
  • These projects are most likely unrelated , loosely conected or can be connected by other means (e.g. via dependency management tools)

 The repository is large in many ways:
           Number of commits
                  Number of branches and/or tags
                  Number of files tracked
                  Size of content tracked (as measured by looking at the .git directory of the repository) 




Google, Facebook ,Twitter, Uber, Microsoft and many well recognized companies use big monorepos.


Pros

  • Ease of Code reuse
  • Simplified dependency management
  • Atomic level commits
  • Large Scale code refactoring
  • Collaboration across teams

Cons

   •                  Loss of version information

   •                  Lack of per-project security

   •                  More storage needed



References:


    https://www.atlassian.com/git/tutorials/monorepos



Best Learning Resources for Developers

A collection of online learning resources
1. HTML/CSS
            bhttps://css-tricks.com/
2. JavaScript
          c. https://es6.io/
3. PHP  
4. IOT / Electronics
          ahttps://www.adafruit.com
          bhttps://www.sparkfun.com/
5Machine learning

   6. Other common resources

                            ~ End ~

Saturday, August 17, 2019

Issue related with Infinite Recursive fetching of data from relationships between Entity classes (Spring Boot JPA Hibernate)


This article is all about how to avoid recursive fetching of data from relationships designed in Database. I’ll explain everything with an example so that you will all understand clearly. Here I’m working with Intellij IDEA and MySQL databases.
1.1 Brief about the tables and the relationship used
Here in my example, I have created two Entity classes and they are connected with a OnetoMany relationship.




One student can have more than one email and this is the scenario taken. StudentId in ContactModel refers to the id field in StudentModel and This is a OnetoMany relationship. StudentModel is the “One” side and ContactModel is the “Many” side.
1.2 The classes before resolving the error
How the Entity classes are designed in Spring boot is given below in images.



StudentModel.java
ContactModel.java

1.3 Issue looks like this
Some data is included in the database and I have run some queries to fetch the data from the contact table.This is how it appears after fetching data,




This is an infinite recursion. This is the issue after designing the entity classes as above.
1.4 How to solve
There are many annotations such as @JsonManagedReference, @JsonBackReference, @JsonIgnore etc, to avoid this infinite recursion.But, when used them creates some errors in fetching and inserting data from and to the entities.
After searching a lot in internet and trying a lot, I came across the best way to solve this. It’s very simple.I used only to one annotation in the One side of the relationship.
@JsonIgnoreProperties
This annotation ignores the fields from Jsonification. You need to use this in class level as below,




Actually when fetching data from StudentModel, you don’t need to fetch data from the field “contact”. So, I have asked to ignore that field . This annotation take the ignoring fields in a String array.So you need to give the field-names in an String array as above.
Note: You need to ignore two more fields, “hibernateLazyInitializer”, “handler”, otherwise it gives an error message like this when fetching data
“No serializer found for class org.hibernate.proxy.pojo.bytebuddy.ByteBuddyInterceptor and no properties discovered to create BeanSerializer (to avoid exception, disable SerializationFeature.FAIL_ON_EMPTY_BEANS) (through reference chain: java.util.ArrayList[0]->com.project.inventoryManagement.Models.ContactModel[\”student\”]->com.project.inventoryManagement.Models.StudentModel$HibernateProxy$bYhYXmwK[\”hibernateLazyInitializer\”])”
Happy Coding without bugs!
Thank you.

Send Emails without a server-side code with Angular

Without any server-side code hosted on a server, you can send emails through your Angular application with smtpJS, a client-side Javasc...