In order to create a custom constraint for a bean validator, first you should declare an interface and decorate it with the following annotations: @Target = what it works on @Retention = must be runtime in order to work on runtime @Constraint = the custom validator (if you have createdContinue Reading

1. Hidden form fields Example Basic HTML: <form action=”ServerActionName” method=”post”><input type=”hidden” value=”hidden value let’s say yellow” name=”color” /> </form> The pro is that it is simple and works for simple cases. The con is that everypage must have a form that has a hidden input field in order to moveContinue Reading

Creating a reducer example: let’s say we have a file- account.reducer.ts export function reducer(state, action) { switch (action.type) { case ‘UPDATE_ACCOUNT_STATUS’: return { …state, accountStatus: action.payload }; default: return state; } } Then in another file let’s say app.module.ts we import the reducer for root import { StoreModule } fromContinue Reading

State data can be view data, user information, entity data, user selection or input and any other data that the application tracks .. what to do with so much data??? how to upkeep it ? how to notify it globally? Here comes, NgRx which is a reactive library for angularContinue Reading

A proxy is a wrapper or agent object that is being called by the client to access the real serving object, this is achieved because both the proxy and the real object implement the same interface. Example C++ class IPerson { public: virtual void Drive() = 0; }; class PersonContinue Reading

Creating a simple MySql Table: CREATE TABLE `YairShinar`.`employee` ( `idemployee` INT NOT NULL , `firstname` VARCHAR(45) NULL , `lastname` VARCHAR(45) NULL , PRIMARY KEY (`idemployee`) ); Creating the JPA annotations and imports package com.YairShinar.jpa.entities.Employee; import java.io.Serializable; import javax.persistence.*; @Entity public class Employee implements Serializable { @Id private int idEmployee; privateContinue Reading

JAX-B is the xml modeling for Java. It makes it easier to marshell classes. import javax.xml @XmlRootElement public  class  Book{ private string isbn; }Continue Reading

Object Model Api: The model creates an object in memory thus enabling easy navigation and creation: Example of easy navigating: Java import javax.json.Json; import javax.json.JsonObject; Path file = Paths.get(“book.json”); InputStream stream = Files.newInputStream(file); try(JsonReader reader = Json.createReader(stream)){ JsonArray array= reader.readArray(); for(int i =0 ; i < array.size(); i++){ array.getJsonObject(i).getInt(“id”); }Continue Reading

The Java Message Service (JMS) API is a Java Message Oriented Middleware (MOM) API for sending messages between two or more clients. It is an implementation to handle the Producer-consumer problem in order to create, send, receive, and read messages, It allows the communication between different components of a distributedContinue Reading

A socket connection means that two machines have information about each other’s network location IP Address and TCP port, and that they can send or receive data through the connection. In order to create a socket server: import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.net.ServerSocket; import java.net.Socket; publicContinue Reading