Quick Tip: Sync fork with original repo

1. Clone fork:

2. Add remote from original repository:

3. Update fork with changes from original repo:

Related:

 

 

Spring Boot CLI Hello World

Spring Boot CLI

For quickly getting some http endpoints up for prototyping I usually go with Spark for Java or Flask for Python. I’m also a fan of Spring Framework though I haven’t had a chance to work with it lately. Thinking of catching up again and checking out version 5, maybe with Kotlin. Spring Boot is great for getting a solid application up quickly. Looks like Spring Boot CLI might be an option for Java prototyping. I’m adding the minimal steps to expose an endpoint with plans to expand it later.

https://docs.spring.io/spring-boot/docs/current/reference/html/getting-started-installing-spring-boot.html#getting-started-installing-the-cli

Install

Create App

View in browser

Resources

  • http://www.baeldung.com/spring-boot-cli
  • http://zetcode.com/springboot/groovycli
  • https://www.concretepage.com/spring-boot/spring-boot-cli-example
  • https://www.infoq.com/articles/microframeworks1-spring-boot

Working with Elasticsearch Snapshots

Create a snapshot

View existing repositories
curl -XGET 'localhost:9200/_snapshot/_all?pretty=true'

Create a directory accessible to the user running elasticsearch
mkdir backup
chown -R elasticsearch:elasticsearch /path-to/backup

Let elasticsearch know about path.repo (or in elasticsearch.yaml)
./bin/elasticsearch -Dpath.repo=/path-to/backup

Create a snapshot repo

Take a snapshot
curl -X PUT "localhost:9200/_snapshot/osm/snapshot_1?wait_for_completion=true"

Restore from Snapshot

todo…

Hungarian trunk prefix 06. To use or not to use.

…. another day at work and another question about phone numbers and formats. This time a question about Hungarian phone numbers and more specifically the usage of the 06 trunk prefix.  For a random number +36 1 20 22222, Google’s libphonenumber library currently formats the “NATIONAL” format as (1) 202 2222

(v 8.8.10)

The customer says this should include the 06 prefix which from looking at the Telephone numbers in Hungary I tend to agree with.

However, it seems this has already been brought up as a libphonenumber issue but it was closed with the explanation that  (1) 202 2222 is how you write it down on a paper(?) and  06 (1) 202 2222 is how you dial it from a mobile phone. But from what I can tell the 06 prefix is included in all the dialing permutations:

Mobile-mobile
Mobile-landline
Landline-mobile
Landline-landline

With the exception of landline-landline within the same area as well as possibly mobil-mobile within the same network. Based on that I think the suggested solution of using the formatNumberForMobileDialing is not satisfactory.

I posted the question on Quora: https://www.quora.com/When-do-I-include-the-06-trunk-prefix-when-dialing-within-Hungary and got conflicting answers.

Found some Hungarian coworkers to suggested that 06 the norm and referring to government webpages like:

Website of the Hungarian goverment
http://www.kormany.hu/hu/nemzetgazdasagi-miniszterium/elerhetosegek 06-1-795-7977

Tax Authority
https://nav.gov.hu/nav/kapcsolat 06 (80) 20-21-22

Seems it’s also getting more common these days to just dial using the country code +36 1 808 8125 even within the country and in many cases that’s the only number format provided.
Let’s see if I the libphonenumber maintainers will reconsider changing the default national format to include 06 so I don’t have to do a one off fix for Hungarian. What’s next?

Java Iterator and Iterable

So this question came up in a job interview not too long ago:

Implement a method that takes as a parameter a varargs of Iterables and returns a unified Iterator (without merging the the passed in Iterables into some collection)

Creating a custom Iterator and/or Iterable is pretty basic stuff but admittedly I can’t remember the last time I’ve done it. While I know that implementing Iterator requires at least implementing the hasNext and next method and I kinda forgot what the purpose of Iterable basically just means that you are providing the iterator() method, duh. Anyway, I obviously need some refreshers but in the mean time here’s my future white boarding solution

 

Shortcuts and Cheat sheets

Bash Scripting Cheat Sheet

https://devhints.io/bash

Emacs Edit Mode Keyboard Shortcuts

http://www.catonmat.net/download/readline-emacs-editing-mode-cheat-sheet.pdf

Emmet Cheat Sheet

http://docs.emmet.io/cheat-sheet/

IntelliJ Keyboard Shortcuts

https://www.jetbrains.com/help/idea/keyboard-shortcuts-by-category.html
https://www.jetbrains.com/help/idea/keyboard-shortcuts-by-keystroke.html
https://www.jetbrains.com/help/idea/adding-deleting-and-moving-code-elements.html
https://www.jetbrains.com/help/idea/navigating-through-the-source-code.html

Mac Keyboard Shortcuts

https://support.apple.com/en-us/HT201236

Markdown Cheat Sheet

https://guides.github.com/pdfs/markdown-cheatsheet-online.pdf
https://daringfireball.net/projects/markdown/basics

Scala Cheat Sheet

http://docs.scala-lang.org/cheatsheets/index.html

Vim Cheat Sheet

https://vim.rtorr.com/

Subversion

Basic

Changelist

References

SSH, SCP, SFTP

SSH (Secure Shell)

SCP (Secure Copy Protocol)

SFTP (Secure FTP)

References and Resources

Bash Keyboard Shortcuts