Linux Does Comics

Robert Suckling

Issue #4, August 1994

In this article, Robert Suckling describes a “real-world” application of Linux: running a subscription service. He also describes some possibilities that he has not yet deployed, but has run tests on, and which are feasible.

A few years ago, some friends and I opened a small store selling mostly role-playing games. We stocked many other games and as a sideline some of the partners wanted to sell comics.

A little bit later, after Linux version 0.11 hit the streets, I bought my first home PC. It was a 386/33dx with 120 MB of disk and 20 MB of RAM, and for a while it was just my toy.

Back at the store, comic sales were picking up, and when you sell comics you also take subscriptions. So Tony, one of the partners, started to take lists of comic subscriptions written on paper. When the comics orders came in he would spread out all the new comics on a table and scan each list for titles on the table, and when he saw one he would put it in the subscriptions folder.

Tony started to stress out when there were about 50 people with subscriptions. The time to scan the 50 lists on paper with the 100 comic titles spread out on the table was getting overwhelming. Tony would try to hurry, but then he started to miss comics and make mistakes, and then people would ask why we did not save their comics for them.

Linux to the Rescue

At this point one of our less computer-oriented partners, Greg, tried to put the subscriptions on a spreadsheet. He tried to list each customer as a row and each comic title as a column. It did not work, because the spread sheet was too wide to print. At this point I brought in my computer from home, and Greg helped me type in the comic data. I stored each subscription in a separate file. Now the big transformation that was needed was simply to use cat and sort. This turned lists of subscriptions (of titles) into lists of titles (of subscriptions). “The Guys” like hard copy, so they print the list sorted by titles, take each title in turn, find the list of subscriptions for that title on the printout, and put a copy into each comic slot.

My first incarnation of this was written under DOS mostly with DOS-perl. But being a Unix hacker, I missed all the Unix system calls and stuff. After playing a bit more with Linux, and after I installed the first MCC-interim Linux distribution on my PC, I switched the comic system over to Linux.

Now the comics were going to the right customers. We still used the paper pages for users to make changes to their subscriptions, though. And one of us still had to take each page each week and enter the changes into a file and print out the new subscriptions.

After a few months of editing subscription pages it became tiresome and error-prone to make all the customer changes. Customers would come in and ask us where the X-Men titles they signed up for were, and we would check their current list on the computer, and it would not be there, but the paper page where they requested it would be in the book.

I wrote a set of menus with perl (what else) that would let users delete and change their subscriptions online. So far, so good, but we could not allow a customer to add simply anything to their subscription. We could have a customer try to subscribe to something new that we could not get for them, so we had a problem with customers adding things.

My solution was that a customer could add any title that another customer was already getting. At least most of the time, if one customer was getting a copy of some item, getting another copy was not a problem. For this I took the current list of titles of things being asked for and made a file that the user could search through to get to a single item that was desired. This item then could be added to their subscription.

Something old, something new...

So now customers were able to add something old to their subscription. Now for the new stuff. The comic book distributors we use have a computerized ordering system, so they supply us with a computerized listing of new titles at the beginning of each month. This data is in the form of a DOS disk with a file of one-line entries for each title. Yet another perl script pulls out the new titles and saves them in another file like the current items listing I just talked about. Now the users can search through this file and add new titles to their subscription. The distributers also supply a 300- to 400-page catalog that we give out free to our subscription holders.

There is a two week window each month from when we get the data and the catalogs to the time our customers can add anything from the catalogs to their subscription. After two weeks we make our order to the distributor, so I delete the new titles file, and the menus detect this and no longer let customers add new stuff, so only the current old titles are available after the 15th.

I set up a dumb serial terminal in the front of the store and wrote some menus that would let customers edit their subscription file. Customers can add titles from the distributors' listings or from a list of popular titles. This way a customer cannot add a title we can not get, but he can change the number of each title or the starting and ending issue numbers, as well as delete a title. We have been using this system for nearly two years, and we now have over 200 subscribers managing over 1800 subscriptions on-line with Linux.

The competition

Last spring I attended a major comic book trade show for comic book store owners. One of the speakers sold software that could be used to maintain comic book subscriptions. I asked him if he could support customers making changes to their own subscription. He said, “No way”-he could not have some kid walking up to a DOS box, because the kid could type CTRL-ALT-DEL or something and destroy the database.

That cannot happen on my dumb terminal running from my Linux box.

In the Future

Another thing I have wanted to do at the store was run an inventory system on the gaming stock. The gaming stock, unlike the comic stock, can be reordered from the distributors on demand. My partners do not understand how easy it would be to implement an inventory system, but I have all the tools waiting for them, should they some day want one.

I have learned how to print barcodes from scratch. I plan to print product numbers on the labels with my own program so that a barcode reader can be used at the checkout counter. Given:

  • a last night current inventory,

  • a model inventory (what we think we should stock) and,

  • a POS(point of sale)-terminal,

I can maintain a current inventory listing, and a “diff” (list of differences) of the current inventory with the model inventory as a reorder listing. This can be filtered with product listings from game distributors to make the actual reorder lists for each game distributor automatically.

Post

I wanted to know if Linux and perl could keep up with the most important store application, the Point Of Sale Terminal, so I set up a test database using perl's ndbm arrays.

One day I plan to barcode with “code 3 of 9”, a popular barcode format, which would contain the product numbers. Then a light-pen or a laser scanner can read the barcode just like you see at the grocery store. With that item code, an item's price can be looked up and an itemized receipt can be produced. More importantly, it also lets me make a record of what was sold, so we can reorder it.

I have a DOS disk from one of the game distributors that contains their full listing of products - about one Megabyte of data: about 50 characters per record, with about 20,000 records. I set up an ndbm file that mapped product numbers into item description and pricing information.

I stored each key (product number) in an array and picked a random index and looked up that key. I then put that in a loop and ran a few time trials.

With my 386/33dx system, I could access over 300 stock items in my test database per second. If you are really good, you can scan in about 1-2 items per second, and most people are much slower than that. In other words, there is plenty of time to make few database references per item. From that, I can see that there is plenty of CPU power to run a few cash registers, as well as time to edit comic subscriptions and even do some reordering, all at the same time. Remember, this is on an old 386/33dx.

Back to the Present

Every now and then I hear what a pain it is to do a reorder, but my partners are not yet ready to take the big step to automate. Some day the store will need an inventory system badly and Linux will be there, waiting for them. The store broke $1.5 million in gross sales this spring, after 3 years in business, so we may need to take this step soon.

If this interests you, here is our address and phone number:

The Streagic Castle

(Games, Comics and Miniatures) 114 North Toll Gate Road Bel Air Maryland 21014 +1 410 638 2400

Sorry, we do not do mail order.

Public Service Announcement

If there is anyone in the Bel Air, Maryland area that wants a copy of Linux, bring a big pile of floppies by the store (please call first) and I will see what I can do.