Skip to content

added first c file #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 210 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
210 commits
Select commit Hold shift + click to select a range
552506c
added first c file
cs-hackathon-2022 Apr 2, 2019
5f9ada7
03-april-String object comparison
cs-hackathon-2022 Apr 3, 2019
e4a47e7
Added student class
cs-hackathon-2022 Apr 3, 2019
799d62b
equals method with null handling
cs-hackathon-2022 Apr 4, 2019
ace0e3c
handling ==
cs-hackathon-2022 Apr 4, 2019
d1f3d8c
complete equals method with all conditions
cs-hackathon-2022 Apr 4, 2019
4bfde6a
added new file
sunil-the-coder Apr 5, 2019
8b6d936
Merge branch 'pbatch9' of https://github.com/sunil-linux/javatraining…
cs-hackathon-2022 Apr 5, 2019
346cd6b
equality for car objects
cs-hackathon-2022 Apr 5, 2019
bbb8922
Array of object and packages
cs-hackathon-2022 Apr 6, 2019
fd1b924
mandal commit
cs-hackathon-2022 Apr 6, 2019
8e6f768
pushing your changes
sunil-the-coder Apr 6, 2019
13746a3
static members
cs-hackathon-2022 Apr 9, 2019
d80c1b4
Merge branch 'pbatch9' of https://github.com/sunil-linux/javatraining…
cs-hackathon-2022 Apr 9, 2019
1f7191c
toString for student
cs-hackathon-2022 Apr 9, 2019
f92dfb6
Immutable and init blocks
cs-hackathon-2022 Apr 10, 2019
7c2ec7a
highest salary manager
cs-hackathon-2022 Apr 13, 2019
8976ec9
Sorting managers
cs-hackathon-2022 Apr 13, 2019
ffa67cf
Dependency injection using car and engine + student dateofbirth
cs-hackathon-2022 Apr 13, 2019
d4ee910
abstract class methods
cs-hackathon-2022 Apr 13, 2019
e68964c
Working with interfaces
cs-hackathon-2022 Apr 13, 2019
9d6b837
loose coupling
cs-hackathon-2022 Apr 13, 2019
f84ef83
working with interfaces
cs-hackathon-2022 Apr 13, 2019
076220d
adding remote for bike
cs-hackathon-2022 Apr 13, 2019
a7f331d
basic arithemetic exception
cs-hackathon-2022 Apr 24, 2019
d5b5c80
custom exception for balance
cs-hackathon-2022 Apr 25, 2019
b816e3e
basic file operaitons
cs-hackathon-2022 Apr 25, 2019
b072bd5
directory list with deleting files
cs-hackathon-2022 Apr 25, 2019
e65f9e7
basis
cs-hackathon-2022 Apr 25, 2019
745a013
using reader & inputstream for reading content from file
cs-hackathon-2022 Apr 26, 2019
3f278af
using finally to close the resources
cs-hackathon-2022 Apr 26, 2019
ee75dd9
writing content to file
cs-hackathon-2022 Apr 26, 2019
b5ceea5
copy file
cs-hackathon-2022 Apr 26, 2019
7ad9403
try with resources
cs-hackathon-2022 Apr 29, 2019
d6de3b4
copying big files
cs-hackathon-2022 Apr 29, 2019
f7fc8c2
read line by line data
cs-hackathon-2022 Apr 29, 2019
99471a5
working with primitive type of data
cs-hackathon-2022 Apr 30, 2019
8189186
serialization
cs-hackathon-2022 Apr 30, 2019
5e21c37
Added serialVersionUID
cs-hackathon-2022 May 1, 2019
fc72c9b
inner classes
cs-hackathon-2022 May 1, 2019
6b4178b
nested classes
cs-hackathon-2022 May 1, 2019
f03aa6c
method local inner class
cs-hackathon-2022 May 1, 2019
95d8b49
anonymous classe
cs-hackathon-2022 May 1, 2019
f47455d
anonymous clases with lambda
cs-hackathon-2022 May 1, 2019
b614bb7
shallow copy - clonig
cs-hackathon-2022 May 2, 2019
b785833
deep copy - 1st way
cs-hackathon-2022 May 2, 2019
3192f42
deep copy - 2nd way using clone on contained object
cs-hackathon-2022 May 2, 2019
380e858
string questions
cs-hackathon-2022 May 8, 2019
26ed62f
collection basics
cs-hackathon-2022 May 9, 2019
fe0e65c
set methods
cs-hackathon-2022 May 9, 2019
19fac12
sorting integers
cs-hackathon-2022 May 9, 2019
7631b9a
sorting strings
cs-hackathon-2022 May 9, 2019
89be4f5
using navigable set
cs-hackathon-2022 May 9, 2019
2444a97
map basic methods
cs-hackathon-2022 May 9, 2019
f2ffe39
map default value with get
cs-hackathon-2022 May 9, 2019
2a121e6
using hashmap
cs-hackathon-2022 May 9, 2019
014747b
sorting map keys using treeMap
cs-hackathon-2022 May 9, 2019
1329f78
using forEach loop
cs-hackathon-2022 May 9, 2019
231d8f1
removing object from list
cs-hackathon-2022 May 10, 2019
f5e481d
working with generics
cs-hackathon-2022 May 10, 2019
b1e58ed
sorting using comparable
cs-hackathon-2022 May 10, 2019
2bd6353
sorting using comparator
cs-hackathon-2022 May 10, 2019
4fe0d6d
sorting using lambda
cs-hackathon-2022 May 10, 2019
0b32b99
using iterator
cs-hackathon-2022 May 10, 2019
496f3e3
using map iteration
cs-hackathon-2022 May 10, 2019
47f25eb
using map data structure
cs-hackathon-2022 May 11, 2019
d5a0491
movie service implementation
cs-hackathon-2022 May 11, 2019
57554d3
Writing properties using props store writer
cs-hackathon-2022 May 12, 2019
a2dc5f7
reading properties file properties file
cs-hackathon-2022 May 12, 2019
c0f5593
writing props to xml file
cs-hackathon-2022 May 12, 2019
54caefe
using collections
cs-hackathon-2022 May 12, 2019
c1e4d76
Added map category and service changes for the same
cs-hackathon-2022 May 14, 2019
a5f4e19
1. flat cost calculator basic setup
cs-hackathon-2022 May 14, 2019
db97129
added key/value pair for new params to flat finding logic
cs-hackathon-2022 May 15, 2019
843b77e
extracted logic of distance & travel cost to methods
cs-hackathon-2022 May 15, 2019
d429466
using constants by using keys class
cs-hackathon-2022 May 15, 2019
5815035
using static import feature
cs-hackathon-2022 May 15, 2019
9844917
using enums for constants
cs-hackathon-2022 May 15, 2019
543a00c
Implemented reamaininaining methods of movie service
cs-hackathon-2022 May 17, 2019
9508d98
1. create threads using extends Thread method
cs-hackathon-2022 May 18, 2019
e41ccf4
Threading and DB Test class
cs-hackathon-2022 May 18, 2019
74d6595
Updated Read
sunil-the-coder May 18, 2019
3f162b1
demo
cs-hackathon-2022 May 18, 2019
f1d345a
merge with pbatch9
cs-hackathon-2022 May 18, 2019
451a12f
DB Test with latest mysql version of Ubuntu (5.7)
cs-hackathon-2022 May 18, 2019
b59316d
1. Initial Setup for H2 Spring Boot 2 app
cs-hackathon-2022 May 18, 2019
fe306b3
using thread join method
cs-hackathon-2022 May 20, 2019
8548698
setting name & priority
cs-hackathon-2022 May 20, 2019
4f8e923
waiting for multiple threads using join method
cs-hackathon-2022 May 20, 2019
ba21dbb
using sleep method
cs-hackathon-2022 May 20, 2019
9596bc4
1. JoinAccount with multiple threads
cs-hackathon-2022 May 20, 2019
b51576a
locking on object using synchronized ketyword
cs-hackathon-2022 May 20, 2019
d5ec2be
using sync block
cs-hackathon-2022 May 23, 2019
f9834e9
producer consumer problem using blockingqueue
cs-hackathon-2022 May 24, 2019
932b581
File Search engine without threads
cs-hackathon-2022 May 25, 2019
775f5f1
multithreaded search engine
cs-hackathon-2022 May 25, 2019
244e9be
single thread model using executorservice
cs-hackathon-2022 May 25, 2019
a40d011
using callable threads
cs-hackathon-2022 May 25, 2019
7dbb3de
multiple futures
cs-hackathon-2022 May 25, 2019
1934a41
string splitting using callable threads
cs-hackathon-2022 May 25, 2019
1269265
search-engine using thread pools
cs-hackathon-2022 May 25, 2019
1998dac
interview questions
cs-hackathon-2022 May 25, 2019
a914bc9
working with generic class
cs-hackathon-2022 May 26, 2019
9d0b0ae
Word matching mapping assignment
cs-hackathon-2022 May 26, 2019
bd12e2b
Added comments
cs-hackathon-2022 May 26, 2019
1e1d776
retrieving student details with statement from database
cs-hackathon-2022 May 30, 2019
7c7b865
added steps from mysql
cs-hackathon-2022 May 30, 2019
b707822
add dynamic value to sql query
cs-hackathon-2022 May 31, 2019
0ac167d
add dynamic value to sql query
cs-hackathon-2022 May 31, 2019
97d18f0
using preparedstatement
cs-hackathon-2022 May 31, 2019
11edfa2
ICMPLY-1378 Insert Query
cs-hackathon-2022 Jun 1, 2019
489c377
Update Query
cs-hackathon-2022 Jun 1, 2019
6ddf96f
closing conn and ps using finally block
cs-hackathon-2022 Jun 1, 2019
1c129ef
using autocloseable feature to close resources automatically ( java.17)
cs-hackathon-2022 Jun 1, 2019
0cee0c3
Book dao implementation
cs-hackathon-2022 Jun 1, 2019
1adf477
singleton pattern without thread safty
cs-hackathon-2022 Jun 2, 2019
2afa5d7
singleton pattern thread safe
cs-hackathon-2022 Jun 2, 2019
0fa2d04
singleton pattern thread safe with sync block
cs-hackathon-2022 Jun 2, 2019
0f8fc2e
eager singleton
cs-hackathon-2022 Jun 2, 2019
7de41d5
Updated code for singleton database connection
cs-hackathon-2022 Jun 2, 2019
8cac02f
using batch updates
cs-hackathon-2022 Jun 2, 2019
546ce14
transaction management manually
cs-hackathon-2022 Jun 2, 2019
76b99da
writing valid xml with DTD files
cs-hackathon-2022 Jun 2, 2019
cdf1757
hibernate first demo
cs-hackathon-2022 Jun 6, 2019
bc724a2
hibernate mapping with annotations
cs-hackathon-2022 Jun 6, 2019
c1c5d2f
separate session factory
cs-hackathon-2022 Jun 7, 2019
9e535a6
inital person data
cs-hackathon-2022 Jun 7, 2019
b63488c
using get/load methods
cs-hackathon-2022 Jun 7, 2019
85999d0
using delete() API
cs-hackathon-2022 Jun 7, 2019
a7a3ead
using updaet() API
cs-hackathon-2022 Jun 7, 2019
15ef012
using hql - retrieve all records
cs-hackathon-2022 Jun 7, 2019
3e0ba04
using hql - dynamic values - filtering records
cs-hackathon-2022 Jun 7, 2019
a33eb36
using named queries
cs-hackathon-2022 Jun 8, 2019
9a969ed
using native queries and embeddable
cs-hackathon-2022 Jun 8, 2019
c4f4184
display address details along with person details
cs-hackathon-2022 Jun 8, 2019
25e18e4
using list of addresses for person
cs-hackathon-2022 Jun 8, 2019
12196c3
one to one mapping
cs-hackathon-2022 Jun 8, 2019
2a4cb09
@oneToMany & @ManyToOne
cs-hackathon-2022 Jun 10, 2019
804e5be
book application with hibernate
cs-hackathon-2022 Jun 10, 2019
e66a779
remaining chnages
cs-hackathon-2022 Jun 10, 2019
0ec61b3
Added Notes
cs-hackathon-2022 Jun 10, 2019
7708206
single table strategy
cs-hackathon-2022 Jun 11, 2019
727c31c
table per class strategy
cs-hackathon-2022 Jun 11, 2019
1bc173e
joined strategy
cs-hackathon-2022 Jun 11, 2019
9a74bfc
using sequence
cs-hackathon-2022 Jun 11, 2019
f2010b1
1st and 2nd level cache configuraiton
cs-hackathon-2022 Jun 12, 2019
5226d95
critera api
cs-hackathon-2022 Jun 13, 2019
98dc891
criteria api methods
cs-hackathon-2022 Jun 13, 2019
e9d1637
pagination in hibernate
cs-hackathon-2022 Jun 13, 2019
b572f6e
first web app for time server
cs-hackathon-2022 Jun 18, 2019
dc730a0
servlet introduction with login app
cs-hackathon-2022 Jun 20, 2019
2fa6f78
updated categories page
cs-hackathon-2022 Jun 20, 2019
77ab7c2
working with post methodfor authentication
cs-hackathon-2022 Jun 21, 2019
70a2a6e
validate user from database
cs-hackathon-2022 Jun 21, 2019
6e99728
data population for categories
cs-hackathon-2022 Jun 21, 2019
184d966
integrating hibernate with servlets
cs-hackathon-2022 Jun 22, 2019
3fd99c7
fixed id issue
cs-hackathon-2022 Jun 22, 2019
2d0121e
updated categories
cs-hackathon-2022 Jun 22, 2019
62d7361
updated gitigonre
cs-hackathon-2022 Jun 22, 2019
0c9cd06
fetch products based on category
cs-hackathon-2022 Jun 22, 2019
4210b0f
servlet lifecyle methos
cs-hackathon-2022 Jun 22, 2019
443de21
database design
cs-hackathon-2022 Jun 22, 2019
23311ae
Add to cart and list cart funcationality completed
cs-hackathon-2022 Jun 23, 2019
0d2249a
ShoppingCart object with list of products
cs-hackathon-2022 Jun 23, 2019
75b02b0
basic fundaments als for session
cs-hackathon-2022 Jun 23, 2019
a2282ee
using http session for tracking purpose
cs-hackathon-2022 Jun 23, 2019
c353675
logout
cs-hackathon-2022 Jun 24, 2019
29d22af
showing current User to each page
cs-hackathon-2022 Jun 24, 2019
2b9378b
remove product from cart
cs-hackathon-2022 Jun 24, 2019
31628b6
duplicate product increment qty
cs-hackathon-2022 Jun 24, 2019
f59accf
using loadonStartup attribute
cs-hackathon-2022 Jun 24, 2019
6f4bf13
using loadOnStartup attribute
cs-hackathon-2022 Jun 25, 2019
8a83993
handling application level events for sessionFactory object creation …
cs-hackathon-2022 Jun 25, 2019
93ce6b6
handling application level events for sessionFactory object creation …
cs-hackathon-2022 Jun 25, 2019
b3a8a22
filters using path mapping
cs-hackathon-2022 Jun 25, 2019
0623a06
filter using extension mapping
cs-hackathon-2022 Jun 25, 2019
b8358b6
mvc design pattern with jsp and servlet
cs-hackathon-2022 Jun 27, 2019
f72f0af
using jsp:useBean
cs-hackathon-2022 Jun 28, 2019
2e9319c
first spring app with product data injection
cs-hackathon-2022 Jul 2, 2019
c5b2bac
has-a relationship injection
cs-hackathon-2022 Jul 2, 2019
472fb30
constructor injection
cs-hackathon-2022 Jul 4, 2019
8aa2278
autowire by name
cs-hackathon-2022 Jul 4, 2019
f74115a
autowire byType
cs-hackathon-2022 Jul 4, 2019
0112a8b
autowire by constructor
cs-hackathon-2022 Jul 4, 2019
361b3cc
working with jdbcTemplate for getAll and saveuser api
cs-hackathon-2022 Jul 4, 2019
b1800c5
jdbcTemplate injection via spring rather than hard coding
cs-hackathon-2022 Jul 4, 2019
3ba3600
Spring AOP Example
cs-hackathon-2022 Jul 8, 2019
506c1a2
AspectJ with annotations
cs-hackathon-2022 Jul 8, 2019
6310436
spring notes
cs-hackathon-2022 Jul 8, 2019
aa4e7cc
basic spring mvc application
cs-hackathon-2022 Jul 9, 2019
c83edac
mapping ways
cs-hackathon-2022 Jul 9, 2019
261e8ad
User form submission
cs-hackathon-2022 Jul 10, 2019
1059d53
integrat hibernate with spring
cs-hackathon-2022 Jul 10, 2019
30a7169
hibernate validation + spring
cs-hackathon-2022 Jul 11, 2019
d6cfa2c
project structure
cs-hackathon-2022 Jul 11, 2019
ff35a08
simple maven project
cs-hackathon-2022 Jul 11, 2019
6eff56a
basic rest api with spring boot
cs-hackathon-2022 Jul 13, 2019
9c62fef
Working with h2 database with spring boot 2
cs-hackathon-2022 Jul 15, 2019
21b8f8b
using mysql database
cs-hackathon-2022 Jul 15, 2019
b7f8628
CRUD operations with products
cs-hackathon-2022 Jul 16, 2019
a93c783
Updated status code with responseentity
cs-hackathon-2022 Jul 18, 2019
129c710
lambda expressions + anonymous classes
cs-hackathon-2022 Jul 20, 2019
fb2fa2a
lambda expressions
cs-hackathon-2022 Jul 20, 2019
c444c8d
lambda expressions for threads
cs-hackathon-2022 Jul 20, 2019
bde9061
single param lambda
cs-hackathon-2022 Jul 20, 2019
7a2d9a1
using stream api
cs-hackathon-2022 Jul 20, 2019
b030239
using stream api
cs-hackathon-2022 Jul 20, 2019
f5893d5
pbatch10 code
cs-hackathon-2022 Dec 4, 2019
259ab29
filewatcher using multithreading
cs-hackathon-2022 Dec 4, 2019
ccc0d3c
thread basic object
cs-hackathon-2022 Dec 5, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
*.class
/.metadata/
*/*.classpath
*/*.settings
*/*.project
*/*/WebContent/WEB-INF/lib/*.jar
34 changes: 34 additions & 0 deletions Account.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package com.itp.threads;

public class Account {

// state of the object
private int balance;

public Account(int balance) {
this.balance = balance;
}

public void deposit(int amount) {
synchronized (this) {
this.balance += amount;
}
System.out.println("After Deposit:" + this.balance);
}

public synchronized void withdraw(int amount) {
if (this.balance < amount) {
System.out.println("Insufficient Balance to withraw");
}

synchronized (this) {
this.balance -= amount;
}

System.out.println("After Withdraw:" + this.balance);
}

public int getFinalBalance() {
return balance;
}
}
57 changes: 57 additions & 0 deletions AccountTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
package com.itp.threads;

class DepositThread implements Runnable {

// Refer to existing account object
private Account account;

public DepositThread(Account account) {
this.account = account;
}

@Override
public void run() {
for (int i = 1; i <= 5; i++)
account.deposit(500);
}
}

class WithdrawThread implements Runnable {

// Refer to existing account object
private Account account;

public WithdrawThread(Account account) {
this.account = account;
}

@Override
public void run() {
for (int i = 1; i <= 5; i++)
account.withdraw(500);
}
}

public class AccountTest {

public static void main(String[] args) {

// Create account object
Account joinAccount = new Account(5000);

Thread depositThread = new Thread(new DepositThread(joinAccount));
Thread withdrawThread = new Thread(new WithdrawThread(joinAccount));

depositThread.start();
withdrawThread.start();

try {
depositThread.join();
withdrawThread.join();
} catch (InterruptedException e) {
e.printStackTrace();
}

System.out.println("Final Balance:" + joinAccount.getFinalBalance());
}
}
33 changes: 33 additions & 0 deletions Car.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
public class Car
{
private int model;
private String name;

public Car(int model, String name) {
this.name = name;
this.model = model;
}

public boolean equals(Object obj) {
if(this == obj) return true;
if(obj != null && obj instanceof Car) {
//content comparison
Car c2 = (Car)obj;
//if(this.model == c2.model)

if(this.name.equals(c2.name))
return true;
}

return false;
}

public static void main(String[] args)
{
Car c1 = new Car(10,"BMW");
Car c2 = new Car(10,"Swift");

System.out.println(c1.equals(c2));
}
}

56 changes: 56 additions & 0 deletions DBTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
package com.itp.threads;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.regex.Pattern;

public class DBTest {

public static void main(String[] args) {

Connection conn = null;
PreparedStatement ps = null;
ResultSet rs = null;

try {
// 1. Load the driver into memory
//Class.forName("com.mysql.jdbc.Driver");

// 2. Obtain the database connection
conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/nobel", "sunil", "sunil@123");

// 3. Prepare Statement / PreparedStatement
String query = "select * from student";
ps = conn.prepareStatement(query);

// 4. Execute the query using statement
rs = ps.executeQuery();

while (rs.next()) {
int id = rs.getInt("id");
// rs.getString("name")
String name = rs.getString(2);
System.out.println(id + "\t" + name);
}


} catch (Exception e) {
e.printStackTrace();
}finally {
try {
if(ps != null) ps.close();
if(rs!= null) rs.close();
if(conn != null) conn.close();
} catch (SQLException e) {
e.printStackTrace();
}
}

}
}
1 change: 1 addition & 0 deletions Mandal.java
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
mandal
71 changes: 71 additions & 0 deletions PCTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
package com.itp.threads;

import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.BlockingQueue;

class Producer implements Runnable {

private BlockingQueue<Integer> sharedQueue;

public Producer(BlockingQueue<Integer> sharedQueue) {
this.sharedQueue = sharedQueue;
}

@Override
public void run() {

for (int i = 10; i <= 100; i++) {

try {
this.sharedQueue.put(i);
Thread.sleep(500);
System.out.println("Produced: " + i);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
}

class Consumer implements Runnable {

private BlockingQueue<Integer> sharedQueue;

public Consumer(BlockingQueue<Integer> sharedQueue) {
this.sharedQueue = sharedQueue;
}

@Override
public void run() {
try {
Integer item = null;
while ((item = this.sharedQueue.take()) != 100) {
Thread.sleep(500);
System.out.println("Consumed: " + item);
}
} catch (InterruptedException e) {
e.printStackTrace();
}

}
}

public class PCTest {

public static void main(String[] args) {

BlockingQueue<Integer> sharedQueue = new ArrayBlockingQueue(5);

Thread producer = new Thread(new Producer(sharedQueue));
Thread consumer = new Thread(new Consumer(sharedQueue));

producer.start();
consumer.start();

/*
* try { producer.join(); consumer.join(); } catch (InterruptedException e) {
* e.printStackTrace(); }
*/

}
}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

Steps to take latest codebase

1. git clone https://github.com/sunil-linux/javatraining.git
1. git clone https://github.com/sunil-the-coder/javatraining.git

2. cd javatraining

Expand Down
Loading