https://www.curiousm.com/labs/2020/10/08/resolving-bind-address-already-in-use-when-starting-a-docker-instance/
sudo /etc/init.d/apache2 restart
https://www.curiousm.com/labs/2020/10/08/resolving-bind-address-already-in-use-when-starting-a-docker-instance/
sudo /etc/init.d/apache2 restart
sudo apachectl -k restart
https://www.archerimagine.com/articles/aws/aws-cognito-tutorials.html
var params = { AccessToken: 'STRING_VALUE' /* required */ }; cognitoidentityserviceprovider.getUser(params, function(err, data) { if (err) console.log(err, err.stack); // an error occurred else console.log(data); // successful response });
https://mkyong.com/java/jackson-tree-model-example/
http://tutorials.jenkov.com/java-json/jackson-jsonnode.html
class Main {
public static void main(String args[]) {
System.out.println("Hello, world!");
Main m =new Main();
m.printPrimeNumber(100);
m.printPrimeNumber1();
}
public void printPrimeNumber(Integer number) {
if(number%2==0) {
System.out.println("number is prime"+number);
}
number--;
if(number>0){
printPrimeNumber(number);
}
}
public void printPrimeNumber1() {
System.out.println("Hello, world!");
}
}
Generating a new SSH key and adding it to the ssh-agent - GitHub Docs
ssh-keygen -t ed25519 -C "your_email@example.com"
move to your current branch
then fire rest comment like below
commit id from you want to revert changes.
b6789988d5d043d47569 your commit1
b6789988d5d043d4756 your commit2
b6789988d5d0b6789988d5d043d47 your commit3
b6789988d5d043d47 changes removed from hare
git reset --hard b6789988d5d043d47
then push your reset changes
git push -f origin branchname
https://gitcheatsheet.org/?gclid=Cj0KCQjwwNWKBhDAARIsAJ8Hkhdlxai30BVPljj5WDd9xd6uFTe7HIr406NPx7WvT7WCvSWfEeF3R6EaAmxJEALw_wcB
https://docs.aws.amazon.com/AmazonS3/latest/userguide/example-bucket-policies.html
{
"Id":"PolicyId2",
"Version":"2012-10-17",
"Statement":[
{
"Sid":"AllowIPmix",
"Effect":"Allow",
"Principal":"*",
"Action":"s3:*",
"Resource": [
"arn:aws:s3:::DOC-EXAMPLE-BUCKET
",
"arn:aws:s3:::DOC-EXAMPLE-BUCKET
/*"
],
"Condition": {
"IpAddress": {
"aws:SourceIp": [
"54.240.143.0/24
",
"2001:DB8:1234:5678::/64
"
]
},
"NotIpAddress": {
"aws:SourceIp": [
"54.240.143.128/30
",
"2001:DB8:1234:5678:ABCD::/80
"
]
}
}
}
]
}
https://s3tools.org/kb/item10.htm
How to restrict access to a bucket to specific IP addresses |
To secure our files on Amazon S3, we can restrict access to a S3 bucket to specific IP addresses. The following bucket policy grants permissions to any user to perform any S3 action on objects in the specified bucket. However, the request must originate from the range of IP addresses specified in the condition. The condition in this statement identifies 192.168.143.* range of allowed IP addresses with one exception, 192.168.143.188. { The |
https://stackoverflow.com/questions/44062813/aws-s3-upload-without-access-and-secret-key-in-java
AmazonS3 s3Client = AmazonS3ClientBuilder.standard()
.withCredentials(new InstanceProfileCredentialsProvider(false))
.build();
https://docs.aws.amazon.com/sdk-for-php/v3/developer-guide/guide_credentials_provider.html
https://stackoverflow.com/questions/52286306/using-ec2-metadata-credentials-in-the-laravel-filesystem
https://kylewbanks.com/blog/java-string-concatenation-vs-stringbuilder-vs-string-format-performance
public class TestStrings { private static final String PROFILE_PICTURE_URL_BASE = "https://cdn.myapp.com/user/"; private static final String PROFILE_PICTURE_URL_EXTENSION = ".png"; private static final String PROFILE_PICTURE_URL = "https://cdn.myapp.com/user/%d.png"; private static final int NUM_ITERATIONS = 1000000; public static void main(String[] args) { int userId; long startTime; // String Concatentation startTime = System.currentTimeMillis(); for (userId = 0; userId < NUM_ITERATIONS; userId ++) { String profilePictureUrl = PROFILE_PICTURE_URL_BASE + userId + PROFILE_PICTURE_URL_EXTENSION; } System.out.println("String Concatentation: " + (System.currentTimeMillis() - startTime) + "ms"); // StringBuilder startTime = System.currentTimeMillis(); for (userId = 0; userId < NUM_ITERATIONS; userId ++) { StringBuilder sb = new StringBuilder(PROFILE_PICTURE_URL_BASE); sb.append(userId); sb.append(PROFILE_PICTURE_URL_EXTENSION); String profilePictureUrl = sb.toString(); } System.out.println("StringBuilder: " + (System.currentTimeMillis() - startTime) + "ms"); // String.format startTime = System.currentTimeMillis(); for (userId = 0; userId < NUM_ITERATIONS; userId ++) { String profilePictureUrl = String.format(PROFILE_PICTURE_URL, userId); } System.out.println("String.format: " + (System.currentTimeMillis() - startTime) + "ms"); } }
https://stackoverflow.com/questions/8549619/mysql-dynamically-build-query-string-in-a-stored-procedure-based-on-logic
CREATE PROCEDURE `activate_games_pawan`(IN `gameId` INT(20))
BEGIN
DECLARE whereCondition varchar(200);
CASE WHEN gameId>0 THEN
SET @whereCondition =CONCAT(" ","sh_games.game_id=",gameId);
SELECT @whereCondition;
ELSE
SET @whereCondition=1;
SELECT @whereCondition;
END CASE;
SET @query=CONCAT("SELECT * FROM sh_games where ", @whereCondition);
select @query;
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END
SET SQL_SAFE_UPDATES = 0;
DELETE t1 FROM sh_learning_material AS t1
INNER JOIN sh_learning_material AS t2
WHERE
t1.id<t2.id AND
t1.company_id = t2.company_id;
https://howtodoinjava.com/spring-boot2/send-email-with-attachment/
public void sendMailWithAttachment(String to, String subject, String bodyTextMsg, String fileToAttach)
{
System.out.println("file loc------------"+fileToAttach);
MimeMessagePreparator preparator = new MimeMessagePreparator()
{
public void prepare(MimeMessage mimeMessage) throws Exception
{
mimeMessage.setRecipient(Message.RecipientType.TO, new InternetAddress(to));
mimeMessage.setFrom(new InternetAddress(fromEmailId));
mimeMessage.setSubject(subject);
Multipart multipartContent= new MimeMultipart();
MimeBodyPart mimeBodyPart =new MimeBodyPart();
mimeBodyPart.setText(bodyTextMsg);
MimeBodyPart mimeBodyPartAttachment =new MimeBodyPart();
mimeBodyPartAttachment.attachFile(fileToAttach);
multipartContent.addBodyPart(mimeBodyPart);
multipartContent.addBodyPart(mimeBodyPartAttachment);
mimeMessage.setContent(multipartContent,"text/csv; charset=utf-8");
System.out.println("email send sucessfully");
}
};
try {
mailSender.send(preparator);
System.out.println("email send sucessfully");
}
catch (MailException ex) {
// simply log it and go on...
System.out.println(ex.getMessage());
}
}
https://coderanch.com/t/271609/java/Java-Mail-send-Multiple-recipients
https://javarevisited.blogspot.com/2012/07/create-read-only-list-map-set-example-java.html#axzz6obBnjvcF
https://confluence.atlassian.com/sourcetreekb/generate-and-load-ssh-keys-into-sourcetree-with-putty-790629663.html
https://betterprogramming.pub/is-node-js-really-single-threaded-7ea59bcc8d64
https://www.tecmint.com/install-pm2-to-run-nodejs-apps-on-linux-server/
https://www.digitalocean.com/community/tutorials/how-to-use-pm2-to-setup-a-node-js-production-environment-on-an-ubuntu-vps
ShopCategoryIds.stream().map(String::valueOf)
.collect(Collectors.joining(","));
Pass a object that hold you parameters then pass that object to function.
Avoid longlist parameters use Object or array of parameters
Advantage
Consider you used longlist function on three place and you want to add more 1 then in this case you need to modify code at three places .
If you use object or array then once place change is required.
https://stackoverflow.com/questions/2432443/best-practice-for-passing-many-arguments-to-method
https://stackoverflow.com/questions/36904955/passing-single-object-vs-passing-multiple-parameters