graham.reeds/

Update

September 13th, 2009 :: graham.reeds
Categories: Galaxy ::Leisure ::Life ::Misc ::Programming ::Work

It’s been a while since I posted, so what has been keeping me busy?

Work, it’s getting easier – I think I am getting into the VB6 mindset, but I still hate VBA with a passion. When is the nice .NET extension becoming available? Is it already, and could Reporting Services save our souls (not to mention our sanity)?

Space is coming along very slowly. Any time I sit down to work on it I have to spend about an hour refreshing my mind on what I have done – and I only have about 40 mins to do it in.

Had my birthday: One of my presents was an iPod from Mrs Bear – which gave me a lovely opportunity to hate iTunes all over again. This time I accidently deleted my play list, there is no undelete and then it synced it – wiping it. I’ve installed iTunes 9 but I don’t hold out any hope for them fixing all the problems with it. Another present is an ant farm – so along with my Sea Monkeys you could say I have Surf’n'Turf.

Another side effect of my birthday was my the choice of venues for a meal.  Since I’ve always wanted to eat there I picked Kaminaki and had some of the nicest fish I have ever eaten, and definately the nicest pitta bread ever. All this and despite the grumblings of some of my friends.

1 comment.

Java and PHP sitting in a tree…

July 27th, 2009 :: graham.reeds
Categories: Galaxy ::Leisure ::Life ::Programming

…but not kissing.  That would be like kissing a red-headed cousin or something.

As you do with anything programmig related you jump straight in at the deep end. In this case I wanted to take SVG input, and output a JPG, from PHP.

So taking a look around there wasn’t much to choose from:

I know Java better than Perl, I decided to go with the Batik option.  This means enabling the PHP-Java extension, which is simply editing the ini file to uncomment out the line that reads extension=php_java.dll.

In addition to that you need to edit the [Java] section of the ini file. And that is where things get problematic. If you read the scant information on installation you will find that the last known installation was with Java 1.4. I have Java 1.6.14. I found a pretty detailed instructions on the O’Reilly site for Java 1.2. Shouldn’t be too different should it? So I configured it as best I could and ran a simple test program:

<?php

ini_set(“display_errors”, “1″);
error_reporting(E_ALL);

$systemInfo = new Java(“java.lang.System”);

print “Total seconds since January 1, 1970: “.$systemInfo->currentTimeMillis();

print ” Java Version: “.$systemInfo->getProperty(“java.version”);

?>

The output was Fatal error: Unable to load Java Library C:\Program Files\Java\jdk1.6.0_14\jre\bin\client\jvm.dll, error: The specified module could not be found. in C:\Develop\projects\zerosumgames\php\map\htdocs\java.php on line 6 which is never pleasant. So I pushed and poked with the ini file settings – there are only 4 variables so there isn’t much to play with, but nothing would make it work.

So it sat on a back burner for a few days, nagging at the back of my mind: What if I used the JVM that they used themselves? That should work shouldn’t it? So I rooted around on Sun’s site and found what I was looking for: An archive of the all the old JDKs!

So I grabbed the last 1.2, 1.3 and 1.4 JDK’s (after reading very, very carefully Suns EOL agreement) and began by installing Java 1.2 and configuring the ini file:
java.home = "C:\Program Files\Java\jdk1.2.2\bin"
java.library = "C:\Program Files\Java\jdk1.2.2\jre\bin\classic\jvm.dll"

Bingo the output was Total seconds since January 1, 1970: 1248652639311 Java Version: 1.2.2.

Java1.3 went on – and worked too. This is exciting as Batik needs a Java 1.3 runtime (or compatible) to work: Total seconds since January 1, 1970: 1248652802706 Java Version: 1.3.1_20

What about Java 1.4? This gives Batik a speed increase and allows Batik to use additional features (though I don’t really care about mouse-wheels): Total seconds since January 1, 1970: 1248652920024 Java Version: 1.4.2_19

You beauty! So why doesn’t 1.6 work? Surely it is possible? I know the JVM has moved from the classic folder into a client and server folder, but the internals must surely be the same. I pointed at the correct location, but are there any other 1.6 JVMs beside the client and server ones? Well there is the one that exists in jre6 folder put that produces the same error as before.

And finally 1.5? Well I never tried that one – I have a working PHP-Java bridge – and now I need to move on to bigger & better things.

While researching this post I came across Image_Canvas which might do what I want it to and entirelly in PHP – no Java required. However the problem with the documentation is that it isn’t very thorough and your are pretty much on your own. If I get stuck with Java & Batick then I will probably take a closer look but until then…tada!

1 comment.

Slow posts

December 7th, 2008 :: graham.reeds
Categories: Galaxy ::Leisure ::Life ::Programming

The posts are slowing, due to Christmas arriving (and ’tis the season of parties) and me now working with the Zero Sum Games guys (and gals), the new owners of Space – Glory Through Conquest - the game I was working against with my homage, Galaxy. Galaxy is not off the cards, but it’s definately been put on a back burner now.

0 comments.

Testing Times

December 6th, 2006 :: graham.reeds
Categories: Galaxy ::Programming

No posts for nearly a month and then 2 in a day!

Anyway: Work continues, albeit slowly, on my S:GTC-a-like which goes by the not-at-all-original working name of Galaxy.

The purpose of this post – apart from to assure those that follow this blog that I am still working on it – is about Unit Testing. Now everyone who programs in Java uses JUnit for unit testing, and it is a useful piece of software. Every open source IDE worth it’s salt has support for JUnit – even MS who seem to behind the curve on IDE development by a good couple of years has support for it in VS2K5 (in regards to C# that is).

You are reading this thinking that there is a “but” to all this and you’d be right. I have a class, which has all it’s parameters encapsulated so therefore you must use the setMethod() and the corresponding getMethod() to set and get the values. No problem there – that’s standard practice, but when it comes to testing you have to test two functions per test instead of one: You can’t test that getMethod() works without first calling setMethod() and vice versa without breaking encapsulation. Oh well, if one of the functions fails then both set and get functions will fail and shouldn’t be too hard to find out which failed.

Heading on I can see some more bumps in the road: Testing of interface classes, and testing of functions that naturally take a minute to compute before a result is available.

0 comments.