Author: Mirthbees

Blogger, Innovator, Developer and Enterpreneur. Founder of GuruRecharge, Readymade online recharge script. Lead Developer in Bookrate.in

[Solved] sorry you are not allowed to access this page. wordpress ssl

Errors and solutions
You must have cpanel access to follow the below steps and fix this issue. Search "RewriteEngine on" in your .htaccess file and comment the snippets and enable the https snippets like below. .htaccess: # http only #RewriteEngine On #RewriteBase / #RewriteRule ^index\.php$ - [L] RewriteEngine On RewriteCond %{HTTPS} off RewriteRule (.*) https://%{SERVER_NAME}/$1 [R,L] wp-config.php: Add the below snippets at the top of the file. define('FORCE_SSL_ADMIN', true); if ($_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https'){ $_SERVER['HTTPS']='on'; } Still not resolved ? Then you renamed your plugin folder to plugin_old then check, if it works this time then this is because one of your plugin. Then you need rename that back to plugin and start renaming one by one plugi...

[Solved] Error: listen EADDRINUSE: address already in use :::5000

Errors and solutions
Error: listen EADDRINUSE: address already in use :::5000  First run this command to check the process ID of the running application: ps aux | grep node kill -9 PID sometimes, even if you kill by the above command the process may still be running. In that case we need to actually find the process tree and kill the parent / root process. Command to find the parent/root process: pstree -hp | grep node Now kill the process tree by same command: sudo kill -9 PID

AWS S3 File Upload Spring Boot Controller And Service

AWS
This blog posts explains on how to upload your file to Amazon S3 services using spring/spring boot. Prerequisite: endpoint Url Access Key secret Key BucketName Pom.xml file: Here it is spring boot project, so if your is spring then just add the required dependencies for AWS. <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> </dependency> <!-- https://mvnrepository.com/artifact/com.amazonaws/aws-java-sdk --> <dependency> <groupId>com.amazonaws</groupId> <artifactId>aw...

Swagger Tutorials & Notes

Java
What is the URL to open Swagger UI ? https://localhost:8080/ngdeveloper/api/swagger-ui.html What is the URL to view the list of API's as JSON in Swagger ? https://localhost:8080/ngdeveloper/api/v2/api-docs How to disable Swagger related URL's in Spring Security ? In your WebSecurityConfig class make sure to skip the below endpoints/urls, @Override public void configure(WebSecurity web) throws Exception { web.ignoring().antMatchers("/actuator/**", "/v2/api-docs", "/webjars/**", "/swagger-resources/**","/swagger-ui.html"); } In very few case it still throws the exceptions then try "**/swagger-resources/**" instead of "/swagger-resources/**" How to disable Swagger UI in Production ? Swagger UI can be enabled or disabled based on the profile. Make sure you have s...

Java Interesting Problems

Java
How to print Fibonacci Series Till 1000 ? import java.math.BigInteger; public class FibonacciSeries { public static void main(String[] args) { int input = 100; BigInteger n1=BigInteger.valueOf(0),n2=BigInteger.valueOf(1),n3=BigInteger.valueOf(0); for(int i=2;i<=input;i++) { n3=n3.add(n1).add(n2); System.out.println(n3); n1=n2; n2=n3; } } } Learning from the above program: You can not use int/Integer and also long/Long to store the value. Because maximum value of int(2147483647) and long(9223372036854775807). Both these values would be reached even before the first 100 fibonacci series values.So BigInteger is one and only option for us to print the value of fibonacci series more than 100.BigInteger size is int[] of 2147483647 [Integer.MAX_VALUE), so...

Angular Errors & Solutions

Angular
How to fix "This usually happens because your environment has changed since running npm install." this issue ? This issue generally happens if you updated or reinstalled your npm. The easiest solution is, Solution 1: npm install node-sass Solution 2: If it does not work, then try removing the node_modules folder and then npm install then try, ng serve Solution 3: [This is the one worked for me] Remove browserlist.cmd and browserlist file from your project's root folder then try ng build then ng server

Windows Notes

Articles
How to change the user to admin through command prompt ? net localgroup Administrators "ACCOUNT-NAME" /add If suppose your user name is ngdeveloper then the actual command would be, net localgroup Administrators "ngdeveloper" /add How to remove the user from adminstrator access in windows 10? net localgroup Administrators "ngdeveloper" /delete How to test whether you are admin or not ? Windows -> Run -> netplwiz will show you the users with their user type/access.

How to save & load Jenkins docker images in two hosts

Java
This posts help you with step by step instructions to move jenkins images from one hosts to another hosts. I have personally used the below method and worked great for me. I have another method mentioned here. But that gave me lot of errors and also the jenkins_home contents like custom shell scripts/job details etc were missed. But still I have posted because this can work for other docker containers. Step 1: Save Jenkins Image in Machine 1 docker save jenkins > jenkins_bkup.tar Step 2: Move the .tar file to Machine 2 from Machine 1 sudo scp -o StrictHostKeyChecking=no -i "my-docker-pair.pem" /home/ec2-user/jenkins_bkup.tar ec2-user@AWS_MACHINE_HOST:/home/ec2-user/jenkins_bkup.tar Step 3: Docker Load in Host 2/Machine 2 cat jenkins_bkup.tar | docker load Ste...

How to do docker import export from two AWS Machines ?

AWS, Docker
Step 1: Docker Export in Machine 1: sudo docker export ngjenkins | gzip > ngjenkins.gz Step 2: Run From Machine 1 to copy .gz file to Machine 2: scp -i "my-docker-pair.pem" -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null ngjenkins.gz ec2-user@YOUR_AWS_HOST_NAME:/home/ec2-user/ .pem file is mandatory to connect with any AWS machine in AWS environments. If you don't have that file in your server, make sure to copy that in your aws machine from your local computer using the below command. scp -i my-docker-pair.pem d:/aws/my-docker-pair.pem ec2-user@YOUR_AWS_HOST_NAME:/home/ec2-user/my-docker-pair.pem Step 3: Docker Import in Machine 2: zcat ngjenkins.gz | docker import - ngjenkins Step 4: Docker Run in Machine 2: docker run -i -t ngjenkins /bin/...

AWS Notes

Java
How to copy some files from your aws machine to your local desktop ? Download Mobaxterm community edition, open new session then go to desktop, scp -i "my-docker-keypair.pem" ec2-user@AWS_HOST_NAME:/home/ec2-user/ngjenkins.tar / my-docker-keypair.pem is the keypair file which you can download from aws console. ngjenkins.tar is my tar file which I need to copy from AWS machine to local desktop. I am running this command from desktop and I need the file to be downloaded to desktop only, so gave just ("/") in the copy command. How to copy files from your local machine to AWS Machine ? scp -i "my-docker-keypair.pem" /ngjenkins.tar ec2-user@AWS_HOST_NAME_PUBLICH:/home/ec2-user/ngjenkins.tar