Skip to content

Instantly share code, notes, and snippets.

View greghelton's full-sized avatar

Greg Helton greghelton

View GitHub Profile
**free
dcl-s x packed(3:0) inz(0);
dcl-s y char(10) inz('Texas');
dcl-s key char(10);
dcl-s val char(20);
dcl-s mysql CHAR(250)
inz(‘SELECT key1, prop1 FROM states_afflictions where key1 = ? UNION ALL +
SELECT key2, prop2 FROM states_afflictions where key2 = ? UNION ALL +
SELECT key3, prop3 FROM states_afflictions where key3 = ? for read only’);
@greghelton
greghelton / Commands
Last active August 15, 2020 00:26
I got out the old JUnit book and I tried using VS Code and its Java plugin and I had a myriad of problems. I reverted back to the old DOS command line just to verify that the problem was them, not me.
javac -d bin src/boss/ScoreCollection.java
javac -cp lib\junit-4.13.jar -d bin test/boss/ScoreCollectionTest.java
javac -cp lib\junit-4.13.jar;bin -d bin test/boss/TestRunner.java
java -cp bin;lib/junit-4.13.jar;lib/hamcrest-core-1.3.jar boss.TestRunner
Result:
test(boss.ScoreCollectionTest): Not yet implemented
@greghelton
greghelton / DpiDB.java
Last active July 31, 2016 12:01
using AS400 DTAQs (Data Queues), CL and a little bit of RPG to communicate with Java
package com.frontier.dpiplant.db;
import java.io.IOException;
import java.io.InputStream;
import com.ibm.as400.access.AS400;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.Properties;
import com.ibm.as400.access.*;
public class PollDtaq {
DataQueue readQ;
AS400 as400;
ProgramCall program;
/*
* compile: javac -cp .;..\jars\jt400.jar PollDtaq.java
*/
public PollDtaq() {
this.as400 = new AS400("DPITEST", "as400userid", "password");
set CP=C:\Users\gah285\.m2\repository\commons-codec\commons-codec\1.3\commons-codec-1.3.jar
set CP=%CP%;C:\Users\gah285\.m2\repository\org\mortbay\jetty\servlet-api\2.5-20081211\servlet-api-2.5-20081211.jar
set CP=%CP%;C:\Users\gah285\.m2\repository\commons-logging\commons-logging\1.1.1\commons-logging-1.1.1.jar
set CP=%CP%;C:\Users\gah285\.m2\repository\com\google\api-client\google-api-client\1.20.0\google-api-client-1.20.0.jar
set CP=%CP%;C:\Users\gah285\.m2\repository\com\google\apis\google-api-services-drive\v2-rev204-1.21.0\google-api-services-drive-v2-rev204-1.21.0.jar
set CP=%CP%;C:\Users\gah285\.m2\repository\com\google\apis\google-api-services-oauth2\v1-rev108-1.21.0\google-api-services-oauth2-v1-rev108-1.21.0.jar
set CP=%CP%;C:\Users\gah285\.m2\repository\com\google\http-client\google-http-client\1.20.0\google-http-client-1.20.0.jar
set CP=%CP%;C:\Users\gah285\.m2\repository\com\google\http-client\google-http-client-jackson2\1.20.0\google-http-client-jackson2-1.20.0.jar
set CP=%CP%;C:\Users\gah285\
import com.ibm.as400.access.*;
public class CallSrvPgm {
String firstName;
String lastName;
int ssn;
void getNextBySocialSecurityNumber(int ssn) throws Exception {
AS400 as400 = new AS400("machine", "userid", "password");
ServiceProgramCall pgm = new ServiceProgramCall(as400);
ProgramParameter[] parameters = new ProgramParameter[3];
var expect = require('chai').expect;
var isPalindrome = require('../src/ispalindrome');
describe('palindrome-test', function() {
it('should pass this canary test', function() {
expect(true).to.be.true;
});
it('should return true for argument mom', function() {
expect(isPalindrome('mom')).to.be.true;
@greghelton
greghelton / GetLatLngSrvPgmCall.java
Last active January 19, 2017 04:03
unit test RPG SRVPGM with JUnit
package com.frontier.dpiplant.geo;
import com.ibm.as400.access.*;
import static org.junit.Assert.*;
import java.util.Date;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.junit.Test;
public class GetLatLngSrvPgmCall {
static final Logger LOGGER = LogManager.getLogger(GetLatLngSrvPgmCall.class.getName());
@greghelton
greghelton / BL0100M01
Last active July 27, 2016 11:39
Using JUnit to test RPG
ctl-opt Option(*Srcstmt:*Nodebugio:*NoUnRef)
NoMain Debug(*YES);
/copy BL0100M01C
dcl-s uuidKey_t CHAR(16) TEMPLATE;
dcl-s maxResponseData_t CHAR(39) TEMPLATE;
dcl-ds uuidDS_t Template;
dcl-subf bytes_provided INT(10);
dcl-subf bytes_available INT(10);
dcl-subf reserved CHAR(8);
@greghelton
greghelton / PubSubApp.java
Last active April 28, 2016 18:12
The beta version of reactive programming is the traditional pub/sub app. It seems plausible that two instances of the same class may want to be in a pub/sub relationship so I wanted to code a class that would provide that.
package com.frisco.pubsub;
import java.util.Observable;
import java.util.Observer;
public class PubSubApp extends Observable implements Observer {
String name;
PubSubApp(String name) {
this.name = name;
this.setChanged();
}