wtorek, 30 września 2025

poniedziałek, 25 sierpnia 2025

Download sources for particular Maven Artifact

e.g.

mvn dependency:get -DgroupId=org.springframework -DartifactId=spring-web -Dversion=6.1.6 -Dclassifier=sources -Dpackaging=jar

czwartek, 10 października 2024

kubectl basic commands

List all pods:

kubectl get pods
kubectl get pods -n <namespace>


Show logs from last pod:

kubectl logs -n <namespace> <pod> -p


Show logs from current pod:

kubectl logs -n <namespace> <pod>
# add "-f" to follow
 
Enter to bash inside pod:
kubectl -i -t <pod> -n <namespace> -- /bin/bash 

wtorek, 10 września 2024

gitk usefull switches

 gitk <one_branch>...<second_branch> - show commits between branches

 gitk --all - show changes from all branches

 gitk -- some/path/to/filter - filter by path

poniedziałek, 30 października 2023

wtorek, 18 kwietnia 2023

Force download all maven dependencies

Force download all maven dependencies:

mvn dependency:purge-local-repository


Download all dependencies and repore failures at the end:

mvn -fae install -DskipTests

Download sources and javadocs:

mvn dependency:sources
mvn dependency:resolve -Dclassifier=javadoc
mvn dependency:tree -Dmaven.main.skip -Dmaven.test.skip 

source

niedziela, 10 marca 2019

Bypass UEFI provided Windows Key

E.g. if you want to install Windows Professional Box on computer with Windows Home OEM:

1. Create bootable pendrive with Windows from DVD.

2. Create file /sources/PID.txt with content:

[PID]
Value=[youre product key here]

piątek, 22 lutego 2019

Recording application activity

java -XX:+UnlockCommercialFeatures -XX:+FlightRecorder -XX:StartFlightRecording=duration=60s,filename=myrecording.jfr -jar app.jar
source

czwartek, 13 października 2016

Merging all commits in repo to one

Today note copied from Stack Overflow (please consider of backuping your repo before this):
git log --oneline
Copy SHA of first commit and next (it's reset your local repo state withouch changing files):
git reset --soft <SHA of first commit>
Check that everything to commit is green:
git status
Commit your changes (--amend fixes last commit), you can change commit message by adding "-m <your new message>":
git commit --amend
Push your changes:
git push --force

środa, 3 sierpnia 2016

Custom and localized messages spring validation API

Put this code inside your web configuration:
    @Bean
    public MessageSource messageSource() {
        return new MessageSourceAutoConfiguration().messageSource();
    }
    
    @Bean(name = "validator")
    public LocalValidatorFactoryBean validator()
    {
        LocalValidatorFactoryBean bean = new LocalValidatorFactoryBean();
        bean.setValidationMessageSource(messageSource());
        return bean;
    }
     
    @Override
    public Validator getValidator()
    {
        return validator();
    }
and in validation annotation use:
@NotBlank(message = "{not.blank.message}")
private String foo;

In your classloader put file /messages_en.properties:
not.blank.message=Custom not blank message

czwartek, 9 czerwca 2016

Single quote and xargs in Bash

xargs strips single quote mark from input, so if you want pass some data by xargs you will se error:
user:~/$ echo "This is single quote: '" | xargs -I {} echo {}
xargs: unmatched single quote; by default quotes are special to xargs unless you use the -0 option
To do this properly it is necessary to add "-0" parameter:
user:~/$ echo "This is single quote: '" | xargs -0 -I {} echo {}
This is single quote: '
Or use sed:
user:~/$ echo "This is single quote: '" | sed "s/'/\\\\'/g" | xargs -I {} echo {}
This is single quote: '
Et voilà!

piątek, 15 kwietnia 2016

piątek, 8 kwietnia 2016

PrimeFaces remoteCommand with parameters

HTML view:
<p:remoteCommand name="remoteCommandName" actionListener="#{mBean.remoteCommandActionlistener}" />
Backing bean code:
public void remoteCommandActionlistener() {
  String param1 = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap().get("param1");
  String param2 = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap().get("param2");
  System.out.println("param1: " + param1 + ", param2: " + param2);
}
JavaScript call:
remoteCommandName([{name: 'param1', value: 'value1'}, {name: 'param2', value: 'value2'}])

wtorek, 26 maja 2015

Wyłączenie cache HTML/JS

<meta http-equiv="pragma" content="no-cache" />
<meta http-equiv="expires" content="now" />
<meta http-equiv="last modified" content="now" />
<meta http-equiv="expires" content="0" />