I recently had the "opportunity" to integrate a 3rd party library into a xAMP-based application. The library consists of a standalone windows DLL, and a couple of minimal header files. The header files comprise the ENTIRETY of the API documentation. The headers provide function prototypes, but no detail about return values, expected results, or detail of any sort, really.
The great thing is this: the producer of this library charges a good amount of money for the libraries. They even utilize FlexLM, a powerful, well-known network license manager. One really super thing I discovered, the API lists functions to allocate and interrogate the license server. However, if the license is unavailable, or something goes wrong with the license interaction; the function just hangs...forever.
To truly appreciate this, one must first think through the design for implementing the integration of this Windows DLL into my xAMP application. The DLL will almost certainly not be deployed on the same server as my webserver (which may actually be a linux machine). The challenge is to connect to the DLL from an arbitrarily hosted PHP page.
My approach was to create a windows service, which sets up a TCP socket server, listening on a specific port. This service then links the DLL and appropriate resources, and receives requests from the PHP page. The service interrogates the 3rd party library, and returns results to the calling PHP page via the same socket that the PHP page established.
The windows service is coded in C++. To get around the questionable implementation of the license calls, I simply invoke a new thread, and set a WaitForSingleObject with a predefined timeout. If I timeout, I know there was some unknown license issue. Not elegant, but this is the real world, folks.
Friday, December 21, 2007
Saturday, December 1, 2007
My Development Machine
I thought it might be interesting to describe the setup of my current primary development machine. The hardware is a bit dated, but it "works".
I've got Ubuntu 7.04 loaded on a Dell D810 with a 1.8GHz Pentium M and 2GB of PC4200 RAM and a 120GB drive. On top of Ubuntu, I've loaded Beryl so I've got all the cool eye candy.
Much of my development and testing needs Windows, so I installed VMWare Server v1.04. I have VMs for XP, 2000, and even Win98. The VMWare works pretty well, but having used a similar setup on a dual core machine, the extra core REALLY pays off when using virtualization. My single drive spindle also slows things down occasionally.
I'm using Mercurial for an SCM, so I host all my repositories directly on my notebook's hard drive. Yes, I'm backing up regularly. I have an SMB share set up on the main repository directory, so I'm able to mount a network drive from my various Windows VM's in order to branch/merge etc.
I looked high and low for an exceptionally powerful editor to use for my source editing, and ended up with vim on linux, and EditPlus2 on windows. (Incidentally, I paid the money for EditPlus, and have never regretted it.) For C/C++ on Windows, I'm using Bloodshed's DevC++, and am fairly happy with it.
On my dev and test Windows VM,s I installed a WAMP stack from e-Novative http://www.e-novative.info/software/wamp.php. This made for a trouble-free installation; and I personally prefer Apache for dev/test. We do deploy to IIS, so I have a test server VM with IIS as well.
I am currently in the process of moving the test server VM's onto an actual server. I have a dual Xeon HP server just sitting here loaded up with Suse10.2 and VMware server. Once I get the access channels set up into/out of the network, I'll migrate those VMs over.
I've got Ubuntu 7.04 loaded on a Dell D810 with a 1.8GHz Pentium M and 2GB of PC4200 RAM and a 120GB drive. On top of Ubuntu, I've loaded Beryl so I've got all the cool eye candy.
Much of my development and testing needs Windows, so I installed VMWare Server v1.04. I have VMs for XP, 2000, and even Win98. The VMWare works pretty well, but having used a similar setup on a dual core machine, the extra core REALLY pays off when using virtualization. My single drive spindle also slows things down occasionally.
I'm using Mercurial for an SCM, so I host all my repositories directly on my notebook's hard drive. Yes, I'm backing up regularly. I have an SMB share set up on the main repository directory, so I'm able to mount a network drive from my various Windows VM's in order to branch/merge etc.
I looked high and low for an exceptionally powerful editor to use for my source editing, and ended up with vim on linux, and EditPlus2 on windows. (Incidentally, I paid the money for EditPlus, and have never regretted it.) For C/C++ on Windows, I'm using Bloodshed's DevC++, and am fairly happy with it.
On my dev and test Windows VM,s I installed a WAMP stack from e-Novative http://www.e-novative.info/software/wamp.php. This made for a trouble-free installation; and I personally prefer Apache for dev/test. We do deploy to IIS, so I have a test server VM with IIS as well.
I am currently in the process of moving the test server VM's onto an actual server. I have a dual Xeon HP server just sitting here loaded up with Suse10.2 and VMware server. Once I get the access channels set up into/out of the network, I'll migrate those VMs over.
Subscribe to:
Posts (Atom)