Posts

Showing posts from November, 2023

Agile Scrum Method

Agile is an iterative and incremental approach to software development that emphasizes flexibility, collaboration, and customer feedback. It involves breaking projects into small increments called "sprints," which typically last from one to four weeks. This methodology prioritizes delivering working software frequently, often every few weeks, and encourages adaptability to changing requirements throughout the development process. Agile teams collaborate closely with stakeholders, continuously refining and improving the product based on feedback and evolving needs. Scrum is agile framework for managing and organising work especially in software development. It provides a way for team to collaborate and deliver high value product iteratively. Key concepts Sprint Development cycle in scrum are called sprint. Those are short periods (mostly two week ) where shippable product increments are created. Artifacts Product Backlog: A prioritised list of features, enhancements and bug fi...

Supportive References

  Jenkins https://www.youtube.com/watch?v=6YZvp2GwT0A https://www.youtube.com/watch?v=Ri-URt8gPCk Functional Programming Martin Odersky https://www.youtube.com/watch?v=W2dCFq7MplE Machine Learning https://www.youtube.com/watch?v=4UJelID_ICw Scrum https://www.youtube.com/watch?v=XU0llRltyFM https://www.youtube.com/watch?v=vuBFzAdaHDY https://www.youtube.com/watch?v=GR9-8lOUhwA WPS Office Complete office suite with PDF editor https://in.docworkspace.com/d/sIPawuo2wAZHQkasG https://kso.page.link/wps

Shortcuts

Shortcuts in IntelliJ psvm - public static void main(String[] args) sout - System.out.println() fori - for loop iter - enhanced for loop ifn - if null inn - if not null else - else statement try - try-catch block thr - throw new exception sysout - System.out.println() syserr - System.err.println() psf - public static final psfi - public static final int psfs - public static final String newc - create new class newi - create new interface

Git

Image
  Git is distributed version control system which is free and open source software (FOSS). It is a tool to track the changes in the code. We save an initial version of code in the git and then update over the time. We can look back all the changes done so far. Github is the website to host the repositories online. Once we have made changes local repository on the computer and ready to put in git, we need to tell git to track them through add command, save file through commit command and then upload the changes to remote repository using push command. Thus we can keep track the version history and also isolate the changes. SSH (Secure SHell protocol is used for authentication and it is secure and convenient way to log into remote servers) keys need to be generated which consists of pair of keys, private and public keys. Public key is shared with the world via GitHub while the private key is kept secured on one's computer. When we try to connect with GitHub, SSH client provides priv...

Servlet

Servlet is java server side technology, which processes the request from the client. To create a servlet we have to either extend Generic Servlet and override its service method or extend HttpServlet if its is web application and override doPost or doGet Methods. When a request from the client maps the servlet url , the container checks whether the servlet instance is already created. If not, it loads the servlet and creates the object, instantiates it by calling  init   method . Then calls the service method. Between each request it calls the  service   method . when the application is closed, container calls  destroy method .  There are listeners such as web context , session etc that monitor the life cycle of the servlet and react by calling a method of listener object when an event occurs. The container responds to the servlet exceptions by generating a default page showing Servlet Exception occurred.  But we can specify the error page. An example ...

Generating PDF Document Using iText

Image
iText is an open source library that allows programmers to create and manipulate PDF.  It enhances applications with dynamic PDF document generation or manipulation.  iText is available in Java,Dot Net and Android.  Download the itext core binary from the web page  http://sourceforge.net/projects/itext/ .  Create a new Java project in Eclipse and ass iText library (jar file) to your class path. import java.io.FileOutputStream ; import java.util.ArrayList ; import com.itextpdf.text.Document ; import com.itextpdf.text.DocumentException ; import com.itextpdf.text.Element ; import com.itextpdf.text.Font ; import com.itextpdf.text.Paragraph ; import com.itextpdf.text.Phrase ; import com.itextpdf.text.pdf.PdfPCell ; import com.itextpdf.text.pdf.PdfPTable ; import com.itextpdf.text.pdf.PdfWriter ; public class PdfOutput { // Folder path to store PDF file private static String FILE = "f:/sandhya/OUTPUT/First.pdf" ; private static Font catFont = new Font(Font...

Java Message Service

Image
  The Java Message Service is an API that allows applications to create,send,receive and read messages.It enables communication loosely coupled and Asynchronous i.e. JMS provider deliver message to a client as they arrive and also reliable in the sense that it delivers the message only once. Parts of JMS Application JMS Client: Programs that receive and send messages. Non-JMS clients: Clients that use message system's native API instead of JMS. Messages: Information that is used to communicate between its clients. JMS Provider: MOM (Message Oriented Middleware) that implements JMS API Administered Objects: Objects created by administrator for the use of clients. These are placed in JNDI namespace by an administrator. They are ConnectionFactory: Object used by the clients to create connection with the provider Destination: Object that client uses to specify the message source and the destination. JMS Messaging Models Point To Point model In this model producer creates and sends the ...

Dynamically Loading A Class

Reflection is the mechanism to look and even modifiy the structure  of a program by providing a window into the fundamentals of a  language (classes,methods,fields) via  Java API.  Most of the tools we use works with Reflection. Example: Tomcat looks up the class name in the web.xml file.  Then loads the class dynamically on a web request.  Class.forName(className) loads the class dynamically at runtime if not loaded.  forName initializes the class and returns the Class object which contains  the metadata of the class. Methods are invoked with java.lang.refect.method.invoke(). The first argument is object instance with which the method is invoked.  If the method is static first argument must be null.  Subsequent parameters are method parameters. ArrayList returnList = null; String s = cargo ; // Creating the class with Class cls = Class. forName (className) ; Object obj = cls .newInstance() ; if (! "" .equals(cargo)) { // Class type...

Garbage Collection

 When an object is created, memory will be allocated in the  heap . Heap is memory pool which is accessible for whole application. If memory is not available, JVM does garbage collection so as to allocate memory for the object. Otherwise JVM  generates OutOfMemoryError and quits. Heap is split into different sections called  generations . When an object is created, it is allocated in the  Eden   Space .  If it survives garbage collection, it will be promoted to  Survivor Space . If it live long, it will be allocated to  Tenured Generation  where the garbage collection is less frequent. The fourth is  PermGen  or  Permanent Generation , where objects are not eligible for garbage collection.In java8 this is replaced with  Metaspace . Garbage  collection is the mechanism of retrieving the memory which is already allocated to an object and no longer needed, so that it can be reused. In languages like C/C++, memory ha...

Fluent Interface

 Fluent Interface was coined by Martin Fowler and Eric Evans.This makes code easy to read and is implemented by method chaining. Example: consider a Person class Person.java package com.sandhya ; public class Person { private String name ; private int age ; private double salary ; public Person (String name , int age , double salary) { this . name = name ; this . age = age ; this . salary = salary ; } public void setName (String name) { this . name = name ; } public String getName () { return this . name ; } public void setAge ( int age) { this . age = age ; } public int getAge () { return this . age ; } public void setSalary ( double salary) { this . salary = salary ; } public double getSalary () { return this . salary ; } } PersonBuilder.java package com.sandhya ; public class PersonBuilder { private String nam...

Little-endian And Big-endian

Here is  a program which converts data types written in Java (big endian) to little endian. ProtocolBuffer converts integer to byte array and String to bytes. Using FileHandler class contents are written on a binary file. ProtocolBuffer.java package com ; public class ProtocolBuffer { byte [] content ; int allocated ; int consumed ; public ProtocolBuffer ( int size) { content = new byte [size] ; allocated = size ; consumed = 0 ; } boolean addInteger ( int x) { content [ consumed ++] = ( byte )(x& 255 ) ; content [ consumed ++] = ( byte )((x>> 8 )& 255 ) ; content [ consumed ++] = ( byte )((x>> 16 )& 255 ) ; content [ consumed ++] = ( byte )((x>> 24 )& 255 ) ; return true; } boolean addString (String s) { byte [] arr = s.getBytes() ; int len = arr. length ; for ( int i = 0 ; i < len ; i++) { conte...