echo '172.16.144.128 hdp hdp' | sudo tee -a /private/etc/hosts
Tuesday, June 2, 2020
Saturday, May 16, 2020
Bash script to rename or move files from a directory !
Monday, April 20, 2020
Git - more on Git Tags -
The following steps outlines the Git Tag delete process both locally and remotely.
- Fetch all the tags from
git fetch --tags - Delete the tag locally
git tag -d yourTagToDelete (eg: git tag -d v1.15.0) - Delete the tag in Remote
git push origin :yourTagToDelete (eg git push origin :v1.15.0) - Create a new tag locally
git tag yourNewTag (eg: git tag v1.15.0) - Push tag to Remote
git push origin yourTagToDelete (eg git push origin v1.15.0)
Saturday, April 18, 2020
Restarting Spring Boot Application !
Restarting Spring Boot Application !
- Using spring-boot-devtools
- Using RestartEndPoint from
Add your Gradle dependency
dependencies{
compileOnly("org.springframework.boot:spring-boot-devtools")
}
After that Add, you can simply add an end poing on your controller class and have the following:org.springframework.boot.devtools.restart.Restarter.getInstance().restart();
The drawback of using tools is you cannot make a good used of @Cacheable . it might cause ClassCastException while reading from the cache.
Add your Gradle dependency
dependencies{
compile "org.springframework.boot:spring-boot-starter-actuator"
}
After that Add, you can simply add an end on your controller class and have the following:- @Autowired
- RestartEndpoint restartEndpoint;
- And call the following methond from your controller :
- restartEndpoint.restart()
You might see NullPointer Exception while trying to bring the application up specially when you have UnderTow as your servlet container
- 3. And the third one is reading the current context and restarting it. You can simply add the following method on the Main Class and invoke from your controller
public static void restart() { ApplicationArguments args = appContext.getBean(ApplicationArguments.class); Thread thread = new Thread(() -> { appContext.close(); SpringApplication springApplication = new SpringApplication(MyBootApplication.class); springApplication.addListeners(new ApplicationPidFileWriter()); appContext =springApplication.run(args.getSourceArgs()); }); thread.setDaemon(false); thread.start(); }
Saturday, March 21, 2020
Thursday, March 5, 2020
Monogo Pipeline scripts !
Friday, April 5, 2019
Java 11 and Groovy Compatibility and JAXBContext !
If you see the following error during compile :
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':compileTestGroovy'.
> org/codehaus/groovy/ast/MethodCallTransformation
Add the folling line to your gradle file :
ext['groovy.version'] = '2.5.6' //i.e your grovy version.
Another issues with java 11
Unable to load class groovy.xml.jaxb.Jaxb GroovyMethods due to missing dependency javax/xml/bind/JAXBContext
You can fix this by adding the following dependency on the latest groovy version
Labels:
Groovy,
Groovy2.5.6,
java11,
JAXBContext,
MethodCallTransformation,
openjdk11
Wednesday, February 6, 2019
Useful Unix Commands
1. Count number of lines on all the files in the current folder
wc -l *
2. Count the number of files on the current directory :
ls | wc -l
3. Print all the line containing word/s in a file
grep -iw "search words" arc.log
grep -iw "search words" arc.log
4. Thread dumping for a process
jcmd 8308 JFR.start duration=100s filename=tempo.jfr
jcmd 8308 JFR.start duration=100s filename=tempo.jfr
Wednesday, December 19, 2018
Simple hack to Update System Properties and Environment variables on Window !
If you don't have a permission to edit the System variable on your local window machine, the following hack might work
Friday, April 13, 2018
MySql Query to turn ON Query statistics I/O
MySQL Nested Case SQL statements (CASE WHEN OR THEN ELSE END )
Following is an example of nested MySQL Case When or then else End statement.
select CASE When (table.field1 = '01') THEN CASE When (SUBSTRING_INDEX(table.field1, ' ', 1) = 'abc') THEN '01abc' ELSE 'abc' END WHEN (table.field1 = '02') THEN CASE When ((SUBSTRING_INDEX(table.field1, ' ', 1)) = 'def') THEN '02def' ELSE 'def' END When (table.field1 = '03') THEN CASE When ((SUBSTRING_INDEX(table.field1, ' ', 1)) = 'efg') THEN '03efg' ELSE 'efg' END WHEN (table.field1 = '04') THEN CASE When ((SUBSTRING_INDEX(table.field1, ' ', 1)) = 'pqr') THEN '04pqr' ELSE 'pqr' END END from table ;
Tuesday, December 19, 2017
Is this the beginning of the end of BitCoin, Etherum and LiteCoin ? Did it really crashed today evening ??
The BitCoin was traded at $14,212 at 6:40 PM CST, December 19 2017. The price is almost 27% less than its highest value. At the time of the post of this blog, the BitCoin is now backed up to $17,149
The Etherum was traded at $705 at 6:40 PM CST, December 19 2017. The price is almost 17% less than its highest value. At the time of the post of this blog, the Etherum is now backed up to $772 The
LiteCoin was traded at $277 at 6:40 PM CST, December 19 2017. The price is almost 37% less than its highest value of $371. At the time of the post of this blog, the LiteCoin is now backed up to $320
Where as the Bitcoin Cash is enjoying a ride of $3100 per bitcoin cash which is almost 41% higher than its yesterday's price.
The Etherum was traded at $705 at 6:40 PM CST, December 19 2017. The price is almost 17% less than its highest value. At the time of the post of this blog, the Etherum is now backed up to $772 The
LiteCoin was traded at $277 at 6:40 PM CST, December 19 2017. The price is almost 37% less than its highest value of $371. At the time of the post of this blog, the LiteCoin is now backed up to $320
Where as the Bitcoin Cash is enjoying a ride of $3100 per bitcoin cash which is almost 41% higher than its yesterday's price.
Wednesday, August 30, 2017
Fix for xcrun: error: invalid active developer path after updating your mac OS to Sierra
If you are geting the following error with Git or any other tools while running it on from your terminal
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun.
using the following command to fix it
xcode-select --install
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun.
using the following command to fix it
xcode-select --install
Friday, March 3, 2017
Git Cheat Sheet
A. To List your local branchs :
B. How to get or fetch a remote Branch
You first need to fetch and check out the remote branc
C. How to delete a Branch both locally and remotely:
1. Delete the remote branch
2. Delete a local branch
D. How to rename your remote Branch :
1. Rename branch locally
2. Delete the old remote branch
3. Push the new Branch and update the upstream to point it to the new remote branch.
F. Force Push :
G: Change the remote
H. Reset your branch to origin version, revert all your local commit and changes.
Plese stash your changes before you do it. git stash
I. undo the last commit and unstage all the files:
git reset HEAD~;
j. Undo the commit and completely remove all changes(Becareful !)
git reset --hard HEAD~;
K. Undo previous merge:
check the previous log :
git log
Then revert back the merge corresponding to the commit hash
git revert -m 1
And finally push your changes:
git push
- git branch
B. How to get or fetch a remote Branch
You first need to fetch and check out the remote branc
- git fetch remote remote_branch_name (eg : git fetch origin story2525/mytest_remote_branch)
- git checkout remote_branch_name
C. How to delete a Branch both locally and remotely:
1. Delete the remote branch
- git push origin :branch_name or
- git push origin --delete branch_name
2. Delete a local branch
- git branch -d branch_name (use -D if your branch hasn't been fully merge yet)
D. How to rename your remote Branch :
1. Rename branch locally
- git branch -m old_branch new_branch
2. Delete the old remote branch
- git push origin :old_branch
3. Push the new Branch and update the upstream to point it to the new remote branch.
- git push --set-upstream origin new_branch
E. Git Logs :
git log --oneline | grep searchString
git log --pretty=format:"%cn committed %h on %cd"| grep searchString
F. Force Push :
git push origin refactor/mybranch —force
G: Change the remote
git remote set-url origin <>
H. Ammend message for a committed and pushed changes
git commit --amend
To push the changes to the branch (myBranch) on the remote repository (origin) use:
git push --force-with-lease origin myBranch
To push the changes to the branch (myBranch) on the remote repository (origin) use:
git push --force-with-lease origin myBranch
git reset --hard origin/yourbranch
I. undo the last commit and unstage all the files:
git reset HEAD~;
j. Undo the commit and completely remove all changes(Becareful !)
git reset --hard HEAD~;
K. Undo previous merge:
check the previous log :
git log
Then revert back the merge corresponding to the commit hash
git revert -m 1
And finally push your changes:
git push
L. Roll Back your git push
git push -f origin last_good_commit_hash:yourbranch
example : git push -f origin 4d875f7e3e8:develop
Sunday, December 18, 2016
How to check if the given string is palindrome (Recursive vs Non-recursive )
A palindrome is a word, phrase, number, or other sequence of characters which reads the same backward or forward, such as "level" or "kayak" or "amanaplanacanalpanama"
Following is the program to check if the given string is a palindrome.
package com.mytech.today; public class PalindromeClient { public static boolean isPalendrome (String s) { if(s== null) { throw new RuntimeException("null value passed"); } int n = s.length(); if(n==1) return true; else { for (int i=0; i < n/2 ; i++) { if(s.charAt(i)!=s.charAt(n-i-1)) { return false; } } } return true; } public static boolean isPalendromeRecurrsive (String s) { if (s.length()<2) { return true;} else if (s.charAt(0)==s.charAt(s.length()-1)) { return isPalendrome(s.substring(1, s.length()-1)); } else return false; } public static void main(String[] args) { System.out.println(isPalendrome("levvel")); System.out.println(isPalendrome("manaplanacanalpanama"));
System.out.println(isPalendrome("a")); System.out.println(isPalendrome("jptt aefa afdaf")); System.out.println(isPalendromeRecurrsive("levvel")); System.out.println(isPalendromeRecurrsive("manaplanacanalpanama"));
System.out.println(isPalendromeRecurrsive("a")); System.out.println(isPalendromeRecurrsive("jptt aefa afdaf")); } }
Subscribe to:
Posts (Atom)