If you are reading this post then, probably, you need to execute your java app as a Linux service.
This can be done in 4 really easy steps
sudo nano /etc/systemd/system/MyFantasticJavaApp.service
it will open the nano editor. Add the following, changing the working directory and the User values based on your convenience
[Unit] Description=good old Java application [Service] User=root # The configuration file application.properties should be here: # change this with your workspace WorkingDirectory=/usr/local/javaproject/ #path to executable. #executable is a bash script which calls jar file ExecStart=/usr/local/javaproject/myBashFile SuccessExitStatus=143 TimeoutStopSec=10 Restart=on-failure RestartSec=5 [Install] WantedBy=multi-user.target
save the file (Ctrl-X, select Y(es) and press enter)
Now let’s create a script which will basically call our jar/war file.
This file has to be the one specified in previous service file (what we call in ExecStart value). So, let’s write:
sudo nano /usr/local/javaproject/myBashFile
it will open (again) the nano editor. Add the following 2(two) lines, changing the port and the path to your jar/war file
#!/bin/sh
sudo /usr/bin/java -Dserver.port=7080 -jar /usr/local/javaproject/MyFantasticJavaApp.jar
save the file (Ctrl-X, select Y(es) and press enter)
this is the simpler step. Just write this, changing the file and his path:
sudo chmod u+x /usr/local/javaproject/myBashFile
sudo systemctl daemon-reload
sudo systemctl enable MyFantasticJavaApp.service
sudo systemctl start MyFantasticJavaApp
Et voila! Do not thank me!
This tool is provided by the GPIO Zero Python library,
It allows you to know better the GPIO map of your raspberry. So GPIO number, which are for 5v/3.3v and which are for negatives
Before we can use the pinout tool, we need to first update the package list by running the following command.
sudo apt update
Then, we can install the package that will provide us with the pinout tool by using the command below.
sudo apt install python3-gpiozero
and finally
pinout
Basically the library name is WiringPi, and you can use it to manage many of the functionalities provided by the GPIO header: digital pins, SPI, I2C, UART, etc.
to installi it:
sudo apt-get install wiringpi
to check if the installation went ok:
gpio -v
Ok, now it’s the moment to show it in action:
gpio readall
you should get something like this:
it shows every pin of your raspberry boards and
gpio -g write 33 1
give voltage to pin number 33 gpio -g write 33 0
, remove voltage to that pin number 33)Lately I started to work on a new environment and the first thing has been to install git.
The second thing has been to clone a repository and finally I started to pull and push things.
But! Every time I pulled and pushed something a very nasty little window started bothering me: insert username, insert password (because of course the repository was protected by a password)
And if initially I endured it, after the third time I started to hate it.
So…I decided to save locally my git username and password.
First I had to type this
git config --global credential.helper store
and then
git pull
(or push)
You will be prompt (for the LAST TIME) the git username and password
They will be stored in a .git-credentials file in a clear format like:
https://username:password@repository
Normally this file is saved in your local [username] folder (in windows or linux OS)
There is the possibility to have a secure (and recommended) method using a ssh key. Alternatively you can use a caching timeout way of saving your credentials (just in memory for a limited period of time).
For a complete documentation please refer to:
Every time you release a public (API) software you must update his version number.
The (public) version is universally composed by 3 numbers separated by a point:
Each version number has a semantic representation
The pattern is
Major.Minor.Patch
Ex: in version number 10.2.5
10 is the Major version
2 is the Minor version
5 is the Patch version
All of these 3 numbers are always
Incremented
NEVER decremented
Positive starting by 0
It is incremented each time the release is about fixing some bug without affecting the already existing public interface
So if you see a version number like: 1.1.5 it means the last 5 releases were about fix bugs.
As opposed to Patch, Minor means that they have been released new (interesting) public feature, without impacting old ones.
When there is a new Minor release the Patch number is restarted to 0. Of course, together to new feature, it’s possible that also some bug fixes have been released (even though the Patch number is 0)
When the Major number is incremented the release contains new (fantastic) features, buuuut it means that all the old features are not anymore compatible! So if you depend on those, pay attention.
If you think about it, these versioning rules could be applied also to humans.
Each 1st of January we always have new proposals for our self, so it’s like we “would” change our Major version. Or whenever we learn something new we could upgrade our Minor version.
But when do we change our Patch Number? Maybe each time we have makeup?
right click –> Source –> generate toString() –> Generated code fieldset –> Edit button –> New.. button –> give a name (ex. JSON) –> copy and paste this pattern:
{"${member.name()}":"${member.value}", "${otherMembers}"}
That’s it.
Hope this help!
Course to acquire the business acumen to:
What I learned: