Progress User Conference 2009 – online!

I’m currently attending my first Progress User Conference without being on location. Progress decided to go with an on-line conference this year in honor(?) of the economic recession.

The on-line format has some advantages and some disadvantages. Advantages are that I don’t need to get on a plane, check into a hotel, run all over the place to find the right room. I can actually keep an eye on my email, and look up things online, while listening to the presentations (although I could do that with a laptop). Disadvantages are the audience responses, human interaction, and the fact that I’m still at my desk and my co-workers look at me sideways wondering why I have these headphones on…

I’ll post a short update at the end of each day (which now ends around 1:15PM, as opposed to around 4PM for regular conferences) to let you know what I’ve taken away from that day.

SQL Challenge vs. Progress 4GL

One of the newsletters I subscribe to is the SQLCentral solutions. A couple of weeks ago they issued the Summer SQL Stumpers 2009, asking for the fastest way to calculate all the primes 1000 or lower. The fastest solution they came up with runs in about 7 seconds, which I thought was terribly slow for the algorithm used (Sieve of Atkins and Aristophanes), and I thought I’d give Progress a try. I came up with the following:


DEFINE TEMP-TABLE ttPrime
FIELD prime AS INTEGER
INDEX prime prime.
DEFINE VARIABLE i AS INTEGER NO-UNDO.
DEFINE VARIABLE test-val AS INTEGER NO-UNDO.

ETIME(TRUE).

DO i = 1 TO 1000:
CREATE ttPrime.
ASSIGN
ttPrime.prime = i.
END.

DO i = 2 TO 499:
ASSIGN test-val = i * 2.
REPEAT WHILE test-val < = 1000:
FOR FIRST ttPrime
WHERE ttPrime.prime = test-val
EXCLUSIVE-LOCK:
DELETE ttPrime.
END.
ASSIGN test-val = test-val + i.
END.
END.

MESSAGE "Etime" ETIME
VIEW-AS ALERT-BOX INFO.

FOR EACH ttPrime
NO-LOCK:
DISPLAY ttPrime.
END.

On my machine the procedure runs in about 93 milliseconds, and as far as I can see the results are accurate. Progress 4GL FTW!

ICVerify: encrypt request and answer files using EncryptionManager

To increase the security when dealing with credit card processing via ICVerify’s request/answer methodology, it is possible to encrypt and decrypt this information. However, the documentation is fairly sketchy on this subject, especially when you’re not working in one of the languages used in the examples in the SDK.

After some hair-pulling on why it doesn’t work, I think I’ve got it figured out now. Here are the steps I used to get it working:

  1. EncryptionManager.DLL is not a normal DLL, it is a .NET assembly. Trying to register it with regsrv32 will result in an error message, saying that it doesn’t have a DLLRegisterServer entry point. The trick is to use either the .NET gacutl.exe or the icvgacutil.exe supplied on the ICVerify SDK CD.
    UPDATE:You also have to use regasm to register the assembly!
  2. Once registered at the Global Assembly Cache (GAC), the name of the DLL is not EncryptionManager. To make things more interesting, I had to link to the name FirstData.Encryption.Facade.EncryptionManager. The only way to figure this out is to dig through the registry after registering the DLL, or to use the option on the GAC utility to write out a registry modification file.
  3. In Progress, you can use the COM viewer to access EncryptionManager.tlb, and see the different methods defined in the DLL. You’re only going to be using 2 of them most likely: EncryptThirdPartyMessage and DecryptThirdPartyMessage. Both use the creation date of the file you’re working with, so be careful not to copy this file or move it across file systems.

The Progress code I used to encrypt a request file is as follows:

DEFINE VARIABLE vhEncryption AS COM-HANDLE NO-UNDO.
DEFINE VARIABLE vcPrepFilename AS CHARACTER NO-UNDO

INITIAL “C:\TEMP\icver001.prep”.

DEFINE VARIABLE vcReqFilename AS CHARACTER NO-UNDO

INITIAL “C:\TEMP\icver001.req”.

DEFINE VARIABLE vcEncrypted AS CHARACTER NO-UNDO.
DEFINE VARIABLE vcRequest AS CHARACTER NO-UNDO.
DEFINE STREAM sOutput.

UPDATE vcRequest FORMAT “x(60)”.
CREATE “FirstData.Encryption.Facade.EncryptionManager” vhEncryption.
OUTPUT STREAM sOutput TO VALUE(vcPrepFilename).
vcEncrypted = vhEncryption:EncryptThirdPartyMessage(vcPrepFilename,vcRequest).
PUT STREAM sOutput UNFORMATTED vcEncrypted.
OUTPUT STREAM sOutput CLOSE.
OS-RENAME VALUE(vcPrepFilename) VALUE(vcReqFilename).

The decryption routine is somewhat simpler, since we don’t have to move files around so much:

DEFINE VARIABLE vhEncryption     AS COM-HANDLE NO-UNDO.
DEFINE VARIABLE vcAnswerFilename AS CHARACTER NO-UNDO

INITIAL “C:\TEMP\icver001.ans”.

DEFINE VARIABLE vcEncrypted AS CHARACTER NO-UNDO.
DEFINE VARIABLE vcDecrypted AS CHARACTER NO-UNDO.
DEFINE STREAM sInput.

CREATE “FirstData.Encryption.Facade.EncryptionManager” vhEncryption.
INPUT STREAM sInput FROM VALUE(vcAnswerFilename).
IMPORT STREAM sInput UNFORMATTED vcEncrypted.
vcDecrypted = vhEncryption:DecryptThirdPartyMessage(vcAnswerFilename,vcEncrypted).
INPUT STREAM sInput CLOSE.

These code snippets should have some more error checking. Also, the request can be more than one line, depending on the version of ICVerify and the answer file settings in the configuration.

“Hello, World” in 366 programming languages

I came across this interesting page, that shows the ubiquitous “Hello, World!” program in 366 different more or less well known programming languages.

It clearly shows the difference in the two database language that we use at my place of work, Cobol and Progress.

Cobol:

* Hello World in Cobol

*****************************
IDENTIFICATION DIVISION.
PROGRAM-ID. HELLO.
ENVIRONMENT DIVISION.
DATA DIVISION.
PROCEDURE DIVISION.
MAIN SECTION.
DISPLAY “Hello World!”
STOP RUN.
****************************

Progress:

/* Hello World in Progress */

message “Hello World” view-as alert-box.

Check it out, there are some weird languages listed, like LOLCODE and Argh!
Technorati Tags: , , ,

Setting up MXP to run under Linux

Recently our systems administrator asked me if it was possible to run MXP under Linux. “I don’t think there is a client of Progress for Linux, at least not graphical”, was my first response. But I got intrigued, and started digging (or rather, googling) around. And it is possible.

I’ll describe what I did under Ubuntu 7.10 with Progress 10.0B, and MXP 8.1E. The steps should be very similar for other Linux flavors, or later versions of Progress and MXP.

[Read more...]