Posts Tagged ‘Bugs’

Not your regular TI-83

I’ve only ever owned one graphical calculator, a TI-83, which was bought for me around when I started Secondary School. It was the device on which I broke my programming teeth, making crummy games and utilities to make maths exercises less tedious.

The other week I was experimenting with the HTML Canvas element for another little side-project of mine when I was reminded of the Graph Plot screen which my old calculator has. Essentially it lets you enter a Cartesian equation which it will then plot on the screen.

Subsequently, over a couple of days I put together a Javascript powered equation plotter, with much the same functionality as my TI-83. Oh and in the process I found a bug in the WebKit nightly, which they swiftly fixed.

You’re free to use the source to the how you wish, if you’re that way inclined (it’s a client-side web script so it’s practically open source off the bat). Under the hood it makes use of the MooTools javascript framework, though I’ve not made use of its features extensively, so It would only be a matter of an evening’s work to remove this dependancy.

Posted: November 4th, 2008
Categories: Programming
Tags: , , , , , , ,
Comments: No Comments.

A case of bad cropping

Recently, by pure chance, I’ve been working for two different research projects which both have involved Java Applets.

The first project ran afoul of bug #6669818 which prevented the applet from connecting back to the originating server during LiveConnect calls, in Mozilla Firefox on a Windows XP platform.

Fortunately there is a workaround for this; by passing the task off to another thread which was started in a non-LiveConnect part of the Applet’s lifecycle, the task is then executed in another thread which is not subject to the same malfunctioning security check.

If you’d rather not have to create a thread just for this, a quick hack is to pass the event off to the applet rendering thread using the SwingUtilities.invokeLater(Runnable); function.

In the second project I’ve now encountered another platform-specific Applet quirk, this time with Mac OSX.

Using Javascript it is possible to change the size of an Applet on the page in the same way you would any other DOM element, however on Mac OSX any browser using the Java Embedding Plugin (Firefox, Opera and others) will fail to resize Java Applets correctly.

I’ve knocked up a simple test page which allows this to be tested, and shows a potential workaround.

There appear to be two problems cropping up; the first is that the Browser does not notify the Applet that it ought to resize. If you leave the “Notify Java” check-box un-checked when submitting the form, the browser expands the area the Applet ought to be using, but the applet continues to draw in it’s original position.

The second issue is that when axis are changed and Java is manually notified the behaviour still does not perform as it ought to. The clipping region of the Java applet rendering is not updated correctly, and thus only part of the applet is correctly rendered.

There is a temperamental workaround for this, by programatically resizing one axis and then the other in quick succession, but this seems to fail as often as it works, depending on whether the page is being loaded from nothing, refreshed, no-cache refreshed or returned to via the browser ‘Back’ action.

In the interest of getting this bug fixed the code to the Applet resize test page is linked from the test page and free for all to use.

Bugs:

Posted: August 23rd, 2008
Categories: Programming
Tags: , , , ,
Comments: No Comments.