Saturday, April 29, 2017

CountryMan

  1. http://stackoverflow.com/users/245679/md-sayem-ahmed
  2. https://github.com/sayembd/cs-video-courses
Data Structure:
==============
1. Linked Lists
2. Trees,Tries, &Graphs
3. Stacks & Queues
4. Heaps
5. Vectors/ Arraylists
6. Hash Tables

Algorithm:
==========
1. Breadth-First Search
2. Depth-First Search
3. Binary Search
4. Merge Sort
5. Quick Sort

Concepts:
=========
1. Bit Manipulation
2. Memory (Stack vs. Heap)
3. Recursion
4. Dynamic Programming
5. Big O Time & Space

Thursday, April 20, 2017

Maven Dependency tree with resolution procedure

Maven – Display project dependency


1. mvn dependency:tree
In Maven, you can use mvn dependency:tree to display the project dependencies in tree format.

Resource Link: https://www.mkyong.com/maven/maven-display-project-dependency/

----------------------------------------------------------------------------------------------------------------------
2. You can use the following command to get a list of plugin dependencies (resolve-plugin goal from dependencies plugin):
mvn dependency:tree -Dincludes=org.apache.logging.log4j:log4j-1.2.17
-----------------------------------------------------------------------------------------------------------------------

3.
mvn dependency:resolve-plugins

It resolves all plugin. But there is a issue. resolve-plugins doesn't just output the dependency tree... it seems to re-download all of the packages. Not ideal.

Resource Link: http://stackoverflow.com/a/7079876/4748635

------------------------------------------------------------------------------------------------------------------------
4. Resolving conflicts using the dependency tree

mvn dependency:tree -Dverbose -Dincludes=commons-collections

mvn dependency:tree -Dverbose -Dincludes=log4j

Resource Link: https://maven.apache.org/plugins/maven-dependency-plugin/examples/resolving-conflicts-using-the-dependency-tree.html

Linux Commands Understanding

sudo apt update && sudo apt install pinta

&&
---
For Linux beginners, the double ampersand tells bash, the default shell program on Linux, to run the next command only after the previous command is complete


sudo apt-get update && sudo apt-get install pinta
-------------------------------------------------------------------------------------------------------------------
lsof:
------
rizvi@ronty-HP-ProBook:~/workspace/mittal_dev_web$ sudo lsof -i:8080
[sudo] password for rizvi:
COMMAND  PID USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
java    1222 root   43u  IPv6  20794      0t0  TCP *:http-alt (LISTEN)

rizvi@ronty-HP-ProBook:~/workspace/mittal_dev_web$ sudo kill -9 1222

lsof is a command meaning "list open files"
----------------------------------------------------------------------------------------------------------------------

Wednesday, April 19, 2017

Rules of Breaking Rules by Hiroshi Mitikani

rules for breaking rules:
  1. Know the reason. Rules should be broken for myriad reasons. Breaking an old rule could introduce you to new efficiencies. Hire someone whose strength is your weakness and open yourself to a new way of thinking. Ignore your competition and focus on doing things differently and exceeding your customer’s expectation.
  2. Allow for time.  Rule breaking sounds like it should be a quick process, but it’s not. To rewrite a rule, it may take time to make your case, alter your actions, bring others around to your way of thinking. If you are committed to breaking a rule, you must also commit to the time it will take.
  3. It never ends. I have been challenging and rewriting the rules of my business since I entered into it and I probably always will. Business is not static. It is ever changing and so the rules much change with it. When you follow a path of rule breaking, you can expect it to be long and busy.

Wednesday, April 12, 2017

www.hibernatespatial.org is dead? What will be the solution?

Exception:
-------------
11:24:27.580 [INFO] [org.apache.http.impl.execchain.RetryExec] I/O exception (java.net.SocketException) caught when processing request to {}->http://www.hibernatespatial.org:80: Connection reset
11:24:27.580 [DEBUG] [org.apache.http.impl.execchain.RetryExec] Connection reset
java.net.SocketException: Connection reset
        at java.net.SocketInputStream.read(SocketInputStream.java:196)
        at java.net.SocketInputStream.read(SocketInputStream.java:122)
        at org.apache.http.impl.io.SessionInputBufferImpl.streamRead(SessionInputBufferImpl.java:139)
        at org.apache.http.impl.io.SessionInputBufferImpl.fillBuffer(SessionInputBufferImpl.java:155)

Root Cause Analysis:
--------------------------
The javadoc for SocketException states that it is

    Thrown to indicate that there is an error in the underlying protocol such as a TCP error

So, here the actual case is,
When the command "gradle bootRun" is trying to access this maven repo "http://www.hibernatespatial.org:80", it fails. Because this repo is dead.

Resource Link:
1. http://stackoverflow.com/a/585643
2. http://stackoverflow.com/a/4300803

Solution Procedure#1:
----------------------------
Hibernate Spatial has been merged into Hibernate ORM 5.0. The hibernatespatial.org site will be discontinued, along with the Maven Repository.

The ideal solution would be to upgrade to a 5.0.x version that is on maven central https://mvnrepository.com/artifact/org.hibernate/hibernate-spatial.

Solution Procedure#2:
----------------------------
As the repo is dead, so it is required to search for another repo which can give access for related file.

The versions 4.0 and 4.3 can be found on this repo: http://nexus.e-is.pro/nexus/content/groups/public/org/hibernate/hibernate-spatial/

Resource Link:
1. http://stackoverflow.com/a/38480566

You can choose 2nd solution procedure.

Now the build.gradle file looks like below:

    repositories {
        mavenCentral()
        mavenLocal()
        maven { url "http://repo.spring.io/snapshot" }
        maven { url "http://repo.spring.io/milestone" }
        maven { url "http://download.osgeo.org/webdav/geotools" }
        // maven { url "http://www.hibernatespatial.org/repository" } //dead link
        maven { url "http://nexus.e-is.pro/nexus/content/groups/public/" }
    }

Tuesday, April 4, 2017

Java Naming Convention for function name, variable name, class name and constant

There are 3 methods to name an identifier:

Camel case: used to name a function,variable
e.g: int streamJavaMethod() or for variable, arrayBoss;



Pascal case: used to name a class
e.g: class StreamJavaClass()

upper case: used to name constants
e.g.: PIE
Constants
The names of variables declared class constants and of ANSI constants should be all uppercase with words separated by underscores ("_"). (ANSI constants should be avoided, for ease of debugging.)

static final int MIN_WIDTH = 4;

static final int MAX_WIDTH = 999;

static final int GET_THE_CPU = 1;