Friday, April 10, 2015

Java Mission Control - profiling at your hands

Just add this to your java arg line

-XX:+UnlockCommercialFeatures
-XX:+UnlockExperimentalVMOptions
-XX:-UseFastUnorderedTimeStamps
-XX:+FlightRecorder
-XX:StartFlightRecording=duration=120m,filename=recording1.jfr


when java app exits, file recording1.jfr will be available for viewing with Java Mission Control
since JDK 1.7.40

Thursday, April 9, 2015

Thread stop in Java

Install Oracle's JDK to any linux again

untargz java jdk distro

define JAVA_HOME and export it

cd $JAVA_HOME/bin

fix alternatives - use as root or append sudo

for i in `ls`; do update-alternatives --install "/usr/bin/$i" "$i" "`pwd`/$i" 1; done;


Find files and tar them

/note to myself

Finding files with most powerful utility find sending them to tarball
  find . -maxdepth 2 -type f -print0 | tar -czvf backup.tar.gz --null -T -  

It will:
  • deal with files with spaces, newlines, leading dashes, and other funniness
  • handle an unlimited number of files
  • won't repeatedly overwrite your backup.tar.gz like using tar -c with xargs will do when you have a large number of files

chrome dev tools truncate text in console

Things can get long.
For example location.href.

To copy looong location.href to clipboard with chrome dev tools use 

copy(location.href)

Start Google Chrome on Android Emulator

Prepare Android emulator

  • Use Android emulator with enabled GPU - start emulator with -gpu on 
  • Use larger system and data partition - start emulator with -partition-size 1024


Get a binary of Chrome - I use apk from http://www.apkmirror.com/apk/google-inc/chrome/

adb install com.android.chrome...apk


For web test automation one can use appium bundled with chromedriver, as well as chromedriver solely.