msgbartop
by Joe Zack
msgbarbottom

01 Dec 08 MySQL Casting Gotcha

Works

SELECT 409.95 = (1 + 408.95)

Doesn't

SELECT 409.95 = (a + b)

Works

SELECT 409.95 = CAST((a + b) AS decimal)

Tags: ,

17 Nov 08 Chase Paymentech / CFHTTP Problem

I was working on implementing a ColdFusion payment processor for Chase Paymentech, but I kept running into the same error (which I've formatted so nicely using my ruby clipboard format utility!)

<?xml version='1.0' encoding='UTF-8'?>
<Response>
    <QuickResp>
        <ProcStatus>05</ProcStatus>
        <StatusMsg>PTI43,TEXT/XML; CHARSET=UTF-8 is not supported</StatusMsg>
    </QuickResp>
</Response>

I knew that PTI43 was part of the MIME Header Content-Type I was passing, so I did a little bit of poking around in the docs and came upon this. Apparently setting a cfhttpparam type of "xml" "identifies the request as having a content-type of text/xml.".

In order to send a valid message to chase you have to specify a particular MIME header setting "Content-Type", which ColdFusion was garbling. Thankfully all I had to do to fix it was switch the cfhttpparam type attribute to "body" in order to fix it.

<cffunction name="Authorize" output="no">
    <cfargument name="vars" required="yes"/>
 
    <cfset var cfhttp = ""/>
    <cfset var i = ""/>
 
    <cfheader name="POST /AUTHORIZE HTTP/1.1">
    <cfhttp url="#GetURL()#" port="#GetPort()#" method="POST">
        <cfloop collection="#arguments.vars#" item="i">
            <!--- header variables --->
            <cfif i NEQ "XML">
                <cfhttpparam
                    type="header"
                    name="#i#"
                    value="#arguments.vars[i]#"
                />
            </cfif>
        </cfloop>
 
        <!--- set the type to "body" NOT "xml"!!! --->
        <cfhttpparam
            type="body"
            value="#arguments.vars["XML"]#"
        />
    </cfhttp>
 
    <cfreturn cfhttp/>
</cffunction>

I hadn't run into this problem before, so I thought I'd share!

Tags: ,

11 Sep 08 Ps3 Bad Company Update Problem

I'd tried a few times over the last week to update Battlefield: Bad Company on the PlayStation 3. Every time I tried I would get hung up on the "Downloading update data..." screen. It would stay at 0% for a few minutes and then briefly flash me an error code in the top right corner (8002AD23) and a few minutes after that it'd bounce me to another screen: "An error occurred during the download operation (80710723)"

I googled around for a while. Opened some ports on the router, plugged directly into the wall, restarted. I finally found somewhere that recommended I disable my media server via the network settings and BAM! "fixed"

My "source" for the "fix": http://www.fixya.com/support/t291065-ps3_system_update_error

Tags: , ,

05 Sep 08 Ubuntu Hardy Heron ColdFusion 8 Oopsie

Somehow I managed to bugger up the ColdFusion installation on my beloved laptop. Whenever I would try to start the cf server I would get the following not-very-helpful message.

Running the ColdFusion 8 connector wizard
======================================================================
Configuring the web server connector
(Launched on the first run of the ColdFusion 8 start script)
Running apache connector wizard...
=======================================
There was an error while running the connector wizard
Connector installation was not successful

I googled around enough to realize that since it didn't appear to be a common problem, that it was probably something I did. And it was.

As you may have figured out by now, I'm not a server-config kind of guy. I poked around a little bit and found an interesting looking shell script at /opt/coldfusion8/bin/connectors/apache_connector.sh. Running that gave me a much better error message:

Could not find directory /etc/apache2/apache2.conf

I opened the file and realized that the paths were all boogered up, meaning the paths I entered when installing ColdFusion where all buggered up. In any case, I fixed the incorrect paths and here's what the file looks like now:

#!/bin/sh

#
# Configure the Apache connector.
#	-dir should be the *directory* which contains httpd.conf
#	-bin should be the path to the apache *executable*
#	-script should be the path to the script which is used to
#		start/stop apache
#
../../runtime/bin/wsconfig \
	-server coldfusion \
    -ws apache \
	-dir /etc/apache2 \
	-bin /usr/sbin/apache2 \
	-script /etc/init.d/apache2 \
 	-coldfusion

exit $#

And Voila!

Tags: , ,