POSTing with CURL with timings

June 7, 2019

I wanted to do a POST with CURL with a JSON payload and produce some performance stats in the process.

First create this file as curl-format.txt:

time_namelookup:  %{time_namelookup}\n
time_connect:  %{time_connect}\n
time_appconnect:  %{time_appconnect}\n
time_pretransfer:  %{time_pretransfer}\n
time_redirect:  %{time_redirect}\n
time_starttransfer:  %{time_starttransfer}\n
                ----------\n
time_total:  %{time_total}\n

Next ...

SpringBoot: No injection source found for a parameter

May 24, 2019

I'm trying an example Spring Boot project with jersey for REST services. I got the following error:

No injection source found for a parameter of type public javax.ws.rs.core.Response 
com.example.jersey.UserResource.updateUser(int,com.example.jersey.User) throws 
java.net.URISyntaxException

My service is ...

Bash Uppercase Input with Defaults

April 25, 2019

I needed to modify a bash function that accepted user input, so that it uppercased that input. This was implemented using a function that provided a default value.

fetchInputUpper()
{
   local entered_value
   read -p "$1 [default: $2]: " entered_value
   export $3="${entered_value:-$2}"
   export $3="${!3^^}"
}

fetchInputUpper "Enter Text?" "Default" VARIABLE
echo ...

Uppercase In Bash

April 25, 2019

If your bash version is greater than 4.0, you can use the ^^ syntax to uppercase variable values:

export LOWER="abc"
export UPPER=${LOWER^^}
echo $UPPER

Django Code Coverage

April 19, 2019

I have a Django application with tests, and I wanted to see what my code coverage was when those tests are run. This is fairly straightforward.

First, install coverage:

$ pip install coverage

Then, instead of running python manage.py test, run the following in the same directory:

$ coverage run --source ...