Current request is not of type HttpServletRequest

Ran into this error this week

There was an unexpected error (type=Internal Server Error, status=500). Current request is not of type [org.apache.catalina.servlet4preview.http.HttpServletRequest]: ServletWebRequest: uri=/my/url/

Make sure you imported the correct HttpServletRequest import. I wanted import javax.servlet.http.HttpServletRequest;

read more

Filtering FiveThirtyEight's NFL Forecasting Leaderboard

A group of friends and I have a contest going on FiveThirtyEight’s NFL Forecasting Game Leaderboard and they don’t allow group functionality, so at the end of each week I Ctrl + F on the page to find each of our name’s and update a spreadsheet. Instead of spending 3 minutes once a week I decided to spend 15 minutes and write something that will do it for me.

Just replace the names array with a list of the names in your group

var table = document.getElementById('leaderboard-table-wrap').getElementsByTagName('tr');
Array.from(table).forEach(function(item) {
  var names = ['Matt Busche', 'Random Dude'];
  if (names.indexOf(item.getElementsByClassName('name')[0].textContent) === -1) {

As always you can use a Bookmarklet Creator to add this as a “bookmark” on your address bar to make filtering super easy.

Note: If you can’t find a person, each person needs to acknowledge that they want to publically post their score by visiting the leaderboard page and clicking a link.

read more

Finding md5 hash of file

Fun tip I learned today. If you need to find the md5 hash of a file you can simply user the following command.

certutil -hashfile {path+filename} md5 

certutil is included in windows by default, so you aren’t required to have anything additional installed.

read more

Angular Loading JavaScript file in different environments

If you ever need to load two different files in production vs test, you can add some code to your main.ts file in your Angular project. The existing code includes the if statement and enableProdMode(), but you can easily add in the else to conditionally load a different file. In my case I don’t want google analytics posting to my production account.

import { environment } from './environments/environment';

//create a new element
const script = document.createElement('script');
if (environment.production) {
    script.src = 'analytics.js';
} else {
    script.src = 'test-analytics.js';
//append that element into the dom

read more

Java setting tracking mode for session

If you avoid using xml for you configuration files like I do, but don’t want to pass the jsessionid around through the URL you can create a @Bean and use a lambda to set the tracking mode as follows

public class AuthProvidersSecurityConfig extends WebSecurityConfigurerAdapter {

    public ServletContextInitializer servletContextInitializer() {
      return servletContext -> {

read more