Wednesday, May 27, 2015

Things to do on Fresh Linux installation

sudo apt-get install synaptic vlc gimp gimp-data gimp-plugin-registry gimp-data-extras y-ppa-manager bleachbit openjdk-7-jre oracle-java8-installer flashplugin-installer unace unrar zip unzip p7zip-full p7zip-rar sharutils rar uudeview mpack arj cabextract file-roller libxine1-ffmpeg mencoder flac faac faad sox ffmpeg2theora libmpeg2-4 uudeview libmpeg3-1 mpeg3-utils mpegdemux liba52-dev mpeg2dec vorbis-tools id3v2 mpg321 mpg123 libflac++6 totem-mozilla icedax lame libmad0 libjpeg-progs libdvdcss2 libdvdread4 libdvdnav4 libswscale-extra-2 ubuntu-restricted-extras ubuntu-wallpapers*


  1. synaptic is a package manager, which we use in many tutorials.
  2. vlc is one of the most popular and powerful media players available.
  3. gimpgimp-datagimp-plugin-registry, andgimp-data-extras are all parts of a powerful photo editor, built to rival Adobe Photoshop.
  4. y-ppa-manager is there so you can manage PPAs without needing to use the Terminal.
  5. bleachbit is a powerful cleaning utility.
  6. openjdk-7-jre is an open-source Java emulator.
  7. oracle-java8-installer is the official Java installer.
  8. flashplugin-installer is the official Flash installer.
  9. unaceunrarzipunzipp7zip-fullp7zip-rarsharutilsraruudeviewmpackarj,cabextract, and file-roller are there to extract and compress files in various archive formats.
  10. libxine1-ffmpegmencoderflacfaacfaad,soxffmpeg2theoralibmpeg2-4uudeview,libmpeg3-1mpeg3-utilsmpegdemuxliba52-devmpeg2decvorbis-toolsid3v2mpg321,mpg123libflac++6totem-mozillaicedax,lamelibmad0libjpeg-progslibdvdcss2,libdvdread4libdvdnav4libswscale-extra-2and ubuntu-restricted-extras are all media codecs. They play videos, music, and DVDs.
  11. ubuntu-wallpapers* adds basically every wallpaper that has ever lived.

Sunday, May 17, 2015

Exploring java.time package

Forget Java.Date and Java.Calendar,
try Java.Time!

Source Code

//生年月日
LocalDate bf=LocalDate.of(1992,12,16);
LocalDate rf=LocalDate.of(2015,12,19);
Clock c=Clock.systemUTC();
Clock d=Clock.systemDefaultZone();
LocalDate n=LocalDate.now();//c or d
dump("Current Instant : "+Instant.now());
dump("Current Instant as per System UTC: "+Instant.now(c));
dump("Current Instant as per System Default Timezone : "+Instant.now(d));
dump("Birthdate -> "+bf);
dump("DoM : " +bf.getDayOfMonth()+" of "+bf.lengthOfMonth()+"-day long "+bf.getMonth());
dump("DoY : "+bf.getDayOfYear()+" of "+bf.lengthOfYear()+"-day long "+bf.getYear());
dump("Today -> "+n);
Period yet=bf.until(n);//Duration equivalent in terms of Days
//年齢
dump("Age : -> "+yet.getYears()+" years "+yet.getMonths()+" months "+yet.getDays()+" days");
dump("Today -> "+n);
dump("Flight -> "+rf);
Period more=n.until(rf);//Try Duration for time to sleep, go home or wake up.
dump("Return : -> "+more.getYears()+" years "+more.getMonths()+" months "+more.getDays()+" days");

Wet Run - Sample Output

Current Instant : 2015-05-18T07:55:55.178Z
Current Instant as per System UTC: 2015-05-18T07:55:55.192Z
Current Instant as per System Default Timezone : 2015-05-18T07:55:55.192Z
Birthdate -> 1992-12-16
DoM : 16 of 31-day long DECEMBER
DoY : 351 of 366-day long 1992
Today -> 2015-05-18
Age : -> 22 years 5 months 2 days
Today -> 2015-05-18
Flight -> 2015-12-19
Return : -> 0 years 7 months 1 days

Monday, May 11, 2015

Common Regular Expressions

IP Address Regexp

\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b

MAC Address Regexp

^([0-9a-fA-F][0-9a-fA-F]:){5}([0-9a-fA-F][0-9a-fA-F])$

Domain Name Regexp

^([a-zA-Z0-9]([a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,6}$

Floating Point Number Regexp

[-+]?(?:\b[0-9]+(?:\.[0-9]*)?|\.[0-9]+\b)(?:[eE][-+]?[0-9]+\b)?

Roman Number Regexp

^(?i:(?=[MDCLXVI])((M{0,3})((C[DM])|(D?C{0,3}))?((X[LC])|(L?XX{0,2})|L)?((I[VX])|(V?(II{0,2}))|V)?))$


Going one step further with Kotlin & gRPC

Recently, I tried using Quarkus with Kotlin for grpc. I have worked with grpc for communication between microservices in Java & Golang. ...