Skip to content

Instantly share code, notes, and snippets.

View sudarshansb143's full-sized avatar

sudarshan sudarshansb143

  • Pune, INDIA
View GitHub Profile
public List<TokenDateDistributionDto> splitAndProcess(List<TokenDateDistributionDto> dataList) {
// Get the size of the data list
int dataSize = dataList.size();
// Determine the number of parts based on the size of the data list
int numParts;
// Choose the number of parts based on the size of the data list
if (dataSize > 21 && dataSize < 180) {
numParts = dataSize / 7; // If the size is between 21 and 180, split into 7 parts
#!/bin/bash
# Clone or pull the code from the GitHub repository
if [ -d "your-app-folder" ]; then
# If the app folder already exists, perform a git pull to update the code
cd your-app-folder
git pull
else
# If the app folder doesn't exist, clone the repository
git clone your-github-repo-url your-app-folder
java.lang.NullPointerException: Cannot invoke "tv.plustv.qms.dto.NameIdPairDto.getId()" because the return value of "tv.plustv.queuemgmt.dto.UserDto.getSection()" is null
at tv.plustv.queuemgmt.controller.UserController.updateUser(UserController.java:176) ~[classes/:na]
at tv.plustv.queuemgmt.controller.UserController$$FastClassBySpringCGLIB$$84f38c77.invoke(<generated>) ~[classes/:na]
at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218) ~[spring-core-5.3.22.jar:5.3.22]
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:793) ~[spring-aop-5.3.22.jar:5.3.22]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163) ~[spring-aop-5.3.22.jar:5.3.22]
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:763) ~[spring-aop-5.3.22.jar:5.3.22]
at org.springframework.security.access.intercept.aopalliance.MethodSecurityInterceptor.invoke(M
2023-04-08 15:53:44.557 ERROR 6976 --- [nio-8081-exec-1] t.p.m.utils.RestExceptionHandler : Unhandled exception at /admin/api/v1/branch. Reason: The given id must not be null!; nested exception is java.lang.IllegalArgumentException: The given id must not be null!
org.springframework.dao.InvalidDataAccessApiUsageException: The given id must not be null!; nested exception is java.lang.IllegalArgumentException: The given id must not be null!
at org.springframework.orm.jpa.EntityManagerFactoryUtils.convertJpaAccessExceptionIfPossible(EntityManagerFactoryUtils.java:374) ~[spring-orm-5.3.22.jar:5.3.22]
at org.springframework.orm.jpa.vendor.HibernateJpaDialect.translateExceptionIfPossible(HibernateJpaDialect.java:235) ~[spring-orm-5.3.22.jar:5.3.22]
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.translateExceptionIfPossible(AbstractEntityManagerFactoryBean.java:551) ~[spring-orm-5.3.22.jar:5.3.22]
at org.springframework.dao.support.ChainedPersistenceExceptionTranslator.translateExceptio
@sudarshansb143
sudarshansb143 / middleware.java
Created March 9, 2023 12:32
Auth Middleware
private String ADMIN_ROLE = "admin"
// Assuming this function will be called from each API with provided params
public boolean isAccessAllowed(token, entityId, branchId, orgId, userRole){
if (token.role == ADMIN_ROLE) {
return true;
} else if (token.entityId == entityId && token.branchId === branchId && token.orgId === orgId && token.role == userRole ) {
return true
} else {
return false
@sudarshansb143
sudarshansb143 / script.js
Created June 18, 2022 03:36
Unfollow people on linkedIn in bulk using a hack
let followingNodeList = document.getElementsByClassName("is-following")
for (ele of followingNodeList) {
ele.click()
}