Skip to content

Instantly share code, notes, and snippets.

View paullewallencom's full-sized avatar
🎯
Focusing

Paul Lewallen paullewallencom

🎯
Focusing
View GitHub Profile
PM> Scaffold-DbContext "Server=.;database=H_Plus_Sports;Trusted_Connection=True;" Microsoft.EntityFrameworkCore.SqlServer -OutputDir Models
Startup project 'src\HPlusSportsAPI' is an ASP.NET Core or .NET Core project for Visual Studio 2015. This version of the Entity Framework Core Package Manager Console Tools doesn't support these types of projects.
@paullewallencom
paullewallencom / Calculator.java
Created June 5, 2018 21:11
JAVA - Creating, running, and setting the characteristics of a thread
import java.io.FileWriter;
public class Calculator implements Runnable
{
@Override
public void run()
{
long current = 1L;
long max = 20000L;
long numPrimes = 0L;
@paullewallencom
paullewallencom / Main.java
Created June 7, 2018 15:13
Interrupting a thread
// Interrupting a thread
import java.util.concurrent.TimeUnit;
public class Main {
public static void main(String[] args) {
// Launch the prime numbers generator
Thread task = new PrimeGenerator();
@paullewallencom
paullewallencom / FileSearch.java
Created June 7, 2018 22:48
Controlling the Interruption of a Thread
package Example03;
import java.io.File;
public class FileSearch implements Runnable {
private String initPath;
private String fileName;
public FileSearch(String initPath, String fileName) {
import java.util.Date;
import java.util.concurrent.TimeUnit;
public class ConsoleClock implements Runnable {
@Override
public void run() {
for (int i = 0; i < 10; i++) {
System.out.printf("%s\n", new Date());
try {
@paullewallencom
paullewallencom / DataSourcesLoader.java
Created June 9, 2018 17:47
Waiting for the Finalization of a Thread
import java.util.Date;
import java.util.concurrent.TimeUnit;
public class DataSourcesLoader implements Runnable {
@Override
public void run() {
// Writes a messsage
System.out.printf("Begining data sources loading: %s\n",new Date());
@paullewallencom
paullewallencom / CleanerTask.java
Created June 14, 2018 19:41
Creating and Running a Daemon Thread
import java.util.Date;
import java.util.Deque;
public class CleanerTask extends Thread {
private Deque<Event> deque;
public CleanerTask(Deque<Event> deque) {
this.deque = deque;
// Establish that this is a Daemon Thread
import java.util.Arrays;
public class BinarySearch
{
private BinarySearch() { }
public static int indexOf( int[] a, int key )
{
int lo = 0;
int hi = a.length - 1;
@paullewallencom
paullewallencom / RandomSeq.java
Created July 24, 2018 17:56
Prints 'N' numbers with a range between 'lo' and 'hi'.
public class RandomSeq
{
private RandomSeq() { }
public static void main( String[] args )
{
int n = Integer.parseInt( args[0] );
if ( args.length == 1 )
{
@paullewallencom
paullewallencom / Average.java
Created July 24, 2018 20:11
Reads in a sequence of real numbers and computes their average.
public class Average
{
private Average() { }
public static void main( String[] args )
{
int count = 0;
double sum = 0.0;
while ( !StdIn.isEmpty() )