Play Framework not working after updating macOS to Catalina - java-8

I was using play framework in mac. After updating the macOS to Catalina. I am not able to run the command "play deps",which was working fine earlier.
I want to run play deps, to download dependencies, but seeing this error -
jyotimahansaria#Jyotis-MacBook-Pro ~/Documents/Bytemark/Backend_Work/play-1.3.1/myApp $ play deps
~ _ _
~ _ __ | | __ _ _ _| |
~ | '_ \| |/ _' | || |_|
~ | __/|_|\____|\__ (_)
~ |_| |__/
~
~ play! 1.3.1, https://www.playframework.com
~
Error: Could not find or load main class play.deps.DependenciesManager
I tried creating a simple new app and trying to run, getting below errors -
Run Inside play folder
jyotimahansaria#Jyotis-MacBook-Pro ~/Documents/Bytemark/Backend_Work/play-1.3.1 $ play run myApp
~ _ _
~ _ __ | | __ _ _ _| |
~ | '_ \| |/ _' | || |_|
~ | __/|_|\____|\__ (_)
~ |_| |__/
~
~ play! 1.3.1, https://www.playframework.com
~
~ Ctrl+C to stop
~
~ using java version "1.8.0_231"
Error opening zip file or JAR manifest missing : /Users/jyotimahansaria/Documents/Bytemark/Backend_Work/play-1.3.1/framework/play-1.3.1.jar
Error occurred during initialization of VM
agent library failed to init: instrument
Run inside App folder -
jyotimahansaria#Jyotis-MacBook-Pro ~/Documents/Bytemark/Backend_Work/play-1.3.1/myApp $ play run myApp
~ _ _
~ _ __ | | __ _ _ _| |
~ | '_ \| |/ _' | || |_|
~ | __/|_|\____|\__ (_)
~ |_| |__/
~
~ play! 1.3.1, https://www.playframework.com
~
~ Oops. conf/routes or conf/application.conf missing.
~ /Users/jyotimahansaria/Documents/Bytemark/Backend_Work/play-1.3.1/myApp/myApp does not seem to host a valid application.

I removed everything related to play and setup the play again, this time in Applications instead of Documents and it's working completely fine.

Related

I would like to concatenate two figlet outputs (with different colors)

Currently I have this kind of output format:
{ echo "$(figlet buddhi)"; echo "$(figlet lw)"; }
_ _ _ _ _
| |__ _ _ __| | __| | |__ (_)
| '_ \| | | |/ _` |/ _` | '_ \| |
| |_) | |_| | (_| | (_| | | | | |
|_.__/ \__,_|\__,_|\__,_|_| |_|_|
_
| |_ __
| \ \ /\ / /
| |\ V V /
|_| \_/\_/
And I would like to have this output format:
figlet buddhi lw
_ _ _ _ _ _
| |__ _ _ __| | __| | |__ (_) | |_ __
| '_ \| | | |/ _` |/ _` | '_ \| | | \ \ /\ / /
| |_) | |_| | (_| | (_| | | | | | | |\ V V /
|_.__/ \__,_|\__,_|\__,_|_| |_|_| |_| \_/\_/
The reason is: I would like to color each name (buddhi, lw) with a different color. But, retain the format of a continuous string, or at maximum space-separated, as above.
Example:
#COMMANDS CREATED INSIDE /ETC/BASH.BASHRC FILE
# USING ANSI COLORS
RED="\e[31m"
ORANGE="\e[33m"
BLUE="\e[94m"
GREEN="\e[92m"
STOP="\e[0m"
printf "${GREEN}"
printf "=================================\n"
printf "${ORANGE}"
figlet -f standard "Buddhi"
printf "${BLUE}"
figlet -f small "LW"
printf "${GREEN}"
printf "=================================\n"
printf "${STOP}"
Store the lines of each word in arrays, output both the arrays line by line. As the first line of "Buddhi" seems to be one character shorter, I stored the longest line length of the first word in a variable, and used the %-s format to pad each line.
#! /bin/bash
RED="\e[31m"
ORANGE="\e[33m"
BLUE="\e[94m"
GREEN="\e[92m"
STOP="\e[0m"
mapfile -t left < <(figlet -f standard "Buddhi")
mapfile -t right < <(figlet -f small "LW")
maxlength=0
for line in "${left[#]}" ; do
if (( ${#line} > maxlength )) ; then
maxlength=${#line}
fi
done
printf "${GREEN}"
printf "=================================\n"
for ((i=0; i<=${#left[#]}; ++i)) ; do
printf "${ORANGE}%-${maxlength}s ${GREEN}%s\n" "${left[i]}" "${right[i]}"
done
printf "${GREEN}"
printf "=================================\n"
printf "${STOP}"
If you need a shorter version:
printf "$GREEN=================================\n"
{ figlet Buddhi; echo 'EOF'; figlet LW; } | awk 'NF==1&&$1=="EOF" {noskip=1; next; } noskip==0 { f[++c]=$0; next; } { printf "%s%s%s%s\n","'"$ORANGE"'",f[++k],"'"$BLUE"'",$0;}'
printf "$GREEN=================================\n"
tput sgr0
I would recommend to use tput for setting the color as not every terminal will know your escape sequences
The guys who invented shell also invented awk for shell to call to manipulate text. Those escape sequences don't change colors on my terminal, they just show up as-is (fortunately so you can see where the script is puting them):
$ cat tst.sh
#!/usr/bin/env bash
awk '
BEGIN {
red = "\\e[31m"
orange = "\\e[33m"
blue = "\\e[94m"
green = "\\e[92m"
stop = "\\e[0m"
}
{
val[(NR==FNR),FNR] = $0
}
NR == FNR {
wid = length($0)
maxWid = ( wid > maxWid ? wid : maxWid )
}
END {
for ( lineNr=1; lineNr<=FNR; lineNr++ ) {
printf "%s%-*s%s%s%s\n", orange, maxWid, val[1,lineNr], blue, val[0,lineNr], stop
}
}
' <(cat Buddhi) <(cat LW)
$ ./tst.sh
\e[33m _ _ _ _ _ \e[94m _\e[0m
\e[33m| |__ _ _ __| | __| | |__ (_)\e[94m| |_ __\e[0m
\e[33m| '_ \| | | |/ _` |/ _` | '_ \| |\e[94m| \ \ /\ / /\e[0m
\e[33m| |_) | |_| | (_| | (_| | | | | |\e[94m| |\ V V /\e[0m
\e[33m|_.__/ \__,_|\__,_|\__,_|_| |_|_|\e[94m|_| \_/\_/\e[0m
Since I don't have figlet, I ran the above on these files:
$ head Buddhi LW
==> Buddhi <==
_ _ _ _ _
| |__ _ _ __| | __| | |__ (_)
| '_ \| | | |/ _` |/ _` | '_ \| |
| |_) | |_| | (_| | (_| | | | | |
|_.__/ \__,_|\__,_|\__,_|_| |_|_|
==> LW <==
_
| |_ __
| \ \ /\ / /
| |\ V V /
|_| \_/\_/
Just change the last line of the script from:
' <(cat Buddhi) <(cat LW)
to
' <(figlet Buddhi) <(figlet LW)
to use actual figlet output.
the above assumes you only have 2 figlet output strings to concatenate and that both sets of output are the same length, it's easy tweaks if either of those assumptions is wrong.
In lieu of figlet I'll use the following as my inputs:
$ cat buddhi
_ _ _ _ _
| |__ _ _ __| | __| | |__ (_)
| '_ \| | | |/ _` |/ _` | '_ \| |
| |_) | |_| | (_| | (_| | | | | |
|_.__/ \__,_|\__,_|\__,_|_| |_|_|
$ cat lw
_
| |_ __
| \ \ /\ / /
| |\ V V /
|_| \_/\_/
Assuming figlet generates the same number of output lines for each input string, we can use paste (# as a delimiter) and a while/read loop to generate the desired output:
printf "${GREEN}"
printf "============================\n"
maxwidth=$(awk '{max=length($0) > max ? length($0) : max}END{print max}' buddhi)
while IFS='#' read -r col1 col2
do
printf "${ORANGE}%-*s ${BLUE}%s\n" "${maxwidth}" "${col1}" "${col2}"
done < <(paste -d"#" buddhi lw)
printf "${GREEN}"
printf "============================\n"
This generates:
Expanding to 3 input streams:
printf "${GREEN}"
printf "============================\n"
max1=$(awk '{max=length($0) > max ? length($0) : max}END{print max}' buddhi)
max2=$(awk '{max=length($0) > max ? length($0) : max}END{print max}' lw)
while IFS='#' read -r col1 col2 col3
do
printf "${ORANGE}%-*s ${BLUE}%-*s ${RED}%s\n" "${max1}" "${col1}" "${max2}" "${col2}" "${col3}"
done < <(paste -d"#" buddhi lw buddhi)
printf "${GREEN}"
printf "============================\n"
This generates:
Using coordinates
#!/bin/bash
RED='\e[31m'
GRN='\e[32m'
XY(){ printf "\e[$2;${1}H$3"; }
mapfile -t frst < <(figlet -f standard "Buddhi")
mapfile -t scnd < <(figlet -f small "LW")
XY 1 1 "$GRN==============================================="; y=2
for line in "${frst[#]}"; { XY 0 $y "$RED$line"; ((y++)); }; y=2
for line in "${scnd[#]}"; { XY 35 $y "$GRN$line"; ((y++)); }
XY 1 8 "$GRN==============================================="
More examples here, here and here

Julia cannot reproduce the rand

I am just reading and practicing the "3.5.2.1 rand" section of https://juliadatascience.io/standardlibrary and found the code below cannot reproduce same random numbers:
$ julia
_
_ _ _(_)_ | Documentation: https://docs.julialang.org
(_) | (_) (_) |
_ _ _| |_ __ _ | Type "?" for help, "]?" for Pkg help.
| | | | | | |/ _` | |
| | |_| | | | (_| | | Version 1.7.0 (2021-11-30)
_/ |\__'_|_|_|\__'_| | Official https://julialang.org/ release
|__/ |
julia> using Random: rand, randn, seed!
julia> my_seed = seed!(123)
Random.TaskLocalRNG()
julia> rand(my_seed, 3)
3-element Vector{Float64}:
0.521213795535383
0.5868067574533484
0.8908786980927811
julia> rand(my_seed, 3)
3-element Vector{Float64}:
0.19090669902576285
0.5256623915420473
0.3905882754313441
The snapshot of the book:
Well spotted. Running rand(my_seed, 3) twice shouldn't give the same output. This problem was caused by a bug in Books.jl. The Books package stores outputs in files as a sort of caching mechanism. Unfortunately, two identical blocks of code will be written to the same file path, so the output for the last block overrides the output for the first block. I still haven't found a nice solution to that problem and normally it isn't a problem because the same code will usually give the same output, but not for calling rand.
This problem will be fixed in the HTML and PDF version on the website about 30 minutes after https://github.com/JuliaDataScience/JuliaDataScience/pull/235 is merged.
You're missing the second call to seed! that's in the book.

Generate English words using special characters in the comments

I want to generate a English word with pure characters like |, /, \, (, ) etc. in my code comments.
For example,
_
(_)
__ __ __ _ ___ ___ _
\ \ / / / _` | / __| / __| | |
\ V / | (_| | | (__ | (__ | |
\_/ \__,_| \___| \___| |_|
I wonder if there is a tool that automatically does the job? I don't know how to properly google it.
This tool might be helpful: https://patorjk.com/software/taag/#p=display&h=1&v=1&f=Big&t=vaccine
You can choose your favorite font, character width/height, and copy the wonderful ASCII art to your clipboard.

How can I create superuser in EC2 after contact using SSH(There is no app folder in EC2 instance)

I connect to my EC2 instance and I use Django and deploy with elasticbeanstalk.
I'd like to check how many Users in my service...but There is no app folder in EC2 instance and don't know how to make superuser like using console
python manage.py createsuperuser
Is there any solution to check my users?(except make admin page or container_commands <- I already tried but it doesn't work. so I'd like to try the other way.)
Warning: Permanently added '15.164.165.224' (ECDSA) to the list of known hosts.
_____ _ _ _ ____ _ _ _
| ____| | __ _ ___| |_(_) ___| __ ) ___ __ _ _ __ ___| |_ __ _| | | __
| _| | |/ _` / __| __| |/ __| _ \ / _ \/ _` | '_ \/ __| __/ _` | | |/ /
| |___| | (_| \__ \ |_| | (__| |_) | __/ (_| | | | \__ \ || (_| | | <
|_____|_|\__,_|___/\__|_|\___|____/ \___|\__,_|_| |_|___/\__\__,_|_|_|\_\
Amazon Linux AMI
This EC2 instance is managed by AWS Elastic Beanstalk. Changes made via SSH
How to run manage.py from AWS Elastic Beanstalk AMI.
SSH login to Linux
(optional may need to run sudo su - to have proper permissions)
source /opt/python/run/venv/bin/activate
source /opt/python/current/env
cd /opt/python/current/app
python manage.py <commands>
Or, you can run command as like the below:
cd /opt/python/current/app
/opt/python/run/venv/bin/python manage.py <command>
I have referenced the article below.
Run manage.py from AWS EB Linux instance

Echo in Bash: Escape Apostrophes?

I'm trying to use echo in bash inside of quotes.
When I try from a command line, it works fine.
For example: echo "I'm testing the apostrophe functionality."
yields I'm testing the apostrophe functionality.
Yet, when I write this in a script, it doesn't seem to work.
Here's a snippet of my code: (I'm trying to integrate ASCII art into my program)
if [ "$2" == "-s" ]
then echo " ___ __ _ _ "
echo " / _ \__ _ _ __ ___ ___ / _\ |_ __ _ _ __| |_ ___ _ __ "
echo " / /_\/ _` | '_ ` _ \ / _ \_____\ \| __/ _` | '__| __/ _ \ '__|"
echo "/ /_\\ (_| | | | | | | __/_____|\ \ || (_| | | | || __/ | "
echo "\____/\__,_|_| |_| |_|\___| \__/\__\__,_|_| \__\___|_| "
echo ""
echo "Hello! My name is Siri."
echo "I'm not actually the Siri you're probably used to."
echo "I'm actually Apple's Siri's sister, the no-voice one."
echo "Sorry, but I'm in development right now."
echo "Come back later and maybe Eric will bring me out of beta."
echo "Thanks for reading this long debug message!"
fi
I've checked and double-checked all my quotes...
Yet it still yields:
./game-starter.sh: line 7: unexpected EOF while looking for matching ``'
./game-starter.sh: line 88: syntax error: unexpected end of file
Please help soon!
-HewwoCraziness
As you're using double quotes around your strings, certain characters are interpreted by the shell. One example is the backtick, as mentioned in Ryan's answer.
One option would be to use single quotes around your strings, although then you would have to escape the apostrophes in your message. I think that the best solution would be to use a heredoc instead:
cat <<'EOF'
___ __ _ _
/ _ \__ _ _ __ ___ ___ / _\ |_ __ _ _ __| |_ ___ _ __
/ /_\/ _` | '_ ` _ \ / _ \_____\ \| __/ _` | '__| __/ _ \ '__|
/ /_\\ (_| | | | | | | __/_____|\ \ || (_| | | | || __/ |
\____/\__,_|_| |_| |_|\___| \__/\__\__,_|_| \__\___|_|
Hello! My name is Siri.
I'm not actually the Siri you're probably used to.
I'm actually Apple's Siri's sister, the no-voice one.
Sorry, but I'm in development right now.
Come back later and maybe Eric will bring me out of beta.
Thanks for reading this long debug message!
EOF
The quotes around the EOF mean that the string is interpreted literally, so characters such as | don't cause problems.
I don't think it's the apostrophes that are causing your issue; is it the ` character (you know, on the ~ key). It is used for running commands in place and other things, and is probably what's causing the issue, if I had to guess based on that error message.

Resources