Skip to content

Instantly share code, notes, and snippets.

View nijjwal's full-sized avatar
🎯
Focusing - Don't disturb

Nijjwal nijjwal

🎯
Focusing - Don't disturb
View GitHub Profile
@nijjwal
nijjwal / Functions.java
Last active August 29, 2015 14:13
Functions.java
import java.util.ArrayList;
public class Functions {
/**
* Display invalid numbers in a given array that are not the multiples of the key parameter.
* @param key Enter a number whose multiple you want to find
* @param array Enter the array which you want to check for invalid numbers
* @return
@nijjwal
nijjwal / Main.java
Last active August 29, 2015 14:13
Main.java
import java.util.ArrayList;
public class Main extends Functions{
public static void main(String[] args) {
Functions test = new Functions();
//Create an array to test
int[] array = {8,16,24,5,3,2};
int key = 8;
ArrayList<Integer> results = test.Multiplesofanumber(key, array);
@nijjwal
nijjwal / springmvc.java
Created January 20, 2015 08:04
This is my note for spring mvc tutorial from gontuseries.
/**
|---------------------------------------------------------------
|Chapter 3. Installation and setup using Eclipse
|---------------------------------------------------------------
*/
1. Rt click > New > Other > Web > Dynamic Web Project
-Project name: FirstSpringMVCProject
-Next
-Next
@nijjwal
nijjwal / javafx-tutorial.java
Last active August 29, 2015 14:14
javafx-tutorial.java
/**
|------------------------------------
|1. Introductiona and Installation
|------------------------------------
*/
1. A lot of people use NetBeans with JavaFX.
2. You will need Java 7 for this. You will need JDK 7 or later.
@nijjwal
nijjwal / common-errors.java
Created January 28, 2015 05:52
Java Common Errors
1. Null Pointer Exception.
- If you are trying to access an object that does not exist.
For example, accesing an object whose pkid id 1 , but that has already been deleted will
result in Null Pointer Exception.
@nijjwal
nijjwal / gist:4d4614f561e3e18b0f9a
Created May 25, 2015 23:03
java collections for interview
1. Why do we need collection framework?
- If you want to represent 10,000 values, then declaring 10,000 variables
to represent those 10,000 values is worst programming practice.
Because readability of code is going to be hard. To overcome this problem
we should go for the next level - array concept. The biggest advantage of
array is we can represent huge number of values by using a single variable.
So, the readabilit of code is going to improve. Suppose, arrays concept is
not there, then we should go for the individual variables. To represent
10,000 values we will need 10,000 variables, then the readability of code
is going to go down.
<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<!-- Database connection settings -->
<property name="connection.driver_class">com.mysql.jdbc.Driver</property>
@nijjwal
nijjwal / pom.xml
Created August 22, 2015 00:10
pom.xml file for generating a war file inside target folder which can be used by Jenkins to deploy it in a Tomcat Server.
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>JenkinsEC2</groupId>
<artifactId>JenkinsEC2</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<build>
<sourceDirectory>src</sourceDirectory>
<plugins>
@nijjwal
nijjwal / Employee.java
Last active December 16, 2017 11:24
HashMap Code. i) Find an employee whose id is 300. ii) Display all the employee information to show that map does not preserve insertion order. iii) Override toString method
import java.util.Map;
import java.util.HashMap;
public class Employee{
Integer empId;
String name;
@Override
public String toString()
{
@nijjwal
nijjwal / .json
Created March 8, 2020 05:17
AWS Make All Object Public inside a Bucket after allowing public access to the bucket
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "PublicReadGetObject",
"Effect": "Allow",
"Principal": "*",
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::nijjwal.com/*"
}