Working MySQL 5 OLEDB Connectivity for XMPie Server
February 15th, 2008
Well, after a long stint of having no decent MySQL support (as uProduce only supports up to version 4 out of the box. Other than my ODBC monkey patch there has been no version 5 support), I have managed to find a working, and critically viable, solution for using MySQL 5 with XMPie uProduce.
cherrycitysoftware.com sell (not that you can even call it that, its only $10) a little mysql driver that with a little bit of work you can make work with uProduce and uPlan – its nice to have MySQL back!
You can use a DSN with generic DB like this:
Provider=OleMySql.MySqlSource.1;Password=YOURPASSWORD;Persist
SecurityInfo=True;User ID=YOURUSERNAME;Data Source=YOURDBHOST;
Location=YOURDBHOST;Mode=Read;Trace="";Initial Catalog=INITIALDATABASE
Initial results are great – its working cleanly and quickly – good times with MySQL!
XSLT using Ruby
January 31st, 2008
Short Story
libxsl-ruby is a nightmare to install. If you can indeed get it to install at all. I couldnt get the bloody thing to install at all on my 10.5 OSX box; and thats with ALL the required libs installed. I get the impression that its not very well maintained anymore and the project following has dropped off.
I turned to ruby-xslt – based on REXML, so yes, its slower. If your looking for speed then persist with the libxsl ruby path, but otherwise, save yourself a lot of time and just use this. Its vastly simpler!
Long(er) Story
Libxsl sucks. Strong statment I know. I would say im a fairly techincal chap, and ive just spent, nay, wasted, the last 3 – 4 hours trying to work out why libxsl-ruby wont install. Thats a bit of a bugger indeed. Who knows what the problem is, but ultimately its less portable due to reliance of the Gnome XML parsing libs. Granted there very fast, but thats no help at all if you cant even install them.
REXML vs Libxml is a non-contest. We all know libxml is significantly faster – if you need that speed then i strongly advise you to continue with libxml; it will pay dividends in the end. If however your not going to need very fast parsing, then really, save yourself a lot of wasted time and use REXML.
REXML is bundled with the ruby distribution, so its also a lot more portable that libxml2. Anyway, if your even still reading, stop now, and bosh this into your terminal:
sudo gem install ruby-xslt
Job done.
Making XMPie work with PostGRE SQL 8.3 backend
October 19th, 2007
For all the good things about XMPie, one of my niggles has been the lack of support for PostGRE SQL. I guess thats pretty understanderble; most of there client base use SQL server and other such MS products to some degree. There are times when id really like to use PostGre SQL as the backend and it can be a bit annoying. Anyway…thats another story…. for now were just going to look at implementing the OLEDB conectivity onto the servers to make it talk to our datasource.
Before we begin please note that it is critical to make sure that your PostgreSQL server can accept connections from your host IP. Otherwise you will get an error detailing that windows could not initialize the OLEDB provider. So, for those not familiar with PGSQL, check your postgresql.conf and pg_hba.conf….
Step 1
Ok, firstly you will need to install the OLEDB driver onto the server (and all extension serves where applicible)…
Download the OLEDB driver files from here - its currently in beta so do bear that in mind. Once downloaded, unzip it and copy libpq.dll and PgOleDb.dll to your windows\system32 folder.
Next, to register those new files as sources, go Start > Run and type
regsvr32 PGOLEDB.DLL
All being well you should see a sucsess box - if not, then i guess check your spelling against the DLL :)
Step 2
Now, provided you got your working OLEDB driver up and running in the previous step (be sure to test this with a UDL script) you should be able to add the database into the xmpie dashboard using a dsn something like this:
Provider=PostgreSQL OLE DB Provider;Password=<pass>;
User ID=root;Data Source=127.0.0.1;Location=demo;Extended Properties=””
I am going to be doing some testing to see if this is any quicker than SQL Server (fingers crossed it will be) - stay tunned readers!
Give me a shout if you dont seem to be able to make this work (for whatever reason)
Im sure Microsoft must be a synonym for crap?
October 15th, 2007
I recently have had to do come C++ coding - not my usual play ground i must admit, but never the less, something I needed to do.
My first port of call was to download the Visual C++ installer, which I did. Fine and dandy I thought, it seemed to work ok. The GUI was typical 2007 style, so yes, I couldn’t find a thing.
I then set about doing some coding, only to find that even simple stuff like
#include <windows.h>
I was getting all manner of errors in the bottom console. I only then found out that without the super duper “Microsoft Platform SDK” you couldn’t actually do sweet f**k all. So, to another 500mb download, on top of the painful download and installation of the IDE, this was somewhat insulting.
<rant>
Microsoft, we the developers and end users of your software urge you to please plug your brain in before making these kinds of choices! I know you say VC++ is meant to only ‘give a taste’ for windows C++ development, but if you want that taste to be something other than bitter resentment, make sure your products work properly out of the box!!
</rant>
Fixing random PHP crashes on IIS 6 recorded as PHP memory leaks
September 30th, 2007
I recently came accross a serious problem that seems to be relativly un-documented bar other people raising bug tickets on bugs.php.net.
If you are having problems with PHP on IIS where you get a couple page views from your application then you just get a blank screen? If so then read on….
There was nothing in the Event Log for applicatons or system, so I tried re-starting IIS; with no luck. This particular problem seemed to be happening tottaly silently with absolutly no record anywhere (php_error.log et al). I them re-started the whole box, and upon boot up I checked the Event viewer and there was an entry in the application log detailing a memory leak in “php.exe”. So, a memory leak I thought, great…
Trawling the web I then found a document detailing how windows server kills off processes it deems to be at all ‘dangerous’. It does this silently (which is unbeliviably handy) and fitted with the problems I was encountering. Going on the presumption that it was indeed killing the PHP process (or more specifically the worker threads) I turned to the application pool configuration… And broke out alll my PHP apps into a seperate application pool. When they stoped working, I could just recycle the pool and they worked again for two requests. NB: Ive seen other peoples configurations take a couple more than 2 requests so bear that in mind if your having this problem.
So, by now I knew that it was windows killing of the process causing the problems, however I wasnst sure how to fix it.
I looked at the loaded modules in my PHP.ini, and found that removing all non-essential modules solved the problem. I then brought in one by one each PHP module, and found that it was not actually the modules them selves that were leaking, but just the order in which they were loaded causing the problem.
Yes, thats very crap. I couldnt find a more elegant solution to this, and I really hope this helps someone as I must have wasted a day of my life trying to solve this bloody problem! lol
Running Pound reverse proxy on windows server 2003
September 22nd, 2007
Pound is the unix reverse proxy software popularized by Rails deployment over the past 8-12 months. Pound is a unix tool, and was never meant to run under windows - it is however possible to make it run under windows if you package it up with some key DLL files from cygwin :)
I must stress here that this is not necessarily the best thing to be doing, this post is more about how to do it if you really want too rather than a "do this, I really recommend it" type post. There are also some issues with pound and its behavior with X-FORWARDED_FOR headers, but i wont bang on about that here; refer to google for more info. Anyway... back to the post.....
Take the latest pound distro from here then compile it from within Cygwin like so
./configure --without-ssl --disable-log --disable-dynscale
then
make all
Then you should be left with a working binary of pound within your build directory. In order to then make this work in a standalone fashion (I use the term standalone loosely as its still using the cygwin environment) you need to package several DLL files from cygwin:
cygssl-0.9.8.dll (required)
cygcrypto-0.9.8.dll (required)
cygwin1.dll (required)
pound.exe (required, should be fairly obvious!)
cygrunsrv.exe (optional, include only if you want to install pound as a service)
with these files you can then run pound, and even install it as a service on the host machine. If you do want to install the service, run the following command:
cygrunsrv --install Pound --path X:\applications\pound-2.3.2\bin\pound.exe --args "-f X:\applications\pound-2.3.2\config\pound.cfg" --stdout X:\applications\pound-2.3.2\log\pound.log --stderr X:\applications\pound-2.3.2\log\pound.log
Where "X:\applications\pound-2.3.2" is the real path to where ever it is on the file system you chose to install.
If you don't want to compile your own, then you can download my version of pound 2.3.2 for windows here. It goes without saying I take no responsibility for any problems you might run into by using my compiled version; it worked for me thats all I can say!
Making IIS play nice with Apache on windows server 2003
September 21st, 2007
Now, being a unix man through and through, I do see the irony that my first blog post is about winows; such is life!
Anyway…
Typically IIS and Apache do not work well together at all, as IIS hogs all IPs (both physical and ARP) on any given win 2003 machine which is why when trying to run anything else on port 80 on any IP can be a total nightmare.
I recently had to do an install on a win 2003 box where the client wanted to support some of their legacy ASP applications, PHP, but then allowing scope in the future to run Rails, Seam and Django applications. This means running:
- Apache with mod_python (for Django)
- Apache proxying to mongrel (for Rails)
- JBoss for Seam (EJB configuration)
- IIS for ASP/ASP.NET
IIS has no real ability to proxy to other backends (which in this instance we need due to the rails requirment) in the way Apache 2.2 does, so I chose to run Apache out front binding to one of my avalible 5 on this machine. Apache then uses proxy pass (or proxy balencer for rails) to pass PHP and ASP requests to IIS. No doubt there are people out there who would have chosen to run PHP on Apache, but due to the way the legacy applications were written, PHP and IIS were already installed so it made sense to leave it “as is” - no need to make more work for myself, especially as i only had one night to do the install!
Step 1
IIS however requires a bit of wrangling before we can get on with the install of Apache…Make sure you have your win 2003 install discs with you; as you’ll need to install the support tools (found in support > tools on the cd). It is however possible to do this without the support tools, but it involves hacking around in the registry. Once you have the support tools installed, were going to be making some changes to let IIS know what exact IP address it can bind too. If you have the support tools installed you can the use the httpcfg tool like so (note: if using RDP you might need to logout then login to get support tools on your PATH)
httpcfg set iplisten -i 555.555.555.555 (where this is your IP address)
If you do not have the support tools (or your just too lazy to dig out that disc from the depths of the server room) you can edit the following registry key:
HKEYLOCALMACHINE/SYSTEM/CurrentControlSet/Services/HTTP/Paramaters in there is a paramater called ListenOnlyList from which you can edit with the list of IP’s IIS should listen to.
Once youve done that, restart IIS as usual from the MMC.
Then you can do a netstat -ano to see that IIS only binds to the IP you set. Simple.
Step 2
Next up you need to download apache. I went with apache 2.2.4 without SSL, which i grabbed from here
Run the installer, and make sure you choose on port 80 as a server for all users when installing.
Once apache is installed, you’ll need to set up port listening and IP address binding. This is a well discussed topic in the apache manuals so I wont labour the point here. See the apache docs.
I then set up some virtual hosting to hand my requests off to IIS. Granted, I could have done this with rewrite rules for .asp extensions, but I chose to proxy it on domains, due to my particular circumstances. Heres what my virtual host looks like:
<VirtualHost *:80>
ServerName www.domain.co.uk
ServerAlias domain.co.uk
ProxyPreserveHost On
ProxyPass / http://172.16.1.11:3000/
</VirtualHost>
(Where my site definition within IIS was running on port 3000)
Step 3
I then downloaded Python and installed it. And then I followed the very good instructions on setting up mod_python on google groups
Step 4
Do the usual rails install bits and bobs - this is so well document I wont pollute the blogsphere any more :)
Step 5
Java time…. Download and run the JEMS installer. At this point we only want to install JBoss on the box with an EJB configuration; it will take a couple more posts to go into the configuration required to get JBoss Seam up and running so we shant discuss that here.
Summary
Thats pretty much it. Its not too difficult, you can proxy off to any service you want to (within reason) and you can have all the latest and greatest web serving technologys happily co-exsisting!