Monday, 25 September 2017

Intro to Machine learning:python setup

Tried many versions/flavours of python but this is finally working:

while setting up python for machine learning.
I followed the below steps :-
Install python-2.7.13.msi
• set PATH=C:\Python27
• set PATH=C:\Python27\Scripts
Downloaded:- • numpy-1.13.1+mkl-cp27-cp27m-win32.whl 
                       • scipy-0.18.0-cp27-cp27m-win32.whl
Installing numpy: pip install numpy-1.13.1+mkl-cp27-cp27m-win32.whl
Installing scipy: pip install scipy-0.18.0-cp27-cp27m-win32.whl
You can test the correctness using below cmds:-
>>> import numpy
>>> import scipy
>>> import sklearn
>>> numpy.version.version
'1.13.1'
>>> scipy.version.version
'0.19.1'
>>>

Good things of doing this course:-

  • Helped me in beliving that I can learn Machine Learning.
  • Very interactive,you will not get bored
  • Nice simple exercises,me being new to python running my code in python is very Joyful.
  • Andrew's classes were very therotic and mathematical,one needs great concentration in understanding those concepts.

Friday, 22 September 2017

Dive in to Python world from Java


 Personal review:-

  •  python is very easy to learn if you are coming from java background.
  • Like Java, python is very vast,Target what you want to learn. For me I needed python knowledge as I am starting working on Machine Learning.
    • It has lot of math tools n libraries required for Machine Learning

Thursday, 21 September 2017

Hibernate short notes


  • Transient
  • Persistance
  • Detached


Save() - hibernate function,it will return generated key
Persist() - JPA function works same as save(),return type is void
Merge() - JPA function,return type is void
Update() - hibernate function
saveOrupdate() - hibernate function


Different between session.get() and session.load():-

Actually, both functions are use to retrieve an object with different mechanism, of course.

1. session.load()
• It will always return a “proxy” (Hibernate term) without hitting the database. In Hibernate, proxy is an object with the given identifier value, its properties are not initialized yet, it just look like a temporary fake object.
• If no row found , it will throws an ObjectNotFoundException.
2. session.get()
• It always hit the database and return the real object, an object that represent the database row, not proxy.
• If no row found , it return null.

Wednesday, 20 September 2017

Spring Notes

Bean Scopes in Spring:

singleton

prototype

request

session

global-session

Good question: How spring Handles singleton?
https://stackoverflow.com/questions/42376756/how-spring-singleton-scope-for-dao-class-works-internally

Notes on Singleton Pattern and Immutable Objects

Where exactly the Singleton Pattern is used in real application?

  • ·       Logger
  • ·       DB Connection

 A Strategy for Defining Immutable Objects

  1. Don't provide "setter" methods — methods that modify fields or objects referred to by fields.
  2. Make all fields final and private.
  3. Don't allow subclasses to override methods. The simplest way to do this is to declare the class as final. A more sophisticated approach is to make the constructor private and construct instances in factory methods.
  4. If the instance fields include references to mutable objects, don't allow those objects to be changed:
    • Don't provide methods that modify the mutable objects.
    • Don't share references to the mutable objects. Never store references to external, mutable objects passed to the constructor; if necessary, create copies, and store references to the copies. Similarly, create copies of your internal mutable objects when necessary to avoid returning the originals in your methods.

Monday, 18 September 2017

Autowiring in Spring

Autowiring can be done on:


  • directly into fields/attributes
  • via explicit setter methods
  • via explicit constructor parameters

Sunday, 17 September 2017

Spring Boot application in AWS

Hosted my first Spring Boot application in AWS today,with mysql DB.

Reference:- https://aws.amazon.com/blogs/devops/deploying-a-spring-boot-application-on-aws-using-aws-elastic-beanstalk/

URL:- http://springbooteb-svk-prod.us-east-2.elasticbeanstalk.com/
 http://springbooteb-svk-prod.us-east-2.elasticbeanstalk.com/people

 Its easier than i expected,though its not a cake walk for beginners, one with prior knowledge of deployment in various scenarios only will be able to succeed in the first go.

Installing Docker and Minikube

  install docker-   sudo apt install docker.io   set user to docker group:- sudo gpasswd -a   {user} docker   imp commands:- ...