Java Hyd Team
746 subscribers
986 photos
39 videos
670 files
690 links
https://teamhydteam.my.canva.site/

Can visit us on our website ๐Ÿ˜Š
Still working on it ๐Ÿ˜Š
Download Telegram
Printwriter is what kind of stream in java

PrintWriter is an output stream for writing characters to a text-output stream, such as a file or a StringWriter. It implements all of the print methods found in PrintStream, but it does not contain any methods for writing raw bytes.
What returns output stream in Java

In Java, the output stream is an object that can be used to write data to a destination, such as a file or another output stream. Output streams are created using classes in the Java I/O package, such as FileOutputStream, BufferedOutputStream, and PrintStream.
What is session tracking in servlet

Session tracking is a process that servlets use to maintain state about a series of requests from the same user (that is, requests originating from the same browser) across some period of time. In session tracking, a servlet can associate information with a particular userโ€™s session. This information can include data such as name, address, items in the userโ€™s shopping cart, and so on. A session typically corresponds to one visit to a Web site and is maintained as long as the user does not leave the site.
How to coding with java.io package

The Java.io package contains classes and interfaces used for input and output operations in Java. It contains classes for managing files, reading and writing data, and serializing objects.

To begin coding with the Java.io package, you must first import the package using the import statement.

import java.io.*;

Once the package has been imported, you can use various classes and methods contained within the package. Some common examples include:

// Create a file
File file = new File("myfile.txt");

// Read from a file
BufferedReader br = new BufferedReader(new FileReader(file));
String line;
while((line = br.readLine()) != null) {
// do something with the line
}

// Write to a file
BufferedWriter bw = new BufferedWriter(new FileWriter(file));
bw.write("Hello world!");
bw.close();

// Serialize an object
ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream("myobject.ser"));
oos.writeObject(myObject);
oos.close();

// Deserialize an object
ObjectInputStream ois = new ObjectInputStream(new FileInputStream("myobject.ser"));
MyObject myObject = (MyObject) ois.readObject();
ois.close();

These are just a few examples of how to use the Java.io package. For more information, consult the Java documentation.
What is io package in Java?

The io package in Java is a collection of classes for reading and writing data from and to input and output streams. It provides classes for various streams, such as FileInputStream, FileOutputStream, DataInputStream, DataOutputStream, PipedInputStream and PipedOutputStream. The io package also includes classes for reading and writing character data
Java Hyd Team
Transfer String, number, Boolean, json object, number array , String array and array of objects from child component to parent component
Transfer String, number, Boolean, json object, number array , String array and array of objects from child component to parent component React-Js

String:

Child Component:
// This can be sent as props from the child component
const stringData = 'Hello World!';

Parent Component:
// This can be received in the parent component
<ChildComponent stringData={stringData} />

Number:

Child Component:
// This can be sent as props from the child component
const numberData = 123;

Parent Component:
// This can be received in the parent component
<ChildComponent numberData={numberData} />

Boolean:

Child Component:
// This can be sent as props from the child component
const booleanData = true;

Parent Component:
// This can be received in the parent component
<ChildComponent booleanData={booleanData} />

JSON Object:

Child Component:
// This can be sent as props from the child component
const jsonObject = { name: 'John', age: 25 };

Parent Component:
// This can be received in the parent component
<ChildComponent jsonObject={jsonObject} />

Number Array:

Child Component:
// This can be sent as props from the child component
const numberArray = [1, 2, 3, 4, 5];

Parent Component:
// This can be received in the parent component
<ChildComponent numberArray={numberArray} />

String Array:

Child Component:
// This can be sent as props from the child component
const stringArray = ['John', 'Jane', 'James'];

Parent Component:
// This can be received in the parent component
<ChildComponent stringArray={stringArray} />

Array of Objects:

Child Component:
// This can be sent as props from the child component
const arrayObjects = [
{ name: 'John', age: 25 },
{ name: 'Jane', age: 30 },
{ name: 'James', age: 28 },
];

Parent Component:
// This can be received in the parent component
<ChildComponent arrayObjects={arrayObjects} />
Binary streams in java

Binary streams are used for reading and writing binary data, such as images, audio, and video. Binary stream classes are derived from input stream and output stream classes and are used for low-level input and output operations.

The primary binary stream classes in Java are:

InputStream
OutputStream
FileInputStream
FileOutputStream
DataInputStream
DataOutputStream
BufferedInputStream
BufferedOutputStream
ObjectInputStream
ObjectOutputStream
What is character stream in java

Character stream in Java is a type of stream used for reading and writing characters from and to a file, or other sources. Character streams are based on the abstract classes Reader and Writer. Character stream classes are used to perform reading and writing of 2 byte Unicode characters. Examples of character streams include FileReader and FileWriter.
What is character stream in java

Character Streams in Java are classes that allow the reading and writing of characters from and to streams. They are used to perform input and output of 16-bit Unicode characters. The Character Streams are primarily used for internationalization and localization of text-based applications.
When to create character oriented output stream in java

Character-oriented output streams should be used when you need to write data in the form of characters to an output source, such as a file, console, or network connection. Examples include the java.io.Writer and java.io.PrintWriter classes.
When to create character oriented input stream in java

Character oriented input stream can be used when you need to process character-based data, such as text or XML documents. It is useful for reading character data from a file or other source, as well as formatting and writing character data.
Write a java program to store some text into a disk file

import java.io.File;
import java.io.FileWriter;
import java.io.IOException;

public class StoreTextToFile {
public static void main(String[] args) throws IOException {
File file = new File("textfile.txt");
FileWriter writer = new FileWriter(file);
writer.write("This is some random text");
writer.close();
}
}
//Write a java program to store some text into a disk file

import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;

public class WriteToFile {
public static void main(String[] args) {
BufferedWriter bw = null;
try {
String text = "This is some text that will be written to the disk file";
FileWriter fw = new FileWriter("myFile.txt");
bw = new BufferedWriter(fw);
bw.write(text);
System.out.println("Text written to file successfully!");
} catch (IOException ioe) {
ioe.printStackTrace();
} finally {
try {
if (bw != null)
bw.close();
} catch (Exception ex) {
System.out.println("Error in closing the BufferedWriter" + ex);
}
}
}
}
a java program to store text in hard-disk

import java.io.*;

public class TextStorage {
public static void main(String[] args) {
String str = "This is a sample text to be stored in hard-disk";

try {
FileWriter writer = new FileWriter("text.txt");
writer.write(str);
writer.close();
}
catch (IOException e) {
e.printStackTrace();
}
}
}
AGE 30.pdf
1.1 MB
๐Ÿ‘1
7 Interviews while hiring.
0 discussions while firing.

And you expect the employee to be loyal?

Dear Companies,

Once upon a time there was a species called..."Loyal Employee".

You lost him/ her when you fired them while they were driving to work!

That "Loyal Employee" isn't traveling to 2023.
BE LOYAL TO YOURSELF THAT'S MORE THAN ENOUGH
ALGORITHM YOU SHOULD KNOW for PREPARING SYSTEM DESIGN INTERVIEW ๐Ÿ’ก

๐Ÿ”บREQUIREMENTS :-
KNOW WHEN TO USE
KNOW HOW IT WORKS

โ—พ1) BLOOM FILTER
It is a data structure designed to tell you, rapidly and memory-efficiently, whether an element is present in a set.
- use case :: Build a Web crawler

โ—พ2) FRUGAL STREAMING
It uses only one unit of memory per group to compute a quantile for each group.
-use case :: Find the nth percentile of the data stream.

โ—พ3) GEOHASH/ S2 GEOMETRY
A collection of efficient yet exact mathematical predicates for testing relationships among geometric primitives.
-use case :: Location-based search results with DynamoDb and Geohash.

โ—พ4) HYPERLOGLOG
It is an algorithm for the count-distinct problem, approximating the number of distinct elements in a multiset.
-use case :: privacy-preserving traffic heat map for the city.

โ—พ5) LEAKY BUCKET/ TOKEN BUCKET
A mechanism to control the amount and the rate of the traffic sent to the network.
-use case :: Design a scalable rate-limiting algorithm.

โ—พ6) LOSSY COUNT
It is used to identify elements in a data stream whose frequency count exceeds a user-given threshold.
-use case :: Frequency count over the data streams.

โ—พ7) OPERATIONAL TRANSFORMATION
It is used for supporting a range of collaboration functionalities in advanced collaborative software systems.
-use case :: Handling editing collision in Google docs.

โ—พ8) QUADTREE/ RTREE
It is a two-dimensional analog of octrees and is most often used to partition a two-dimensional space by recursively subdividing it into four quadrants or regions.
-use case :: Find nearby interest points

โ—พ9) RAY CASTING
It is the most basic of many computer graphics rendering algo that uses geometric algo of ray tracing.
-use case :: Using longitude and latitude, return the Country of the point.

โ—พ10) REVERSE INDEX
It is an index of keywords that stores records of documents that contain keywords in the list.
-use case: Building a complete Tweet index.

โ—พ11) RSYNC ALGORITHM
Used for reducing the cost of a file transfer by avoiding the transfer of blocks that are already at the destination.
-use case :: Streaming file Sync

โ—พ12) TRIE ALGORITHM
Trie is an efficient information reTrieval data structure. Using Trie, search complexities can be brought to optimal limit (key length)
-use case :: Autocomplete features using Trie

13) STRING BUFFER
-use case ::  Banking transactions because it follows thread synchronisation

13) STRING BUILDER
-use case ::  BOOKMYSHOW OR IRCTC ticket booking because it NOT following thread synchronisation


collab credit - windsoon / ansh /Aman

#software #design #google #systemdesign #backend #backenddeveloper #softwareengineer #algorithms