Skip to content

Instantly share code, notes, and snippets.

View ar's full-sized avatar

Alejandro Revilla ar

View GitHub Profile
public class CustomerCreate extends RestActionSupport {
private final String name = "304.301.CUSTOMER";
@Override
protected Map<String, Object> doExecute(DB db, JPublishContext jpc, Configuration c) throws BLException, ISOException {
final ISOMsg request = new ISOMsg("2304");
final Date date = new Date();
request.set(7, getDate(date));
request.set(11, getStan());
@ar
ar / QMUX patch
Created April 13, 2011 12:32
MUX patch
diff --git a/jpos/src/main/java/org/jpos/q2/iso/QMUX.java b/jpos/src/main/java/org/jpos/q2/iso/QMUX.java
index cedffdc..1dacefa 100644
--- a/jpos/src/main/java/org/jpos/q2/iso/QMUX.java
+++ b/jpos/src/main/java/org/jpos/q2/iso/QMUX.java
@@ -271,6 +271,8 @@ public class QMUX
if (timeout > 0)
DefaultTimer.getTimer().schedule (ar, timeout);
}
+ if (sp.rdp (req))
+ throw new ISOException ("Duplicate key " + req + " detected");
@ar
ar / jline.patch
Created April 5, 2011 16:37
jline issue on OS X and proposed simple patch
We found an issue when running it on OS X, we get this exception:
java.util.zip.ZipException: error in opening zip file
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.<init>(ZipFile.java:114)
at java.util.jar.JarFile.<init>(JarFile.java:135)
at java.util.jar.JarFile.<init>(JarFile.java:99)
at jline.ClassNameCompletor.getClassNames(ClassNameCompletor.java:89)
at jline.ClassNameCompletor.<init>(ClassNameCompletor.java:33)
01 00000003 Preparing org.jpos.jpts.PrepareContext
01 00000003 Preparing org.jpos.transaction.Open
00 00000004 Preparing org.jpos.jpts.PrepareContext
00 00000004 Preparing org.jpos.transaction.Open
02 00000005 Preparing org.jpos.jpts.PrepareContext
02 00000005 Preparing org.jpos.transaction.Open
03 00000006 Preparing org.jpos.jpts.PrepareContext
03 00000006 Preparing org.jpos.transaction.Open
@ar
ar / dave-mbp.xml
Created February 17, 2011 19:11
Who can beat Dave's new MBP?
<profiler>
PACK tps=51505, peak=51505, avg=34402.50 [2281.8/2281.8]
UNPACK tps=43221, peak=43221, avg=21610.50 [1989.6/4271.4]
PACK/UNPACK tps=26035, peak=26687, avg=22932.25 [3807.2/8078.6]
UPDATE/PACK/UNPACK tps=17016, peak=17016, avg=16471.67 [6679.7/14758.4]
end [14758.4/14758.4]
</profiler>
@ar
ar / Parity.java
Created January 23, 2011 00:42
Adjust parity
public class Util {
/**
* DES Keys use the LSB as the odd parity bit. This method can
* be used enforce correct parity.
*
* @param bytes the byte array to set the odd parity on.
*/
public static void adjustDESParity (byte[] bytes) {
for (int i = 0; i < bytes.length; i++) {
@ar
ar / BaseChannel.socketClose.java
Created January 17, 2011 23:13
BaseChannel.socketClose
private void closeSocket() throws IOException {
Socket s = null;
synchronized (this) {
if (socket != null) {
s = socket; // we don't want more than one thread
socket = null; // attempting to close the socket
}
}
if (s != null) {
try {
@ar
ar / pwdc
Created December 21, 2010 19:24
Copy working directory (pwd) to clipboard
#!/bin/bash
echo -n `pwd` | pbcopy
#!/bin/bash
if [ "$1"x == "x" ]; then
echo "Wrong number of parameters. Usage: $0 projectname";
exit 1
fi
mkdir $1 || exit 1
echo "Creating directory $1"
svn add $1
@ar
ar / Q2 script
Created December 7, 2010 21:48
Q2 start script
#!/bin/bash
cd $HOME/git/jpos
mvn -Dmaven.test.skip=true clean package
cd jpos/target
tar zxf jpos-1.8.0.tar.gz
cd jpos-1.8.0
exec bin/q2