Skip to main content


Showing posts from August, 2018

PART 2 [Front end] - Docker for Angular + Spring Boot

this the second part of dockerizing an angular 6 and spring boot app

Part 1 here:

I followed this blog:

so basically three steps:

1- create docker file
2- create docker compose
3- docker-compose build .. docker-compose up

here is the files I'll be explaining to achive this:

1- Dockerfile
This docker file uses multi stage build, which means it uses multiple docker images to produce final image.


because the image we need to build the angular app requires alot of dependencies that are not needed to run the app.

in the first part of the docker file:
- it starts based on a node image
- prepares the app directory
- copies package.json from the source code directory to the docker container directory
- executes npm install which will install all node dependencies.
- install angular cli globally (version 6)
- copy everything from the root dire…

PART 1 [Backend] - Docker for Angular + Spring Boot

I have been working on an angular 4 (upgraded to 6) application backed by spring boot rest api, repositories:
1- api:
2- angular:

and this post is about using and adding docker to these apps to make it easier to deploy and share.

Disclaimer: this is not by any means a best practice article, but was more of a hands on way to learn more about Docker work flow and challenges that one may face.

Part 1: Dockerizing the backend project (nutracker-api) I was testing this process on amazon micro instance and these are the steps I followed:

pre requisite:
- install docker on aws:
1- add docker file (point to a built jar for now) reference:

this docker file is simple
- gets a jdk image
- copies our pre built jar from the build output directory
- starts the jar (which is a sp…

Setting up TensorFlow backed Keras with GPU in Anaconda - Windows

I wanted to use my GPU instead of CPU in Keras, after knowing that it supports CUDA, for a simple deep learning example training, so I had to do some search on how to set it up and ended with this summary:

Pre requisites :
1- Anaconda installed
2- setup Nividia CUDA 9.0
3- setup Nividia cuDNN 7 (for CUDA 9.0)


0) run Anaconda Prompt

1) install conda packages
conda create --name tf-gpu-keras-p35 python=3.5 pip
activate tf-gpu-keras-p35
conda install jupyter
conda install scipy
conda install scikit-learn
conda install pandas
pip install tensorflow-gpu
pip install keras

The following didn't work for me:
(didn't work with keras, keras installed tensorflow 1.1.0) keras keeps overriding the tensorflow-gpu
you get empty tensorflow module
conda install -c conda-forge keras
conda install -c conda-forge keras-gpu

Hibernate Objects,Sessions across threads - Illegal attempt to associate a collection with two open sessions

In the land of Hibernate a concept of Session is important.
it plays the role of tracking changes that happen to (hibernate objects) from the moment you open it.
and you can't actually do much without it, it's your entry to hibernate capabilities

so if you want to load an object you have to obtain a session instance first then load the object:

Session s = sessionFactory.getCurrentSession();
MyObject mo = s.byId(MyObject.class).load(123);

now that object (mo) is associated with that session
if you do something like

mo.setName('new Name');

the session will track that this object is dirty. and it does much more that you can read about.

What I want to get to is that in case you have to do some background work with your object you have to be careful that:
1- the session is not thread safe (i.e. it can't be passed between threads and assume no concurrency issues will happen)
2- the objects associated with one session cannot be associated with another open session

so if …