Read only tables with IE6/IE7 Workaround

In an earlier post, I reported that the TR element in IE6/IE7 had a read only innerhtml. I have found a way to get around this while not perfect it works. It turns out while the TR’s innnerhtml is read only a TD is not. So you can add a TD with a column span equal to the total column in the table. Then you can add what you wanted to the TD’s innerhtml. Check out the example code below.

function addrow(http_request,elm)
    {
            var temp= http_request;
            var tablebody = elm.tBodies[];
              try
              {
                var row = tablebody.insertRow(elm.rows.length-1);
                var cell = row.insertCell(-1);
                cell.colSpan = "6";
                cell.className="nopadding";
                cell.innerHTML = "<table style='margin:0; padding:0; width:100%' border='1'><tr>"+temp+"</tr></table>";
              } catch (e)
              {
                var row = tablebody.insertRow(elm.rows.length-1);
                row.id ="sctablerow"+nextelm.value;
                row.innerHTML = temp;
              }
    }

java.lang.IncompatibleClassChangeError

So I encountered this odd error while working with the Crystal Reports XI Java Report Viewer. It showed up as “java.lang.IncompatibleClassChangeError: Implementing class” this has been one of the more cryptic messages from Java that I’ve had in a while. So a quick search turned up that this error can occur when parts of the Java Project have been compiled at separate times. So I did a quick clean build, well not that quick. Unfortunately I still got the error at run time. It was only happening with Crystal Reports so with some more digging I finally found that ReportViewer.jar and jrcerom.jar must be the first two jars in the class path to work. While I this is the first time in Java I’ve seen this it wasn’t too hard to fix. While using NetBeans in the library tab there are buttons to change the order of the files, unfortunately if you aren’t using NetBeans you will have go in and change the class path files by hand.

Forms Submitted by JavaScript

While building a simple shopping cart I was adding an update link so customers could easily update the cart quantities I would have done Ajax but we are on a time crunch and it would be more billable so get this much working now add the rest in the second phase. So I have my normal submit button, called submit and I wanted a simple link that said update that would submit the form to another page. Well thats not hard so I simply changed the action of the form and called the submit function, as seen below.

document.getElementById("cartform").action = 'cart.php?action=update';
      document.mycart.submit();

Well that should work fine, oh but no it doesn’t nothing at all was happening it was very odd. So I got out the error console and find that submit is not a function. Well thats odd. So I assume that I have and outdated reference for JavaScript so I dig around and all the example I see work just fine. After staring at it for what seemed hours I thought it better not be over writing the submit function for the form with the button named submit. Well it was, SOB. So if you make sure to not overwrite functions of forms with your field names, its just a big headache.

Amazon FPS vs Google Checkout

So working with these two relatively new systems I’ve come to the surprising conclusion that I like Amazon’s better. I find it odd because I’m normally a bit of a Google fanboy. I should explain more this conclusion is not for all cases there are many thing you can do with one you can’t with the other, but for the basic case I was trying to set up Amazon FPS worked much better. I wanted to create a simple checkout that allowed me to generate accounts after the payment was processed. Sounds pretty simple I did something like this with 1Shoppingcart.com and if they made it easy Google and Amazon should make it a snap.

So reading up on Google Checkout I found one surprising thing, I have to have some sort of certificate, well I think the documentation was a bit confusing. That is for the level 2 API integration and that seems to be what I wanted so I could process the information after they paid. Well I don’t want to get the secure stuff setup don’t want the bother or the cost of it, I would if this was going to be a real big deal site but its just a small project that at this point needs low costs and quick implementation more then keeping 1 or 2 people from creating a bogus login.

So I started looking at Amazon FPS and to start the documentation was much more approachable not sure if it was the content or the general layout but I found what I wanted in about 1/10th of the time. They have a nice section explaining how to make a dynamic button which is perfect and then describe how to sign the button when code samples, and the best part is they have many languages Java, PHP, and Perl to name the once I quick saw. The best part is that the callback URL can just be any URL no need for https so this makes it fit right into my current system.

Overall I found Amazon FPS quick and easy to implement a system with that interacted back with my site while with Google you can make quick Buy It Now buttons the integration back into the my system was not as easy and Google Checkout is very geared towards physical items that you ship while Amazon FPS doesn’t seem to really tie me into that. Maybe someone trying to sell physical items on Amazon FPS will have issues I’m not sure but I would love to hear any experiences.

Python CGI + FTP = Headache

I have taken over support of a Python CGI application, no big deal seems like an ok code base and the fixes seem simple. The first fix that needed to be done was a very simple change to some wording which required me to change a cgi file so I made the change tested it and it all worked on my dev system so I then uploaded the file over FTP to the server and nothing worked. So after lots of debugging trying all sorts of things, I remembered something about the binary and ASCII transfer settings for FTP. Mine was set to binary so I switched it over to ASCII uploaded the file again and sure enough everything worked again.

So as a word of advice when working with CGI and FTP always check your transfer settings, had I done this when I started I wouldn’t have wasted hours of my night.