Can Lilypond produce variable paper height output? - lilypond

I have a large number of small scores intended for Sunday morning service leaflets. Preparing the image for insertion into the MS Word document includes removing all the vertical blank space, which is different for each piece.
I currently create custom paper sizes via #(set! paper-alist (cons ...)) but there is still quite a lot of cropping the output images.
Is there a better way?

I wrote a Bash shell script to do this: https://github.com/andrewacashner/lilypond/lilycrop.sh
In the terminal of a Unix-based system (or perhaps on Cygwin on Windows, though I haven't tested that), this script will automatically crop the PDF output by lilypond to a minimum size. It produces a separate cropped PDF file for each page of the original.

Lilypond has no internal way to produce automatically cropped output. On linux, you can use the pdfcrop tool which is part of the texlive-extra-utils package. Does the job nicely.

Related

Merge JSON data inside dynamic PDF templates

My problem is rather simple:
I need a tool to merge some medium complex JSON input data inside a template PDF.
Then based on the data:
Some sections of the template could be replicated.
Some sections may be deleted and the gap created should disappear.
Tables could be filled by N elements without messing the formatting.
Tables could have "merged cells inside"
Also templates should be easily adjustable without re-writing the code, this means they could be: editable PDF, Word files, Spreadsheets, some tool's templates... (..html?)
In all the tools i tried (a lot! :(( ), one or more of the points above was always a nightmare.
So far i tried:
latex -> pdflatex -> pdf: this probably simply reduced my life expectation by 1.. 1 and a 1/2 years. Unfortunately the most powerful tool because.. Latex? anyway not maintainable at all
pdfminer\pdfjs\whatever npm pkg.. : coding always ends up in a low level mess or huge workarounds.
google sheets -> pdf: APIs are kind of hard, and anyway are cell\row based so it's difficult to manage dynamic sections
pdfgeneratorapi.com : basically what i needed with a rich editor in it, but formatting and aligning tables is bugged so results are always ugly. Also things like "merged cells" are not possible.
So question would be: is there a tool or package out there in 2022 capable of handling all these requirements at once?
I would recommend using LaTeX for your PDF generation requirements. LaTeX comes with a huge number of available packages and chances are that someone has already solved your issue in LaTeX.
Specifically, DynamicDocs API by ADVICEment might be a good option for your requirements. DynamicDocs is JSON to PDF API based on LaTeX. Here are some features:
Ready-made JSON to PDF templates (no need to understand LaTeX)
Ability to write your own template in LaTeX and merge JSON to PDF using the R language layer, making the templates and their content dynamic
Excel to PDF Add-in (currently in Beta) to generate PDFs based on data in Excel
Each account is given a FREE plan with a limited number of monthly API calls
Disclaimer: I am involved in developing DynamicDocs API.

GNU Octave Save entire workspace

I can save individual variables fine in Octave, but i'm stuck when it comes to saving the entire workspace (ie, the whole screen with everything I've written on it)
eg
save file1
load file1
Doesn't seem to do anything
Any help greatly appreciated
David B
I do not think what you describe is a feature within Octave. You can save variables and the command history, see the description linked below, but I don't think its possible to save "the whole screen with everything I've written on it". Maybe if you better describe what elements you'd like to recover, specific instructions could be given.
Note that you aren't creating a "math document" like in Mathematica or GNU Maxima. This is a command interpreter, and recording commands entered and variables used is the usual extent of things to save.
https://phoxis.org/2013/04/06/save-work-environment-in-octave/

Massive data file conversion

I have a .data file that is +19MB in size. If I open it in texteditor on my Mac I get the circle of death. I've tried moving into a json file in Atom, but that too breaks. It's all on 1 line, so trying to beautify to break down file into manageable chunks is breaking my things too. I have cut about 150 lines worth, beautified it, and it came out great, but that's kb of data. I've got a +19MB file.
I've tried multiple ways of cutting and pasting to see if I can make smaller files, but that too breaks everything. Can I get this into sql?
I'm working on my personal project and this data file is critical to my project. Thanks!

how to create applications with Clozure Common Lisp (on Microsoft Windows)

I am a new one to Common Lisp (using Clozure Common Lisp under Microsoft Windows), who is familiar with c and python before. So maybe the questions are stupid here, but be patient to give me some help.
1) What's is the usual way to run a common lisp script?
Now, I wrote a bat file under windows to call ccl exe(wx86cl.exe) and evaluate (progn (load "my_script_full_path") (ccl:quit)) every time when I want to "run" my script. Is this a standard way to "run" a script for common lisp?
Any other suggestion about this?
2) What's the difference between (require 'cxml) and (asdf:operate 'asdf:load-op :cxml)?
They are seems to be the same for my script, which one should I use?
3) ignore it, not a clear question
4) When I want to load some library (such as require 'cxml), it always takes time(3s or even 5s) to load cxml every time when I "run" my script, there is also much log to standard output I show below, it seems like checking something internal. Does it means I have to spent 3-5s to load cxml every time when I want to run a simple test? It seems like a little inefficient and the output is noisy. Any suggestion?
My Script
(require 'cxml) (some-code-using-cxml)
And the output
; Loading system definition from D:/_play_/lispbox-0.7/quicklisp/dists/quicklisp/software/cxml-20101107-git/cxml.asd into #<Package "ASDF0">
;;; Checking for wide character support... yes, using code points.
; Registering #<SYSTEM "cxml-xml">
......
some my script output
---EDIT TO ADD MORE----
5) I must say that I almost forget the way of dumping image to accelerate the loading speed of lisp library. So, what is the normal process for us to develop a (maybe very simple) lisp script?
Base on the answer of what I got now, I guess maybe
a) edit your script
b) test it via a REPL environment, SLIME is a really good choice, and there should be many loop between a <==> b
c) dump the image to distribute it?( I am no sure about this)
6) Furthermore, what is the common way/form for us to release/distribute the final program?
For a lisp library, we just release our source code, and let someone else can "load/require" them.
For a lisp program, we dump a image to distribute it when we confirm that all functions go well.
Am I right?
What form do we use in a real product? Do we always dump all the thing into a image at final to speed up the loading speed?
1) Yes, the normal way to run a whole programme is to use a launcher script. However, windows has much, much better scripting support these days than just the bat interpreter. Windows Scripting Host and PowerShell ship as standard.
1a) During development, it is usual to simply type things in a the REPL (Read-Eval-Print-Loop, i.e. the lisp command line), or to use something like SLIME (for emacs or xemacs) as a development environment. If you don't know what they are, look them up. You may wish to use Cygwin to install xemacs, which will give you access to a range of linux-ish tools.
2) Require is, IIRC, a part of the standard. ASDF is technically not, it is a library that operates to make libraries work more conveniently. ASDF has a bunch of features that you will eventually want if you really get into writing large Lisp programmes.
3) Question unclear, pass.
4) See 1a) - do your tests and modifications in a running instance, thus avoiding the need to load the library more than once (just as you would in Python - you found the python repl, right?). In addition, when your programme is complete, you can probably dump an image which has all of your libraries pre-loaded.
Edit: additional answers:
5) Yes
6) Once you have dumped the image, you will still need to distribute the lisp binary to load the memory image. To make this transparent to the user, you will also have to have a loader script (or binary) to run the lisp binary with the image.
You don't have to start the lisp from scratch and load everything over again each time you want to run a simple test. For more efficient development, interactively evaluate code in the listener (REPL) of a running lisp environment.
For distribution, I use Zachary Beane's Buildapp tool. Very easy to install and use.
Regarding distribution -
I wrote a routine (it's at home and unavailable at the moment) that will write out the current image as a standard executable and quit. It works for both CLISP and SBCL.
I can rummage it up if you like.

Multi decision engine for increasing OCR accuracy

I want to be able to compare the results i get from running an OCR on the same document three times. Are there any tools out there that i can use to make this happen?
I would like compare the three documents and based on what characters are the same 3/3 times or 2/3 times, create a fourth document with the output of this decision. I am using Abby Fine reader which has given me great results, but i am trying to do everything i can to get to 100%.
I know microsoft word has a "compare documents" function, and i would like to be able to do this type of analysis on a larger scale with a robust algorithm.
any ideas?
Thanks for your time!
If the output is a simple text file, you could use the bash diff command and a simple shell script to compare them. You could probably then use a slightly more complicated shell script to parse through the output file and create a final document.