Paul's Tech Blog
Saturday, January 12, 2019
Tuesday, October 11, 2016
Docker Cookbook
# Run this command to configure your shell: eval "$(docker-machine env default)" # Delete all STOPPED docker containers docker rm $(docker ps -aq) # Delete all docker images (won't delete the images associated with running containers) docker rmi $(docker images) # Start a MySQL docker container docker run -d -e MYSQL_ROOT_PASSWORD=password1 -e MYSQL_USER=psun -e MYSQL_PASSWORD=password1 -e MYSQL_DATABASE=psun_db --name mysql -p 3306:3306 mysql:latest # Launch an interactive terminal to a running docker container docker exec -it <container name> bash # Show the container's latest 100 stdout logs docker logs <container name> | trail -n 100 # Follow a container's stdout docker logs -f <container name>
Monday, October 10, 2016
Linux command cheat sheet (service diagnostic)
#Find certain service's listening ports
sudo netstat -tulpn | grep <service name>
Monday, August 22, 2016
Linux shell cheat sheet
ps aux
a = show processes for all users
u = display the process's user/owner
x = also show processes not attached to a terminal
Monday, December 7, 2015
How to create a MySQL docker contianer and use it in Spring Boot Data Access developement (Windows 7, Java)
This article is to document how to create MySQL docker container and use it in Java development.
Create a MySQL docker container
- Install docker toolbox (in this case, I use 1.9.1c)
- Open docker terminal
- Run following command
$ docker run --detach --env MYSQL_ROOT_PASSWORD=password1 --env MYSQL_USER=psun
--env MYSQL_PASSWORD=password1 --env MYSQL_DATABASE=netgloo_blog --name mys
ql --publish 3306:3306 mysql:latest
Run SQL command in the existing docker container
- Run following command to bring up a terminal with existing docker container
docker exec -it mysql bash - Now you should enter the bash prompt. So you can run following command to log into mysql -u root -p;
- You should enter mysql prompt. You can use following commands to do sql query
show databases;
use [database_name];
show tables;
select ... from ...;
docker-machine ip default
In my case, it's 192.168.99.100Clone the spring boot sample from https://github.com/netgloo/spring-boot-samples/tree/master/spring-boot-mysql-springdatajpa-hibernate
Open the project and modify IP and MySQL user credential in application.properties file.
# Connection url for the database "netgloo_blog"
spring.datasource.url = jdbc:mysql://192.168.99.100:3306/netgloo_blog
# Username and password
spring.datasource.username = root
spring.datasource.password = password1
After that run the project by running
mvn spring-boot:run
Wednesday, November 18, 2015
Dos command notes
::check which process is using port 8080
netstat -ano | findstr 8080
::kill a process
taskkill /PID 1234 /F
Thursday, June 18, 2015
Eclipse vs Visual Studio -- Common Operation
| Eclipse | Visual Studio | ||
Code Navigation
|
|||
| Go to declaration | F3 | F12 | |
| Find all references | Shift+F12 | There is no default shortcut in Eclipse. You can access it in context menu. Also you can define your own shortcut. There are different scope choices when you want to find all references. They are workspace, project, hierarchy. |
|
Debug
|
|||
| Step Over | F3 | F10 | |
Subscribe to:
Posts (Atom)
