By Josh Burker & Grant Hutchinson
The NPDS Binary Server is an optional component that allows NPDS to serve binaries such as images, compressed archives, and other documents from a Newton soup. The BinInstaller utility is used to create compatible binary packages that can be installed onto a Newton and served via NPDS using the Binary Server module.
Unfortunately, creating the binaries for the the Binary Server to serve is not the most intuitive process. It is not difficult but it takes some patience and understanding of the tools that Paul so graciously provided us.
Here is what is needed:
If you are attempting to run NTK in Classic under OS X, you ought to take a look at this page:
Start by loading BinaryServer 1.11 onto your Newton. It will be automatically filed into the Extensions drawer.
Decompress the BinInstaller 1.2 archive. You will have a directory with BinInstaller, an NTK project; Install & Remove.f, the "code" for the project that you will modify to include your binaries; and bin.rsrc, a ResEdit document that you will also edit to add the data from your binary.
The following are the steps that I took to add a 20k jpeg file to the bin.rsrc file. Once a Newton package was built with the updated bin.rsrc file and the Install & Remove.f that had also been modified I had a jpeg as well as the included "serve-npds.gif" loaded into a soup on my Newton. Here are the steps I took.
1. Moved 20k jpeg image to my home directory on my OS X Mac.
2. Issued the following command in the Terminal:
echo "read 'JPEG' (1000) "\""chunk.jpg"\"" ; " | /Developer/Tools/Rez -o "chunk.rsrc" -t 'rsrc' -c 'RSED'
I wanted the resource to be named JPEG so I used 'JPEG' instead of 'DATA' in the command. You can make up any four letter name; you want to have a distinct name for each binary you are loading.
3. Opened the resulting chunk.rsrc using ResEdit (in Classic). Single-clicked on the JPEG file inside the .rsrc document and did an Edit > Copy.
4. Opened the default bin.rsrc file included with BinInstaller 1.2 in ResEdit. Pasted the JPEG data into the bin.rsrc file and saved.
5. Opened the BinInstaller NTK project in NTK. I had to boot my wife's iBook to OS 9.2.2 to run NTK because of the OS X NTK/port issue documented in the Newton FAQ. Added the following lines to the Install & Remove.f file, after the included entry for the GIF:
binary: GetResource( "JPEG ", 1000, '|image/jpeg| ),
6. Built a package from NTK, Project > Build Package.
7. Installed the resulting Bin Installer.pkg on the Newton.
Now there are three binaries on my Newton:
And yes, that's me on the bike.
The only issue I see is if I embed the following in my index.html page it seems that Safari usually times out before NPDS manages to serve the GIF:
I have adjusted the Latency in NPDS Setup as far up as it will go, figuring the longer it has to time out the more likely it will serve. I notice John Skinner's 'Mean Green Sr.' server has the same tag embedded on it's index.html page and it usually doesn't load in Safari, either. Firefox, however, does load the image, so it appears that it is a Safari issue rather than a problem with the Binary Server.
This was the first time I had ever goofed with NTK and it was a fun project.
I found a copy of the PortShareDemo that Victor mentions on his Newton FAQ page (his page has a broken link).
The correct page is here.
You can install the PortShare Demo Control Panel and the PortShareTask Extension then start Classic. Open the PortShare Control panel and create a virtual printer (or modem) port. NTK will then open in Classic, and you can do all your work from an OS X Mac.
Additionally, I figured out a solution for the 'serve-npds.gif' issue where it is not being displayed properly. Instead of calling the graphic directly, I have used the "new-credits" SSI script that is included in the NPDS Scripts repository:
I posted the script to my NPDS server using the 'admin-post' feature, then copied and pasted the script into the NPDS Script Editor, part of the NPDS Utilities package. I had to name the script <CREDITS>, as Paul mentions in the comments, and had to activate the script through the Script Editor.
Safari seems to be still a little hit-or-miss, but Firefox works fine.