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, refer to the Newton Toolkit information in the Newton FAQ.
Start by loading BinaryServer 1.11 onto your Newton. It will be automatically filed into the Extensions folder in the Extras 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 steps to add a 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. Move the JPEG image to your user home directory.
2. Issue 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, but use a different name for each binary being loaded.
3. Open the resulting chunk.rsrc
using ResEdit (in Classic). Click on the JPEG file inside the .rsrc
document and select Edit > Copy.
4. Open the default bin.rsrc
file included with BinInstaller 1.2 in ResEdit. Paste the JPEG data into the bin.rsrc file and save.
5. Open the BinInstaller NTK project in NTK.
You may need to use a computer that natively runs Mac OS 9.2.2 to run NTK because of the Mac OS X NTK/port issue documented in the Newton FAQ.
Add the following lines to the Install & Remove.f
file, after the included entry for the GIF:
{
class: 'binary,
path: "images/chunk.jpg",
binary: GetResource( "JPEG ", 1000, '|image/jpeg| ),
mimetype: "image/jpeg"
}
6. Build a package from NTK, selecting Project > Build Package.
7. Install the resulting Bin Installer.pkg
on the Newton.
Now there are three binaries on my Newton:
The only issue 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:
<img src="/bin/images/serve-npds.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.
Regarding the PortShareDemo mentioned in the Newton FAQ:
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 named the script <CREDITS>
as Paul mentions in the comments, and activated the script through the Script Editor.
Safari seems to be still a little hit-or-miss, but Firefox works fine.