That’s neat. Ideally, I want this to work with linux.
I want to have a small thing like an arduino or pi that listens on a socket and have this connected to the printer 24/7.
So if someone using the web app logs an entry it gets the timestamp and specific numbers and sends it over to the device to be printed. I don’t want to have to have every user connected to this printer.
Yeah totally, would be a fun project. You might not need a printer as fancy as the one i linked.
Have a good trawl through youtube and the interwebs. Someone must be doing it somewhere.
Not sure if you’re just doing this for fun, if so that’s a neat project, but if you’re doing this for any type of real log retention that’s not an ideal setup.
Those are the required features that I have to work with lol.
As far as log retention goes, they need to maintain records for 5 years, both digital and paper. I can do the digital no problem, it was the paper one that was tripping me up.
Right now there is no digital, everything is handwritten when a truck comes in. My project is to alleviate the physical burden of having to do so and automating the process a bit. They still have to enter stuff into a form but its more straight forward and pre-populates with common data so it will speed up the process.
Hmm. What type of digital logs are you keeping? How are they formatted? Could you just print those logs programmatically each day at a printer that’s located by the person that keeps the paper logs?
Edit: To be clear I have absolutely no solution to your original issue, just trying to think of solutions to your problem as a whole.
I’m storing my logs as embedded data in a mongo database. Mostly just stuff off of a checklist. Trailer numbers, going-to/coming-from, who recorded the log, what time (ISO 8601 format), etc. Stuff like that.
I’ll be able to show you when I get home. Mostly as strings, but some are numbers.
Unfortunately no, they need to be printed, as soon as the document is inserted into the collection. It’s their policy. I brought this option up actually, but they refused.
How about writing a small service that connects to your database and monitors it for insertions and when a new record is written it reads the data and sends it to the printer?
I’m not familiar with MongoDB but in the past I’ve used ‘triggers’ with Oracle and SQL Server databases to perform work when data is modified.
A quick Google to see if there was something similar in MongoDB and I found something called “tailable cursors” cursors" which seem pretty cool. According to the docs they work very much like the “tail -f” unix/linux command.
If that’s the case could you have the service grab a cursor of all non printed records (when the entry is created it would have a flag set to indicate that it’s new and not yet printed).
When the service starts it would first print any records that have yet to be printed (as a catch up in case it was stopped for some time previously) , and print each one (updating the printed flag for each record as it goes) and then, as far as I can see, the code sits in a loop blocked on the tailed cursor which would wake when a new record is written that needs to be printed. The new record would then be printed, its printed flag updated and the code would go back to blocking on the tailed cursor.
You could do the same thing by just polling the DB for non printed records, but those tailed cursors (if they work how I think they might) seem like a better solution.