Wednesday, December 7, 2016

Java 8 Date Time Formatting

java.util.Date


DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
Date date = new Date();
System.out.println(dateFormat.format(date)); //2016/12/08 10:15:43
java.util.Calendar


DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
Calendar cal = Calendar.getInstance();
System.out.println(dateFormat.format(cal)); //2016/12/08 10:16:32
java.time.LocalDateTime


DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy/MM/dd HH:mm:ss");
LocalDateTime now = LocalDateTime.now();
System.out.println(dtf.format(now)); //2016/12/08 10:17:12
java.time.LocalDate


DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy/MM/dd");
LocalDate localDate = LocalDate.now();
System.out.println(dtf.format(localDate)); //2016/12/08
java.time.ZonedDateTime

DateTimeFormatter dateTimeFormat = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SSS");
ZonedDateTime zonedDateTime = ZonedDateTime.now();
System.out.println(zonedDateTime.format(dateTimeFormat)); //2016-12-08 00:22:44:66.777
Legacy
https://docs.oracle.com/javase/tutorial/datetime/iso/legacy.html

Javadocs
https://docs.oracle.com/javase/8/docs/api/java/util/Date.html
https://docs.oracle.com/javase/8/docs/api/java/util/Calendar.html
https://docs.oracle.com/javase/8/docs/api/java/time/LocalDate.html
https://docs.oracle.com/javase/8/docs/api/java/time/LocalDateTime.html
https://docs.oracle.com/javase/8/docs/api/java/text/DateFormat.html
https://docs.oracle.com/javase/8/docs/api/java/text/SimpleDateFormat.html
https://docs.oracle.com/javase/8/docs/api/java/time/format/DateTimeFormatter.html

https://docs.oracle.com/javase/8/docs/api/java/time/ZonedDateTime.html

Thursday, November 17, 2016

Mobile Domain Criteria Japanese Network Service Providers

au

^ido\.ne\.jp$
^.*\.ido\.ne\.jp$
^ezweb\.ne\.jp$
^.*\.ezweb\.ne\.jp$

DoCoMo

^docomo\.ne\.jp$
^moco\.ne\.jp$
^i\.pakeo\.ne\.jp$

SoftBank

^jp\-[a-z]\.ne\.jp$
^[a-z]\.vodafone\.ne\.jp$
^softbank\.ne\.jp$
^tu\-ka\.ne\.jp$
^.*\.tu\-ka\.ne\.jp$
^sky\.tu\-ka\.ne\.jp$
^.*\.sky\.tu-ka\.ne\.jp$
^sky\.tk[ck]\.ne\.jp$
^.*\.sky\.tk[ck]\.ne\.jp$
^disney\.ne\.jp$

Other mobile phones

^phone\.ne\.jp$
^mozio\.ne\.jp$
^.*\.mozio\.ne\.jp$
^pdx\.ne\.jp$
^.*\.pdx\.ne\.jp$
^willcom\.com$
^nttpnet\.ne\.jp$
^.*\.nttpnet\.ne\.jp$
^pipopa\.ne\.jp$
^.*\.pipopa\.ne\.jp$
^pho\.ne\.jp$
^[a-z]ct\.dion\.ne\.jp$
^mnx\.ne\.jp$
^.*\.mnx\.ne\.jp$
^page\.docomonet\.or\.jp$
^page\.ttm\.ne\.jp$
^mopera\.ne\.jp$
^.*\.mopera\.ne\.jp$
^radio\.mtc\.co\.jp$
^.*\.i\-get\.ne\.jp$

More
ocn
yahoob
ymobile

Monday, October 17, 2016

Mastering the art of taking screenshots

TAO of Screenshots

Taking a screenshot on a Windows machine is much much simpler.
Press the special button on the keyboard - "PrtScn"/"PrtScr"/"PrtScrn"
Use Alt to capture only focussed/current window
On Mac, the story is a bit different.

To save a screenshot of the entire screen, use the terminal command,
Remember this, ⌘ Cmd+⇧ Shift+3 captures the whole screen
Use ⌘ Cmd+⇧ Shift+4 take screenshots with specific selections using a crosshair.
Use an additional Ctrl key, to copy to system clipboard for quick pasting.

Tuesday, September 13, 2016

Reducing SERP

Reducing SERP count

site:blogger.com -site:blogger.com/profile -site:blogger.com/blogger.g -site:blogger.com/logout-redirect.g -site:blogger.com/next-blog -site:buzz.blogger.com

Blogger and BlogSpot filtering out domains and subdomains
from browser history, web search history, web access history etc.

Wednesday, July 6, 2016

Read Email on Command Line - Power of AWK

https://mail.google.com/mail/feed/atom

XML

curl -u username:password –silent “https://mail.google.com/mail/feed/atom”
|
tr -d ‘\n’ | awk -F ” ‘{for (i=2; i<=NF; i++) {print $i}}’
|
sed -n “s/\(.*\)<\/title.*name>\(.*\)<\/name>.*/\2 – \1/p”
Bonus

Remove duplicates:
awk ‘!x[$0]++’ <filename>

Thursday, June 23, 2016

Trying out iOS 9.3.3 beta and iOS 10 beta

Apple iOS Developer Beta Builds

To try out iOS 9.3.3 beta, download profile here by loading in Safari on an iOS device.
to try out iOS 10 beta, goto Dev Download page, or install this profile on your iOS device.

Enjoy Siri, ask her which version of iOS it runs on, and confirm it!
Shuffle your playlists, Find books by Ayn Rand, Read Fountainhead. or
Read a haiku. Try 8 ball, Compare 4755 & AMZN. or MSFT & GOOG stocks.
Roll a die, Flip a coin. Do a barrel roll.

Ask Siri who or what is Cortana.
Launch Bing, search for Yahoo, end up at Google. goto ddg.gg
Stop doing that, explore SiriKit, and Get Started with making meaningful apps for humanity's sake.

Thursday, May 26, 2016

Ubuntu Package Install Sequence


  1. sudo add-apt-repository -y ppa:videolan/stable-daily
  2. sudp apt-get install vlc
  3. sudo add-apt-repository -y ppa:otto-kesselgulasch/gimp
  4. sudo add-apt-repository -y ppa:webupd8team/java
  5. sudo add-apt-repository -y ppa:webupd8team/y-ppa-manager
  6. sudo apt-get install y-ppa-manager
  7. sudo apt-get install synaptic
  8. sudo apt-get install gimp gimp-data gimp-plugin-registry gimp-data-extras
  9. sudo apt-get install openjdk-7-jre oracle-java8-installer flashplugin-installer
  10. sudo apt-get install unace unrar zip unzip p7zip-full p7zip-rar sharutils rar mpack arj cabextract file-roller
  11. sudo apt-get install bleachbit
  12. sudo apt-get install uudeview libxine1-ffmpeg mencoder flac faac faad sox ffmpeg2theora
  13. sudo apt-get install libmpeg2-4 uudeview libmpeg3-1 mpeg3-utils mpegdemux liba52-dev mpeg2dec vorbis-tools id3v2 mpg321 mpg123 libflac++6
  14. sudo apt-get install totem-mozilla icedax lame libmad0 libjpeg-progs libdvdcss2 libdvdread4 libdvdnav4 libswscale-extra-2
  15. sudo apt-get install ubuntu-restricted-extras ubuntu-wallpapers*

Wednesday, April 20, 2016

to REST or not to REST

HTTP
REST
SOAP
RPC
API Documentation
Normalization
Denormalization
DB Schema
Indexing
Search by Topic
Caching
Versioning
Depreciation & Appreciation

API Verbs

  1. Change/Update/Modify - POST
  2. Add/Insert - PUT[POST]
  3. Remove/Delete - DELETE
  4. Retrieve/Select/Fetch/Get - GET

Let's do the new!

Monday, April 11, 2016

Exploring the interesting stuff via Flickr API

Today, i set out to make a page to see random flickr images
https://www.flickr.com/services/api/flickr.interestingness.getList.html
Nice API, it worked in a matter of seconds, i could get it done in no time.

and came across Flickr Pandas,
https://www.flickr.com/services/api/flickr.panda.getList.html

Fired up Postman,
Request URL: https://api.flickr.com/services/rest/?api_key=*&method=flickr.panda.getList&format=json

Response JSON:
{
  "pandas": {
    "panda": [
      {
        "_content": "ling ling"
      },
      {
        "_content": "hsing hsing"
      },
      {
        "_content": "wang wang"
      }
    ]
  },
  "stat": "ok"
}

If XML


  ling ling
  hsing hsing
  wang wang

There are 3 Flickr Pandas:

  1. ling ling - ucumari
  2. hsing hsing - lynnehicks
  3. wang wang - perfectpandas

Read more about them here!
I'll explore more soon with null and echo
before i can get ot using
https://www.flickr.com/services/api/flickr.stats.getPopularPhotos.html

Sunday, April 3, 2016

NATO Codes

A
Alpha
B
Bravo
C
Charlie
D
Delta
E
Echo
F
Foxtrot
G
Golf
H
Hotel
I
India
J
Juliett
K
Kilo
L
Lima
M
Mike
N
November
O
Oscar
P
Papa
Q
Quebec
R
Romeo
S
Sierra
T
Tango
U
Uniform
V
Victor
W
Whiskey
X
Xray
Y
Yankee
Z
Zulu

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. ...