I used the following to loop over the lines in a file, while prompting the user for a key press on each iteration:
while read -u 3 line ; do #clear the screen printf "\033c" echo "$line"; echo # do something with the $line here read -n 1 -s -p "[Press any key to continue]" done 3< "some-file.txt"
The reading of the lines is done via file descriptor 3 to avoid interference with the reading of the user’s key presses.
My resume website http://oliver.doepner.net/ now has a new scaling background image and uses the Open Sans web font. I hope it looks nice. Any feedback is welcome.
Anil Gaul’s keynote showed a JEE8 plan with new scope and release targets.
Oracle says JEE must adjust to trends like cloud and microservices.
More details are in the “Java EE 8 Update” by Linda DeMichiel:
I found the basic idea here, the exact steps are:
- Install Portable 7zip
- Download Oracle JDK installer for Windows (*.exe)
- Run 7-ZipPortable.exe from your Portable 7zip
- In 7zip find and right-click the jdk installer exe file
- From the context menu use 7-Zip – Open Archive and then Extract
- Now extract the resulting “tools.zip” to a folder that is writable for you
- Open a cmd.exe, cd into the folder and execute this:
for /R %f in (.\*.pack) do @"%cd%\bin\unpack200" -r -v -l "" "%f" "%~pf%~nf.jar"
Kudos to Nick Russler for figuring out this tricky unpack200 command line!
Determine process id
First we determine the process id(s) of the running Tomcat instance(s).
We can grep the running process list for ‘catalina.home’:
pgrep -f 'catalina.home'
This might yield more than one pid.
Or we can search by port (8080 is the default, adjust if necessary). The following commands will likely require root privileges:
lsof -t -i :8080
Alternatively, for example if lsof is not installed:
Or yet another way, using netstat (or its “ss” replacement):
netstat -nlp | grep 8080
ss -nlp | grep 8080
For the process id(s) determined above, we look at process details:
ps -o pid,uid,cmd -p [pidlist] | cat
For each specified pid, this shows the uid (system user) and the full command line of the process.
Typically the command line will contain something like “-Dcatalina.home=[path]” and that path is the catalina.home system property of the Java process.
Alternatively – with Java 7 and later – we can use the JDK command “jcmd” to query the JVM process for its system properties:
sudo -u [uid] jcmd [pid] VM.system_properties \ | grep '^catalina.home' \ | cut -f2 -d'='
Now we can finally determine which Tomcat version is installed under the catalina.home path:
[catalina.home]/bin/catalina.sh version \ | grep '^Server number:'
Note: Please replace
[catalina.home] with the path you determined above.
The final output should be something like this:
Server number: 22.214.171.124
Suggestions for other/better Free/Open Source plugins for current Intellij CE are welcome:
Let’s say you work on a Java application and want to frequently make it available for download so that user’s can easily try the latest version.
Let’s say you work primarily on your laptop or personal computer using a Java IDE and commit code changes, but you don’t want to spend time manually building jars, packaging war or zip files, testing your application or uploading files to a website, etc.
Instead you want to have a fully automated process that compiles your source code, runs automated tests and other quality control mechanisms, builds your application and uploads the result to a public website.
But you don’t want to install any infrastructure for this and not run anything besides Java and your IDE on your own machine(s).
Basically you want to use developer-friendly reliable cloud services but you don’t want to pay a single cent.
All of this is possible, as long your code is Open Source:
- Host your source code on github
- Let travis-ci run vour build process
- Let travis-ci upload the build result to bintray
For details, you can take a look at one of my github projects.
Relevant config files:
Soon I will probably add more detailed instructions to this blog post on how to set up the cloud services.