Programming

Do any of you know a way to batch-convert zine-formatted “ready to print” pdfs to conventionally-formatted ready-to-read ones?

P.S. The zine-formatted pdfs (a) include 2 pages on each page and (b) have previously reordered them as follows:

Last, 1st, 2nd, 2nd-to-last, 3rd-to-last, 3rd, 4th, 4th-to-last, 5th to last, 5th…

P.P.S. This lets me split files within my usual pdf processor, looks very handy. but doesn’t let me reorder them just yet:

https://www.mobileread.com/forums/showpost.php?p=3158904&postcount=1132

1 Like

I just want to schedule a taxi ride to a doctor’s appointment. I do not want a bonus migraine from your integrated slideshow and zooming Google Migraines.

6 Likes

have you ever looked at imagemagick?

for images, it lets you do all sorts of batch processing and manipulation. these days it also supports pdf.

if you haven’t found anything yet, it might be worth a read to see if it would help.

5 Likes

I hadn’t. But looking at the command line manual, it doesn’t seem to include odd/even commands let alone a/b/c/d commands.

3 Likes

P.S. Did some quick math. As long as one tool supports “odd,” “even,” and “reverse,” I can get one file with all the odd pages in order, and another with all the even pages in order. But I’m not sure what can splice them into all pages in order. And the fewer tools involved, the better.

P.S. QPDF can collate from 2 source pdfs. http://qpdf.sourceforge.net/files/qpdf-manual.html#ref.page-selection

P.P.S. But qpdf can’t split even and odd. My best option may be to use k2 to split he double-page sheets, cpdf to split things into 2 files, and qpdf to collate the files, and that depends how well cpdf handles multi-stage processes.

P.P.P.S. Trying to work out cpdf here…

2 Likes

I’m trying to use -stdout and -stdin for a multi-stage script. But it either fails right away, or runs forever, and never succeeds.

2 Likes

Stack Overflow strikes again. (Thread)

7 Likes

Many pieces of audiophile gear have an option to turn off the display-- it lowers the noise floor or something. Here, you have a headphone stand that is designed to produce noise, and mess around with your usb audio interface as well.

1 Like

Reading the thread on that, got to the one about DOS reserved file names, that reminded me of a couple of Windows tricks.

COPY CON, the editor of last resort: In older versions of Windows, you couldn’t readily create files starting with a period, like .htaccess, in explorer or file save dialogs. Because everything after the period is the extension, so it had no filename. And Windows by default hid extensions, so by default it would have no visible name at all (though it would show if you’d changed that setting). However, you could always

COPY CON .htaccess
; Some text here
^Z

and there you had a file that you could open and edit in any text editor.

The overly helpful help icon: Another one was sometime in the 90s when Microsoft decided to integrate the file explorer and internet explorer (in case you were masochistic enough to want to use IE as a file manager), and at the same time decided to make all their help files HTML.

If you were logged out, and didn’t know the password, you could click the nice little ‘Help’ icon for help on how to log in. This would open internet explorer to view the HTML help, and once it was open you could freely browse the file system and, in fact, by renaming one of the files you would then be able to log in without a password. Thus that help icon was a bit more helpful than expected. I used it to recover computers for people who’d been locked out by malware.

5 Likes

anybody familiar with PostGIS, or spatial databases in general?

I have a small CAD program that I’ve written to support my hobbies, and I’m wondering if some of the data model (various hashmaps, and lists of points and curves) could be ripped out and replaced with a real database-- and “native” support for geometrical objects could be real bonus.

At the same, time, I really have no interested in geography-- just 2D geometry.

Thoughts?

3 Likes

Does anyone know of a good way-- preferably on the command line-- to turn all text in pdfs black?

I had been using cpdf -blacktext, but apparently it’s supposed to be pay software, and I don’t want to pay that much for one function.

I have found instructions to reprocess through ps to turn all text into grayscale raster images. I don’t want that. I want to be able to read text, and a raster image of white text on a white background, having lost selectability and searchability, is not actually readable.

1 Like
4 Likes

Windows 95 setup was three programs in a trench coat, Microsoft vet reveals

5 Likes

As someone who’s done reverse engineering of 98 for security software, I’m about as surprised as Fry.

4 Likes

As someone who has recently gotten back into desktop Linux, I was a bit surprised that the GIMP hadn’t changed much since the last time I used it, until I started seeing announcements like this.

6 Likes

But are you shocked?

1 Like
5 Likes

I HATE CHARACTER SET MAPPING!

To send something via HTTP, it needs to be encoded.
Put something into JSON, it needs to be encoded.
Using a database? Better make sure your DB and tables have the right character set.
Better hope that your programming language’s string type is at least UTF-8.
Trying to write code that runs on Windows and Linux? Oh dear!
Dealing with web pages that use dozens of character variations for quotes? Fuck!

The worst part is that if everything isn’t correct, it’ll work 99% of the time, then bite you in the edge cases, sometimes years down the line.

I just fixed a 6 year-old Mediawiki page “Category:Adrian O’Hanlon” to “Category:Adrian O’Hanlon” (Argh! Discourse maps a curved single quote to a normal one, so don’t bother squinting for the difference), and there’s more cruft cleanup to be done.

Back in the day, we just used ASCII, and if we had lowercase, we were lucky!

6 Likes

Monty Python__Luxury!

4 Likes
  • Take data in TEI SGML (with &entity;s).
  • Import that into Perl and transcode into Unicode, so that áá. (But also a´á, and WTAF do I do with &nmacr;?)
  • Do more fiddling and write that into an SQLite DB. As utf8.
  • Now you want to write a web front end to query that data. Make sure web page is utf8. make sure the URIs are all correctly encoded. This search URI gets fed into Perl…
    • make sure the URI gets decoded
    • into utf8
    • and the SQL query string is also utf8.
    • and all the variables when your query is built from "SELECT * WHERE var=?;"
    • and the path over which the query is run is expecting utf8.
    • and the returned data is utf8
    • and the Template Toolkit is set to utf8
    • and the display page is set to utf8

And if, at any point, the data is interpreted as being 8 bit, then your data is full of ^A¬^Aé, and damned if you can figure out at which point it gets screwed up, and even when you do get it to mostly do the right thing, then for some reason searching for /\bcba\b/ correctly matches in asdf cba blah, but /\bcb[aá]\b/ matches in asdf cbáed blah, and you have some idea where it must be happening, but none at all why or what to do about it.

No, this is not from personal experience, why do you ask?

5 Likes