Skip to content

Instantly share code, notes, and snippets.

View MostafijurJ's full-sized avatar
🌀
Forever learner

Mostafijur Rahman MostafijurJ

🌀
Forever learner
View GitHub Profile
@MostafijurJ
MostafijurJ / Database Server Slow Query finding in Postgres
Last active April 6, 2023 07:31
Database Server Slow Query finding in Postgres
pg_stat_statements is a PostgreSQL extension that provides detailed statistics on the SQL statements executed by a database server. This extension collects information on the amount of time spent executing each query, the number of times each query has been executed, and the amount of data processed by each query. This information can be used by database administrators and developers to identify slow-running queries and to optimize the performance of their applications. The pg_stat_statements extension is a powerful tool for monitoring and improving the performance of PostgreSQL databases.
#Enable pg_stat_statements in Postgres
Add the below configuration on the postgresql.conf file
# Enabling pg_stat_statements
`shared_preload_libraries = 'pg_stat_statements'
pg_stat_statements.track = all`
@MostafijurJ
MostafijurJ / JPA operations
Last active October 29, 2020 13:10
This is all about JPA notes
1. CRUD operation এর মধ্যে default ভাবে যদি শুধু মাত্র searchByID() এটা support করে। কিন্তু যদি এমন হয় যে আমাদের প্রয়োজন হচ্ছে ID
বাদে অন্য field দিয়ে সার্চ করা, সে ক্ষেত্রে Dao এর যে interface ta define করে হবে সেটার মধ্যে শুধু findBy.. এর পরে যে
field দিয়ে সার্চ করতে চাই সেটা দিলেই হবে।
যেমনঃ একটা Table এর ID, Name, Email এই ৩ টা field আছে, আমরা সেখানে same name এর যতগুলা Data আছে সব সার্চ করতে চাই,
সেক্ষেত্রে
` List<Class Name> findByName(String Name) ` এটা দিয়ে সার্চ করলেই চলে আসবে ।
N.B: এই এটা Define করতে হবে interface এর মধ্যে ।
@MostafijurJ
MostafijurJ / Spring Boot configuration with JSP
Last active October 29, 2020 09:09
Spring Boot configuration with JSP details
### Spring Boot web project এর সাথে সাধারনত Thyemleaf ব্যবহার করা হয়।
কিন্তু সমস্যা টা বাধে এর সাথে JSP file নিয়ে কাজ করতে গেলে। সেটার জন্য কতগুলা নির্দিষ্ট Step follow করতে এটা কাজ করে।
Step 1: Project create করার সময় এর সাথে শুধু Spring Web Dependency করতে হবে।
Step 2: JSP এর জন্য ২ টা নতুন করে Dependency add করতে হবে ।
`
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
</dependency>
@MostafijurJ
MostafijurJ / Spring Annotation's
Created October 27, 2020 11:11
Learning Spring Annotations
Here I will try cover details of all the annotations are used in Spring framework.
@MostafijurJ
MostafijurJ / Hibernate Cache
Last active October 16, 2020 12:38
Details about hibernate cache.
1. When user send request to the service layer for data, service layer call the database layer and receive all the data and store in cache
in the service layer. If another user requests the same data to the service layer, then the service layer provides data that is stored in cache.
(it doesn't call the database for data) This is the main benefit of using a cache.
2. Hibernate provides two types of cache.
i. Level one cache (it is by default in hibernate)
ii. Second level cache. -> When another user requests the same data after closing that session. its needs second level cache to store that type
data.
> Requirements:
@MostafijurJ
MostafijurJ / Hibernate Connection
Last active October 15, 2020 09:56
Connection procedure of hibernate.
Here is the following steps for connecting hibernate into mysql database.
Step-1: After Creating a maven project first we need to add this two dependency into the pom.xml file.
`<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>4.1.6.Final</version>
</dependency>
@MostafijurJ
MostafijurJ / monkey.cpp
Last active August 27, 2020 16:15
Monkey Banana Problem of LightOJ
Problem: You are in the world of mathematics to solve the great "Monkey Banana Problem".
It states that, a monkey enters into a diamond shaped two dimensional array and can jump in any of the adjacent cells down from its current position (see figure).
While moving from one cell to another, the monkey eats all the bananas kept in that cell.
The monkey enters into the array from the upper part and goes out through the lower part.
Find the maximum number of bananas the monkey can eat.
Input: Input starts with an integer T (≤ 50), denoting the number of test cases. Every case starts with an integer N (1 ≤ N ≤ 100). It denotes that,
there will be 2*N - 1 rows. The ith (1 ≤ i ≤ N) line of next N lines contains exactly i numbers.
Then there will be N - 1 lines. The jth (1 ≤ j < N) line contains N - j integers.
Each number is greater than zero and less than 215