Skip to content

Instantly share code, notes, and snippets.

View nmschorr's full-sized avatar
🏠
Working from home

Nancy Schorr nmschorr

🏠
Working from home
View GitHub Profile

NULS Q4 Top 5 Contributors

Election Results

In response to everyone who loved and supported NULS during this bear market, we initiated the Q4 2020 NULS Community Contributors Recognition Award.

After nearly one month of voting, the NULS community has selected the top 5 contributors of the fourth quarter of 2020.

So without further ado, please applaud our top five Contributors for Q4, 2020!

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>schorrmedia.com</groupId>
<artifactId>YourProgramOrClassName</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>YourProgramOrClassName</name>
</project>
JSONArray myJsonArry = new JSONArray(longJsonString);
List<Object> myArrayList = new ArrayList<Object>(toList(myJsonArry));
Collection<Map<String,String>> mapsCol = new HashSet<Map<String,String>>();
for (int i=0; i < myArrayList.size(); i++) {
mapsCol.add((HashMap<String, String>)myArrayList.get(i));
}
@nmschorr
nmschorr / Url Reading
Last active October 14, 2017 03:47
The secret to easily reading a URL
static void readUrlData () throws Exception {
String builderLine;
String locUrlString = "http://jsonplaceholder.typicode.com/albums";
System.out.println("\nRunning readUrlData");
HttpURLConnection newUrlConn = (HttpURLConnection) new URL(locUrlString).openConnection();
newUrlConn.setRequestMethod("GET");
newUrlConn.setRequestProperty("Accept", "application/json");
if (newUrlConn.getResponseCode() != HttpURLConnection.HTTP_OK) {
System.err.println("Can't connect to Webserver!");
}
/* JavaTestFive by Nancy Schorr, 2017
Demonstrates use of apis to read a json formatted text file and store it as a JSON object for further manipulation.
Also goes to url http://jsonplaceholder.typicode.com/albums and reads the data and store it in various objects.
Thanks to https://www.java2novice.com/restful-web-services/java-client-net-url/ for some ideas in this code.
*/
package com.nmschorr;
import static java.lang.System.out;
import java.io.*;
import java.net.*;
OFF No logging
FATAL Severe errors
ERROR non-fatal errors
WARN misc warnings
INFO runtime events
DEBUG Detailed info
TRACE Most detailed
@BeforeClass //run once before each testsuite
public static void setUpClass() throws Exception {
gLogger = createLogger();
}
@Test
public void testDemo() throws Exception {
gLogger.info("Starting the actual new testDemo. Waiting a few seconds.");
shortTest();
}
public static Logger createLogger() {
Logger aLogger = LogManager.getRootLogger();
aLogger.debug("\n" + "Inside createLogger - Logger is being set up. New test setup beginning.");
verificationErrors = new StringBuffer();
aLogger.info("Logger has been set up.");
return aLogger;
}
protected static void createLogFile (FirefoxProfile fp) throws Exception {
File outfile = new File(outfileName);
@nmschorr
nmschorr / Imports
Last active October 23, 2015 03:19
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="warn">
<Appenders>
<Console name="console" target="SYSTEM_OUT">
<PatternLayout
pattern="[%-5level] %d{yyyyMMdd-HHmmss} [%t] %M- %msg%n" />
</Console>
<RollingFile name="rollingfile" fileName="C:\Users\user\git2\SMedia\logs\smtrace.log"
filePattern="C:\Users\user\git2\SMedia\logs\smtrace-%d{yyyyMMddHHmmss}.log">
<PatternLayout>