fogbound.net




Tue, 22 Nov 2005

Space Trader on your Treo 650

— SjG @ 8:56 pm

I occasionally get asked about Space Trader, a great game for the Palm originally by Pieter Spronck. Several years ago, I helped him write some of the code that was released as version 1.2, way way back in October of 2002.

Evidently, version 1.2 doesn’t run on the Treo 650. I don’t even have a Palm development environment at the moment, so I haven’t had a chance to fix the code that crashes it. But never fear! It’s Open Source, and someone going by the name of DrWowe fixed it. In addition, it looks like Pieter has fixed a few outstanding bugs (that all look like they were in code I wrote… how embarrassing).

Read all about it at:

http://discussion.treocentral.com/showthread.php?t=55952
http://www.cs.unimaas.nl/p.spronck/picoverse/spacetrader/STDownload.html


Tue, 25 Oct 2005

PHP4 and PHP5 under Windows

— SjG @ 4:02 pm

There have been other articles on this, but I wanted to post my own approach, just because it’s such an ugly — yet effective — hack.

I wanted PHP 4 and PHP 5 to both live happily on my Windows 2k machine, and work under Apache 1.3x. Install them in c:\php4 and c:\php5, and there you go. It’s easy to create an httpd.conf that takes a define, and figures out which PHP to load based upon that define.

But then both PHPs want to use the same php.ini file, specifically, c:\WINNT\php.ini. This is only a problem when you’re using PHP extensions, because one version will try to load the wrong ones. There are registry tricks, supposedly, and environment variable tricks to get different .ini files going, depending on version. None of ’em worked for me.

So I opened up vim, and edited my php4ts.dll, and replaced the “php.ini” string with “ph4.ini”. Now I happily have two PHP installs, each with its own .ini file, and everything is copacetic — except for all that software that breaks the newly enforced reference rules. But that’s another story.


Sat, 24 Sep 2005

AJAX

— SjG @ 6:41 pm

So, while the core development of CMS Made Simple is undergoing some interesting (and pervasive) updates as we head towards a 1.0 release, I’ve been fixing modules to work correctly under PHP 4.4 and 5.0.5. Obviously, my understanding of references was weak, and I’m paying the price now. Damn, I wrote a lot of wrong code.

But now I’m playing with making an alternate Admin interface for CMS Made Simple using some of the fine AJAX and Javascript libraries out there.

I’m using xajax to marshall up objects and submit them nicely to PHP, and I’m using the script.aculo.us Web 2.0 and its underlying Prototype library for User Interface and special effects.

Some of it’s silly, like making the login box shake if you incorrectly enter your username or password (imitating Mac OS X login). But some of it is really slick — adding users to groups is now as simple as dragging’n’dropping items between lists. It could use a way of multi-selecting that worked with dragging, but an “add all” and “remove all” button mitigate that somewhat. Of course, the original interface will remain for non-Javascript users or people who prefer it.

I plan to do the same for assigning permissions to users. But the real challenge will be drag’n’drop content reordering. This will require a draggable tree. I haven’t yet found code to make this easy; even with all these great libraries, I have to be careful to select features that work equally well under the Evil of Internet Explorer, as well as Gecko-based browsers and Opera…


Dhalgren

— SjG @ 6:22 pm

Samuel R. Delany, Vintage; 1st Vintage Books ed, originally published 1973.

Dhalgren is one of those books you hear mentioned (in hushed, reverential tones) by the more academically oriented fans of speculative Science Fiction, by people who participated in the 60s counter-cultural experience, and by students of sexual politics. It is almost always refered to as “difficult” or “challenging” by the erudite, and “a trip” by the more participatory survivors of the culture wars. Occasionally, you’ll hear it called “crap” — or worse.

In some ways, Dhalgren is a shallow metaphor for the cultural changes happening in America in the late sixties. All the old rules have changed: the City of Ballona has had some unspecified cataclysm, people in the city do whatever they want and gather in new and shifting social configurations. Race relations get redefined. The bourgoisie are frightened (while their children are seduced). Strange religions flourish, new arts emerge, senseless violence flares, and psychadelic anarchy descends. Through it all, our protagonist is never sure if he is sane, and we might be tempted to believe that the whole thing is a madman’s visions.

Additionally, there is a sense of paranoia that lurks beneath the surface. The arts and media are manipulated by one powerful individual, a man we never quite see. Many of the hallmarks of the city of Ballona (the Scorpions’ light shields, the weapons, even the semi-mystical “optical chains” worn ritually by some to commemorate some profound personal event) are found in vast storerooms, packaged like government-issued equipment. Maybe the magic of Ballona is an experiment? Timothy Leary, LSD, and MK-ULTRA anyone?

Time has blunted some of Dhalgren’s impact. Sexuality that may have been revolutionary (in print, anyway) in the early 70s doesn’t even raise eyebrows in the Internet-age. But we have to keep in mind that interracial sex was considered deviant — or even criminal — at the time the book was written, and that homosexuality and bisexuality, not to mention sadomasochism and polyamory were still shocking.

Filed in:

Wed, 7 Sep 2005

Build PHP 5.0.5 for Mac OS X 10.4

— SjG @ 8:39 pm

I’m trying to track down a bug in my CMS Made Simple PHP code where I did something stupid with references (a rant on the PHP pass-by-value model available upon request). So it only manifests with PHP 4.4.x or PHP 5.0.5, since that’s where they finally decided to get strict with us idiot slackers. Neither of these are available as binary packages on Mac OS 10.4.

I was dismayed, shocked, stunned, dazed, and confused to learn that PHP was no longer a package for Fink. Dammit! Now I have to figure it out for myself. Crap.

With the help of a variety of pages out there on the web (especially this one), I was able to do it. Here’s how:

Install Fink, if you haven’t already. I use the “unstable” packages. Read the FAQ, and muck around with it for a while until you feel ready to proceed.

Install a wholehellovalotta packages using Fink:

  • libjpeg
  • libtiff
  • libpng
  • libxml2

I also installed the Fink version of MySQL server 4.1, client, and a bunch of shared libraries.

Next, gotta build ZLib:
curl -O ftp://ftp.simplesystems.org/pub/libpng/png/src/zlib-1.2.3.tar.gz
cd zlib-1.2.3
./configure --prefix=/sw
make
(su if necessary)
make install

(I did my install work in /sw/src, but you could do it somewhere else if it pleases you more. Just take note of this other location when you need it later.)

Finally, we get PHP 5 .0.5 from http://us2.php.net/get/php-5.0.5.tar.gz/from/a/mirror

tar xzvf php-5.0.5.tar.gz
cd php-5.0.5
./configure --with-libjpeg=/sw --with-libtiff=/sw --with-libpng=/sw \
--with-gd --with-mysql=/sw --with-xml --with-apxs --with-exif \
--with-jpeg-dir=/sw --enable-exif --with-png-dir=/sw --with-zlib-dir=/sw \
--enable-embedded-mysqli
make
(su if necessary)
make install

Now, I already had a version of PHP installed before this, provided by Marc Liyanage’s excellent binary packages available at his page, so I didn’t need to tweak my php.ini file. If you do, you’d probably do something like:

cp /sw/src/php-5.0.5/php.ini-recommended /usr/local/lib/php.ini

and then edit into submission. You can also use the more general php.ini-dist instead of php.ini-recommended. I don’t know why they provide both — probably to confuse idiots like me. You’ll also need to register the PHP Mime Type with Apache. Edit your /etc/httpd/httpd.conf file, and add either to the general area or to a specific virtual host the line:

AddType application/x-httpd-php .php

Now test it! Create a test file in your web root containing:

<php phpinfo();>

and browse on over to it. With any luck, you’ll be greeted with ahappy PHP 5.0.5 banner.
Celebrate this with red wine. Preferably good red wine. Then get back to coding. As should be obvious, I decided to document instead of code, but I didn’t skip that vital red wine step.

Enjoy!