Skip to content

Instantly share code, notes, and snippets.

View PimDeWitte's full-sized avatar
🎮
hiring at medal.tv/careers

Pim de Witte PimDeWitte

🎮
hiring at medal.tv/careers
View GitHub Profile
@PimDeWitte
PimDeWitte / gist:586d8a94413493fd8900
Created November 5, 2014 16:37
OpenMRS Version Error
The following error occurred at startup:
OpenMRS requires Java 6, but is running under 1.8.0_20
org.openmrs.api.APIException: OpenMRS requires Java 6, but is running under 1.8.0_20
at org.openmrs.util.OpenmrsUtil.validateJavaVersion(OpenmrsUtil.java:1203)
at org.openmrs.web.Listener.contextInitialized(Listener.java:121)
at org.eclipse.jetty.server.handler.ContextHandler.callContextInitialized(ContextHandler.java:787)
at org.eclipse.jetty.servlet.ServletContextHandler.callContextInitialized(ServletContextHandler.java:434)
at org.eclipse.jetty.server.handler.ContextHandler.startContext(ContextHandler.java:779)
at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:284)
at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1322)
This file has been truncated, but you can view the full file.
tps://www.googleapis.com/auth/devstorage.read_only"]},"default":{"aliases":["default"],"email":"848381126788-compute@developer.gserviceaccount.com","scopes":["https://www.googleapis.com/auth/devstorage.read_only"]}},"tags":["http-server","https-server","http-server-8080","http-server-8000"],"zone":"projects/848381126788/zones/europe-west1-b"}
Nov 8 16:19:32 continuous-testing-1 google: No startup script found in metadata.
Nov 8 16:19:34 continuous-testing-1 jenkins: jenkins: failed to write(client_outfd = 4): No space left on device
Nov 8 16:19:34 continuous-testing-1 jenkins: jenkins: failed to write(client_outfd = 4): No space left on device
Nov 8 16:19:35 continuous-testing-1 jenkins: jenkins: failed to write(client_errfd = 5): No space left on device
Nov 8 16:19:35 continuous-testing-1 jenkins: jenkins: failed to write(client_errfd = 5): No space left on device
Nov 8 16:19:38 continuous-testing-1 sshd[2343]: Connection closed by 74.125.73.21 [preauth]
@PimDeWitte
PimDeWitte / gist:d342cc9518293eab8600
Last active August 29, 2015 14:09
OpenMRS Database Size Analysis
Considering that we are using OpenMRS, an unencrypted, uncompressed MySQL database with the
data entered below is 215MB.The data consists of 5500 patients/persons, 500.000 observations
in 15.000 encounters, and 2500 concepts, and 3 forms.
Total memory is 137MB without any i/o.
On disk:
root@jenkins-3:/var/lib/mysql# ls -l
total 249880
package model;
import java.util.Arrays;
/**
* @author Pim de Witte(wwadewitte), Whitespell LLC
* 11/19/14
* versioning
* ${FILE_NAME}
*/
<html><head><title>Apache Tomcat/7.0.28 - Error report</title><style><!--H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}A.name {color : black;}HR {color : #525D76;}--></style> </head><body><h1>HTTP Status 500 - Java heap space</h1><HR size="1" noshade="noshade"><p><b>type</b> Exception report</p><p><b>message</b> <u>Java heap space</u></p><p><b>description</b> <u>The server encountered an internal error (Java heap space) that prevented it from fulfilling this request.</u></p><p><b>exception</b> <pre>java.lang.OutOfMemoryErro
//Adds double quotes to string values in an invalid JSON object.
class JsonEditor {
public static String recursiveQuotes(string s) {
string[] stringify = new string[]{ "id","name", "mmcId", "currentMatch"}; // we have to add the search terms because strings can contain int values and they are impossible to identify by checking the value.
string searchTerm = null;
foreach(string check in stringify) {
if (s.Contains (check+"=")) { // we also replace = with :, so check+= is confirmation there are untouched strings.
searchTerm = check;
}
We can make this file beautiful and searchable if this error is corrected: It looks like row 2 should actually have 1 column, instead of 5. in line 1.
id;wkt;TileX;TileY;TileZ;URL
1;POLYGON ((28.856964111328125 -2.497225345548671 0,28.85833740234375 -2.497225345548671 0,28.85833740234375 -2.498597331678283 0,28.856964111328125 -2.498597331678283 0,28.856964111328125 -2.497225345548671 0));152085;132891;18;http://t0.tiles.virtualearth.net/tiles/a300101023200032123.jpeg?g=854&mkt=en-US&token=AopsdXjtTu-IwNoCTiZBtgRJ1g7yPkzAi65nXplc-eLJwZHYlAIf2yuSY_Kjg3Wn
2;POLYGON ((28.85833740234375 -2.497225345548671 0,28.859710693359375 -2.497225345548671 0,28.859710693359375 -2.498597331678283 0,28.85833740234375 -2.498597331678283 0,28.85833740234375 -2.497225345548671 0));152086;132891;18;http://t0.tiles.virtualearth.net/tiles/a300101023200032132.jpeg?g=854&mkt=en-US&token=AopsdXjtTu-IwNoCTiZBtgRJ1g7yPkzAi65nXplc-eLJwZHYlAIf2yuSY_Kjg3Wn
3;POLYGON ((28.859710693359375 -2.497225345548671 0,28.861083984375 -2.497225345548671 0,28.861083984375 -2.498597331678283 0,28.859710693359375 -2.498597331678283 0,28.859710693359375 -2.497225345548671 0));152087;132891;18;http://t0.t
@PimDeWitte
PimDeWitte / Efficient Bad Word Filter
Last active February 11, 2024 14:57
Simple profanity filter written in Java for efficient comparison. Runtime grows based on string input, not list size.
static Map<String, String[]> words = new HashMap<>();
static int largestWordLength = 0;
public static void loadConfigs() {
try {
BufferedReader reader = new BufferedReader(new InputStreamReader(new URL("https://docs.google.com/spreadsheets/d/1hIEi2YG3ydav1E06Bzf2mQbGZ12kh2fe4ISgLg_UBuM/export?format=csv").openConnection().getInputStream()));
String line = "";
int counter = 0;
while((line = reader.readLine()) != null) {
I/Unity ( 7997): medals = 46
I/Unity ( 7997): Stacktrace is not supported on this platform.
I/Unity ( 7997): (Filename: ./artifacts/generated/common/runtime/DebugBindings.gen.cpp Line: 51)
I/Unity ( 7997):
I/Unity ( 7997): Gme is finihsed 1 - False
I/Unity ( 7997): Stacktrace is not supported on this platform.
I/Unity ( 7997): (Filename: ./artifacts/generated/common/runtime/DebugBindings.gen.cpp Line: 51)
I/Unity ( 7997):
I/Unity ( 7997): ================================== Beginning Add counter for daily challenge 1
I/Unity ( 7997): Stacktrace is not supported on this platform.
2016-11-27 14:34:32.740384 game[7909:1698461] Uncaught exception: NSInvalidArgumentException: *** -[__NSArrayM insertObject:atIndex:]: object cannot be nil
(
0 CoreFoundation 0x00000001876861d8 <redacted> + 148
1 libobjc.A.dylib 0x00000001860c055c objc_exception_throw + 56
2 CoreFoundation 0x0000000187565ad4 CFStringConvertNSStringEncodingToEncoding + 0
3 game 0x0000000100042ed0 -[UnityAppController application:openURL:sourceApplication:annotation:] + 308
4 game 0x0000000101a98f20 -[FIRAAppDelegateProxy application:openURL:sourceApplication:annotation:] + 188
5 UIKit 0x000000018d77141c <redacted> + 872
6 UIKit 0x000000018d770e30 <redacted> + 656
7 SafariServices 0x00000001959928a0 <redacted> + 172