Tuesday, 30 October 2007

FTP

I've been using FTP for a few years. It's so simple, even I can understand it! Or so I thought. Plain FTP is very simple, but incredibly insecure (the password and all the data is transmitted in clear text!). It's also quite easily automated with a script, and luckily these work pretty much the same under Windows and OS400 / i5OS. See Thibault Dambrine's article & FAQ.

A few months ago I set up SSH FTP or SFTP (as a client). This is encrypted with Secure Shell. I've been using WinSCP to connect to some Linux boxes, and it has a perfectly good command line/scripted interface so was the obvious choice, and was nearly as easy as plain FTP, just had to set up certificates first.

Recently, however, I had a need for FTP SSL or FTPS. This gets complicated. Plain FTP clients usually default to passive mode to overcome problems at the firewall, and often there's a command to toggle passive or active mode. Also may firewalls are now FTP aware and will let FTP traffic through. However when the traffic is encrypted this isn't possible. Then there's the added complication of implicit or explicit mode, and even which parts are encrypted. I found some free command line FTPs clients, but only one came with some reasonable documentation MOVEit Freely from Standard Networks.

Not forgetting that another way of encrypting all traffic (not just FTP) is to use a Virtual Private Network or VPN. Can be faster, especially if your networking hardware is doing the encryption. If you're short on networking skills, or money/hardware can be expensive and not particularly scaleable.

Monday, 3 September 2007

Doh! Why didn't I think of that

I've been on the lookout for a flexible tool to produce XML for a while, but hadn't come across anything I thought suitable.
Inbound XML was a big priority a few years back, when even fewer tools were available, so we ended up writing our own. It's not especially flexible, but it does the job and is still in daily use.
Outbound XML, until recently, hasn't been a priority. Happily the need and the solution coincided. I came across an article by Jon Paris (registration required - free) discussing using templates and CGIDEV. We've had CGIDEV2 for a while, but I didn't make the connection. Works a treat, saves me writing inflexible (& probably bad) programs with lots of hard-coding. No need for anything expensive or proprietary. What more could I want?
Doh! Just call me 'Homer'.

Wednesday, 1 August 2007

DNS Programming

Today I've been continuing my foray into calling standard C library functions (at least I think that's what they're called) especially DNS-related ones such as gethostbyaddress, inet_addr, inet_ntoa from an RPG program.

Eventually found what I needed in Scott Klement's Socket Programming tutorial. Not an obvious place, but it's there nonetheless. I couldn't get gethostbyname to work until I trimmed all trailing blanks from the host name during the call.

Still have to sort out gethostbyaddr, that I did previously. Only seems to return one entry, sometimes a nonsense one. (I expect an array or a bunch of pointers). Even when I've solved that, I don't know how to choose the 'right' one.

Sunday, 1 July 2007

Messing with .pdf's

Recently I've been having to mess around with Adobe's Portable Document Format (.pdf) files. Along with the usual huge amounts of time wasted searching down blind alleys (a.k.a. "Googling"), I've discovered the following:

Readers/Viewers

  • Of course there's the well-known Adobe product Acrobat Reader, but I found a couple of other free readers for Windows (TM) that each have some useful features.
  • Foxit Reader. None of the bloat, so much faster it's a joy to use.
  • PDF XChange Viewer. Not as sprightly as Foxit, but superb options for adding annotations, highlights, notes, balloons, etc., etc.

Tools


I wanted to automate some things and found pdftk. FLOSS for Windows & Linux. A fabulous little command line tool with features such as splitting out pages. Recommended.

For Developers (PC)


iText is a mature Java library for manipulating .pdf's that I've found very useful and is the basis of pdftk. There's also a port to C# called iTextSharp.

For Developers (AS/400 or whatever it's called this week)


A series of articles by Giuseppe Costagliola (a.k.a. Beppe Costa) came in incredibly useful. These were in bite sized chunks, so I was able to try out & understand a technique before developing it further. His series of articles start with straight RPG, move through some C, and on to Java techniques.

Also useful was Jean-Paul Lamontre's Toolbox.


If you want to know how to write out .pdf files in your own programs you'll need the Adobe .pdf Reference - but it's very hard going. Find some examples out there on t'internet, or use something like iText. Trust me, it's a lot easier.