Skip to content

Instantly share code, notes, and snippets.

View faizakram's full-sized avatar
🏠
Working from home

Faiz Akram faizakram

🏠
Working from home
View GitHub Profile
package com.care.connection.careconnection;
import static org.junit.jupiter.api.Assertions.assertNotEquals;
import static org.mockito.Mockito.when;
import java.util.ArrayList;
import java.util.List;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.nio.file.DirectoryStream;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.UUID;
import javax.imageio.ImageIO;
package test.overriding;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.nio.file.DirectoryStream;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.UUID;
@faizakram
faizakram / RowCopy.Java
Last active June 9, 2020 10:28
Apache POI Row Copy
public class RowCopy {
public static void main(String[] args) throws Exception {
HSSFWorkbook workbook = new HSSFWorkbook(new FileInputStream("E:/budget-1.xls"));
HSSFSheet sheet = workbook.getSheet("Budget");
copyRow(workbook, sheet, 5, 8);
copyRow(workbook, sheet, 6, 9);
FileOutputStream out = new FileOutputStream("E:/output.xls");
workbook.write(out);
out.close();
SELECT t1.name user_name, dep.name department, t1.created_on
FROM employee t1 JOIN department dep ON t1.department_id =dep.id
WHERE t1.created_on = (SELECT MAX(t2.created_on)
FROM employee t2
WHERE t2.department_id = t1.department_id);
-- If not exists in the child table
SELECT p.id
FROM project p
package com.st.fileUplaod;
import java.io.File;
import com.amazonaws.auth.AWSStaticCredentialsProvider;
import com.amazonaws.auth.BasicAWSCredentials;
import com.amazonaws.regions.Regions;
import com.amazonaws.services.s3.AmazonS3;
import com.amazonaws.services.s3.AmazonS3ClientBuilder;
/*Add this Jar File
import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.util.UUID;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import com.amazonaws.services.s3.AmazonS3;
import com.amazonaws.services.s3.model.CreateBucketRequest;
import com.amazonaws.services.s3.model.GetBucketLocationRequest;
import java.io.File;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.List;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
const mapToAoO = m => {
return Array.from(m).map( ([k,v]) => {return {[k]:v}} );
};
JSON.stringify(mapToAoO(map));
private Properties hibernateProperties() {
Properties properties = new Properties();
properties.put(CommonConstants.HIBERNATE_DIALECT,
propertyReader.getProperty(CommonConstants.HIBERNATE_DIALECT));
properties.put(CommonConstants.HIBERNATE_SHOW_SQL,
propertyReader.getProperty(CommonConstants.HIBERNATE_SHOW_SQL));
properties.put(CommonConstants.HIBERNATE_FORMAT_SQL,
propertyReader.getProperty(CommonConstants.HIBERNATE_FORMAT_SQL));