JavaScript / Flash Chart Alternative

So many times it is nice to add a dynamic graph to a web page. I’ve personally done this with JavaScript libraries like PlotKit or Plotr. Also there is the use of Flash with PHP or ASP.Net in amCharts. But if the user doesn’t have Flash or JavaScript turned off these tools fail. While this doesn’t happen too often any more it still may be an issue. But one issue I’ve noticed is that these charts do take a lot of resources to run so if you have visitors with slower computers that may be a real issue.

So we need a simple alternative, such as generating an image server side and serving that up. While this isn’t too difficult you may not have an imaging library available or the resources to spare. That is where Google Charts comes in with their simple API you can quickly add graphs to your web page. It’s really simple just embed a special URL in an image tag which you can easily make dynamic with PHP, ASP, or any dynamic system you’re using. See the example below. It works very well, with minimal setup and no added software for clients is needed.

<img src="http://chart.apis.google.com/chart?
    chs=250x100
    &amp;chd=t:60,40
    &amp;cht=p3
    &amp;chl=Hello|World"
    alt="Sample chart" />

Sample chart

More →

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;
              }
    }
More →

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.

More →

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.

More →

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.

More →