Posts

Spring Core - Different Types of Bean Injection

Image
1. Overview Dependency Injection is a very common technique in software engineering whereby an object supplies the dependencies of another object. Means that DI is about passing a dependency object to another a dependent object.
Assume we have a client and a service that would be used by the client. We pass the service to the client rather than allowing the client to build it. DI is commonly related to a wide known taxonomy which is Inversion of control aka IoC. But simply, IoC is a more general than the DI. IoC means letting the other code call you rather than insisting od doing the calling.
All of this is managed through the Spring Container which requires some sort of configurations that are presented through XML-based configuration or Annotation-based configuration. We will focus on the Annotation-based one in the below subjects.
2. Maven Configuration We need to make sure that Spring core and JUnited dependencies exists in our pom.xml
<properties> <!-- Spring --> &…

Tips: Some common Git commands

- git status

- Revert deleting a file
git reset HEAD <file>

- Checking out
git checkout <branch_or_tag>

- Check the difference between the origin and the remote:
git diff origin/Nightly

- git add
- git add .
- git push origin <branch>
- git commit -a -m "message"
- git checkout <branch>
- git log
- git checkout -- .
- git pull origin
- git cherry-pick <commit_id>
- git reset HEAD~
- git log -p filename

- Hard reset
git reset --hard origin/Nightly

- Clean the untracked files/directories
git clean -f -d

- git fetch --all
- git reset --hard origin/master

Tips: Few common Docker commands and tutorials

- Install docker compose
https://docs.docker.com/compose/install/

- List all running containers
docker ps

- List all the running and non-running containers
docker ps -a

- List all images in repository
docker images
or
docker images -a

- Display the logs
docker logs <container_name>

- Display the current running containers
docker ps -q

- Stop all the running containers
docker stop $(docker ps -q)

- Remove the container
docker rm

- Remove the image
docker rmi

- Can't remove container while it's running. You should stop and then remove

- Docker tutorials
https://www.youtube.com/playlist?list=PLkA60AVN3hh_6cAz8TUGtkYbJSL2bdZ4h

- Starting docker compose
docker-compose up -d

- Stopping docker compose
docker-compose down

Tip: Configure using Meld Diff Viewer for git diff and git difftool

Run the below two commands for configuring Git to use Meld Diff Viewer on Ubuntu Linux:
git config --global diff.tool meld git config --global difftool.prompt false

Back Again, Weekly Readings - Week Ending 8 July 2016

It's been a long long time since I wrote a post here. A lot of changes and obstacles were around but I'm planning to get back to focusing on writing here again. I also have some plans that I'm currently working to present more useful subjects in a more interactive way like going for YouTube videos.
Well, let's warm up and start with sharing some useful readings as articles and books that I have recently checked and I believe they would spot on new subjects or discuss useful ones. From DZone:3 Reasons Why People Write Insanely Bad Code: https://dzone.com/articles/3-reasons-why-people-write-insanely-bad-codeThe Developer's Midlife Crisis: What's Next?: https://dzone.com/articles/the-developers-midlife-crisis-whats-nextEclipse Neon has been released and here are some links to get to know more about it:Official page: https://www.eclipse.org/neon/New and Noteworthy: http://www.eclipse.org/eclipse/news/4.6/New features for Java developers: http://www.eclipse.org/ecl…

Java Code Geeks (JCG) Program

Image
I have recently received an invitation to contribute to Java Code Geeks (JCG) and I accepted that. They currently attract over 900,000 unique visitors per month so this would be exciting to spread some words to the community through them. JCG has started pulling my articles from ithinkisink.com to javacodegeeks.com and you can find them on my profile page on JCG: http://www.javacodegeeks.com/author/belal-galal/
For more about the JCG Program and a complete list of the contributors: http://www.javacodegeeks.com/join-us/jcg/

JavaOne 2015 Session: EJB 3.2/JPA 2.1 Best Practices with Real-Life Examples by Gohar

Image
I have recently watched my friend Ahmed Nabil Gohar's session at JavaOne 2015. It's really a clear and straight to the point session. I'm sharing with you the sessions details (inluding the YouTube + the presentation downloadable link) as mentioned in his post.
Session ID: CON7535
Session Title: EJB 3.2/JPA 2.1 Best Practice with life examples (Download Link)
Session Type: Conference Session
Session Abstract:
This session’s speaker, an architect, discusses lessons learned from using JPA and EJB to support a high-volume, high-performance applications. These best practices don't only involve JPA/EJB but also its integration with other Java EE 7 technologies. They also include coding best practices, testing and production practices. The presentation focuses primarily on some Key concepts such as persistence context, lazy loading, caching, flushing, dirty checking, transaction and connection demarcation. This is a fast-paced presentation with many code samples. Categories…