We at The Coders Lexicon thought it might be advantageous for some of you learning Java to learn how you might structure something like a basic random quote generator. To make things a little more interesting, what if we read the quotes from a file and used a "try-with-resources" statement? That way we could add additional quotes to it over time and have the program generate random quotes on demand. ...
JSON Web Tokens (JWTs) are a mechanism for authentication that is simple to setup and easy to use. However, most of the time when you encounter this topic in a project, you get the advice to just use a JWT package. I am not quite sure why given that creating a token is relatively straight forward if you know how they are built. You can also implement such logic in ...
Some of the very first programs we are introduced to in programming is the idea of random numbers. This is often introduced using the idea of the die or dice. We have all seen them and have probably even thrown a set of dice at some point in our life. A die is pretty much a representation of a random number generator with a fixed range of values. The traditional ...
Around this time each year we mentors on Dream.In.Code see a bunch of students and beginners, attempting to do there final programming projects, come on the boards asking for help with coding problems. Some even come on asking for ideas to help them out and a large majority want help with simple games they can do like connect four, "the snake game" or even Tic-Tac-Toe. Then each year we throw ...
Over the past couple weeks I have noticed a lot of students asking questions about counting number frequencies. The student is often generating, or asked to take in input, and count how many times a series of numbers appear in the data. Sometimes they are given a file for the input and other times they are asked to take in numbers entered by the user and count them. So I ...
I found that there was little in the way of examples using Application-Only OAuth for Twitter using Java. So I thought I would put together the basics for those looking for the same thing. This demo example below shows you how to acquire a bearer token and then using that token to issue requests to Twitter's REST API version 1.1. However, only endpoints that don't need to have a user ...